Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/ComputedStyleInlines.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
/*
8
 * Inlined methods for ComputedStyle. Will just redirect to
9
 * GeckoComputedStyle methods when compiled without stylo, but will do
10
 * virtual dispatch (by checking which kind of container it is)
11
 * in stylo mode.
12
 */
13
14
#ifndef ComputedStyleInlines_h
15
#define ComputedStyleInlines_h
16
17
#include "mozilla/ComputedStyle.h"
18
#include "mozilla/ServoComputedDataInlines.h"
19
#include "mozilla/ServoUtils.h"
20
21
namespace mozilla {
22
23
#define STYLE_STRUCT(name_)                                 \
24
const nsStyle##name_ *                                      \
25
0
ComputedStyle::Style##name_() {                             \
26
0
  return DoGetStyle##name_<true>();                         \
27
0
}                                                           \
Unexecuted instantiation: mozilla::ComputedStyle::StyleFont()
Unexecuted instantiation: mozilla::ComputedStyle::StyleColor()
Unexecuted instantiation: mozilla::ComputedStyle::StyleList()
Unexecuted instantiation: mozilla::ComputedStyle::StyleText()
Unexecuted instantiation: mozilla::ComputedStyle::StyleVisibility()
Unexecuted instantiation: mozilla::ComputedStyle::StyleUI()
Unexecuted instantiation: mozilla::ComputedStyle::StyleTableBorder()
Unexecuted instantiation: mozilla::ComputedStyle::StyleSVG()
Unexecuted instantiation: mozilla::ComputedStyle::StyleBackground()
Unexecuted instantiation: mozilla::ComputedStyle::StylePosition()
Unexecuted instantiation: mozilla::ComputedStyle::StyleTextReset()
Unexecuted instantiation: mozilla::ComputedStyle::StyleDisplay()
Unexecuted instantiation: mozilla::ComputedStyle::StyleContent()
Unexecuted instantiation: mozilla::ComputedStyle::StyleUIReset()
Unexecuted instantiation: mozilla::ComputedStyle::StyleTable()
Unexecuted instantiation: mozilla::ComputedStyle::StyleMargin()
Unexecuted instantiation: mozilla::ComputedStyle::StylePadding()
Unexecuted instantiation: mozilla::ComputedStyle::StyleBorder()
Unexecuted instantiation: mozilla::ComputedStyle::StyleOutline()
Unexecuted instantiation: mozilla::ComputedStyle::StyleXUL()
Unexecuted instantiation: mozilla::ComputedStyle::StyleSVGReset()
Unexecuted instantiation: mozilla::ComputedStyle::StyleColumn()
Unexecuted instantiation: mozilla::ComputedStyle::StyleEffects()
28
const nsStyle##name_ *                                      \
29
0
ComputedStyle::ThreadsafeStyle##name_() {                   \
30
0
  if (mozilla::IsInServoTraversal()) {                      \
31
0
    return ComputedData()->GetStyle##name_();               \
32
0
  }                                                         \
33
0
  return Style##name_();                                    \
34
0
}                                                           \
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleFont()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleColor()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleList()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleText()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleVisibility()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleUI()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleTableBorder()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleSVG()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleBackground()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStylePosition()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleTextReset()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleDisplay()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleContent()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleUIReset()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleTable()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleMargin()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStylePadding()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleBorder()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleOutline()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleXUL()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleSVGReset()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleColumn()
Unexecuted instantiation: mozilla::ComputedStyle::ThreadsafeStyleEffects()
35
0
const nsStyle##name_ * ComputedStyle::PeekStyle##name_() {  \
36
0
  return DoGetStyle##name_<false>();                        \
37
0
}
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleFont()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleColor()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleList()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleText()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleVisibility()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleUI()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleTableBorder()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleSVG()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleBackground()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStylePosition()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleTextReset()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleDisplay()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleContent()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleUIReset()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleTable()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleMargin()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStylePadding()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleBorder()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleOutline()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleXUL()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleSVGReset()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleColumn()
Unexecuted instantiation: mozilla::ComputedStyle::PeekStyleEffects()
38
#include "nsStyleStructList.h"
39
#undef STYLE_STRUCT
40
41
// Helper functions for GetStyle* and PeekStyle*
42
#define STYLE_STRUCT(name_)                                                 \
43
template<bool aComputeData>                                                 \
44
0
const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                  \
45
0
  const auto kStructID = StyleStructID::name_;                              \
46
0
  const bool needToCompute = !HasRequestedStruct(kStructID);                \
47
0
  if (!aComputeData && needToCompute) {                                     \
48
0
    return nullptr;                                                         \
49
0
  }                                                                         \
50
0
  const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
51
0
  /* perform any remaining main thread work on the struct */                \
52
0
  if (needToCompute) {                                                      \
53
0
    MOZ_ASSERT(NS_IsMainThread());                                          \
54
0
    MOZ_ASSERT(!mozilla::IsInServoTraversal());                             \
55
0
    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
56
0
    /* the ComputedStyle owns the struct */                                 \
57
0
    SetRequestedStruct(kStructID);                                          \
58
0
  }                                                                         \
59
0
  return data;                                                              \
60
0
}
Unexecuted instantiation: nsStyleFont const* mozilla::ComputedStyle::DoGetStyleFont<true>()
Unexecuted instantiation: nsStyleFont const* mozilla::ComputedStyle::DoGetStyleFont<false>()
Unexecuted instantiation: nsStyleColor const* mozilla::ComputedStyle::DoGetStyleColor<true>()
Unexecuted instantiation: nsStyleColor const* mozilla::ComputedStyle::DoGetStyleColor<false>()
Unexecuted instantiation: nsStyleList const* mozilla::ComputedStyle::DoGetStyleList<true>()
Unexecuted instantiation: nsStyleList const* mozilla::ComputedStyle::DoGetStyleList<false>()
Unexecuted instantiation: nsStyleText const* mozilla::ComputedStyle::DoGetStyleText<true>()
Unexecuted instantiation: nsStyleText const* mozilla::ComputedStyle::DoGetStyleText<false>()
Unexecuted instantiation: nsStyleVisibility const* mozilla::ComputedStyle::DoGetStyleVisibility<true>()
Unexecuted instantiation: nsStyleVisibility const* mozilla::ComputedStyle::DoGetStyleVisibility<false>()
Unexecuted instantiation: nsStyleUI const* mozilla::ComputedStyle::DoGetStyleUI<true>()
Unexecuted instantiation: nsStyleUI const* mozilla::ComputedStyle::DoGetStyleUI<false>()
Unexecuted instantiation: nsStyleTableBorder const* mozilla::ComputedStyle::DoGetStyleTableBorder<true>()
Unexecuted instantiation: nsStyleTableBorder const* mozilla::ComputedStyle::DoGetStyleTableBorder<false>()
Unexecuted instantiation: nsStyleSVG const* mozilla::ComputedStyle::DoGetStyleSVG<true>()
Unexecuted instantiation: nsStyleSVG const* mozilla::ComputedStyle::DoGetStyleSVG<false>()
Unexecuted instantiation: nsStyleBackground const* mozilla::ComputedStyle::DoGetStyleBackground<true>()
Unexecuted instantiation: nsStyleBackground const* mozilla::ComputedStyle::DoGetStyleBackground<false>()
Unexecuted instantiation: nsStylePosition const* mozilla::ComputedStyle::DoGetStylePosition<true>()
Unexecuted instantiation: nsStylePosition const* mozilla::ComputedStyle::DoGetStylePosition<false>()
Unexecuted instantiation: nsStyleTextReset const* mozilla::ComputedStyle::DoGetStyleTextReset<true>()
Unexecuted instantiation: nsStyleTextReset const* mozilla::ComputedStyle::DoGetStyleTextReset<false>()
Unexecuted instantiation: nsStyleDisplay const* mozilla::ComputedStyle::DoGetStyleDisplay<true>()
Unexecuted instantiation: nsStyleDisplay const* mozilla::ComputedStyle::DoGetStyleDisplay<false>()
Unexecuted instantiation: nsStyleContent const* mozilla::ComputedStyle::DoGetStyleContent<true>()
Unexecuted instantiation: nsStyleContent const* mozilla::ComputedStyle::DoGetStyleContent<false>()
Unexecuted instantiation: nsStyleUIReset const* mozilla::ComputedStyle::DoGetStyleUIReset<true>()
Unexecuted instantiation: nsStyleUIReset const* mozilla::ComputedStyle::DoGetStyleUIReset<false>()
Unexecuted instantiation: nsStyleTable const* mozilla::ComputedStyle::DoGetStyleTable<true>()
Unexecuted instantiation: nsStyleTable const* mozilla::ComputedStyle::DoGetStyleTable<false>()
Unexecuted instantiation: nsStyleMargin const* mozilla::ComputedStyle::DoGetStyleMargin<true>()
Unexecuted instantiation: nsStyleMargin const* mozilla::ComputedStyle::DoGetStyleMargin<false>()
Unexecuted instantiation: nsStylePadding const* mozilla::ComputedStyle::DoGetStylePadding<true>()
Unexecuted instantiation: nsStylePadding const* mozilla::ComputedStyle::DoGetStylePadding<false>()
Unexecuted instantiation: nsStyleBorder const* mozilla::ComputedStyle::DoGetStyleBorder<true>()
Unexecuted instantiation: nsStyleBorder const* mozilla::ComputedStyle::DoGetStyleBorder<false>()
Unexecuted instantiation: nsStyleOutline const* mozilla::ComputedStyle::DoGetStyleOutline<true>()
Unexecuted instantiation: nsStyleOutline const* mozilla::ComputedStyle::DoGetStyleOutline<false>()
Unexecuted instantiation: nsStyleXUL const* mozilla::ComputedStyle::DoGetStyleXUL<true>()
Unexecuted instantiation: nsStyleXUL const* mozilla::ComputedStyle::DoGetStyleXUL<false>()
Unexecuted instantiation: nsStyleSVGReset const* mozilla::ComputedStyle::DoGetStyleSVGReset<true>()
Unexecuted instantiation: nsStyleSVGReset const* mozilla::ComputedStyle::DoGetStyleSVGReset<false>()
Unexecuted instantiation: nsStyleColumn const* mozilla::ComputedStyle::DoGetStyleColumn<true>()
Unexecuted instantiation: nsStyleColumn const* mozilla::ComputedStyle::DoGetStyleColumn<false>()
Unexecuted instantiation: nsStyleEffects const* mozilla::ComputedStyle::DoGetStyleEffects<true>()
Unexecuted instantiation: nsStyleEffects const* mozilla::ComputedStyle::DoGetStyleEffects<false>()
61
#include "nsStyleStructList.h"
62
#undef STYLE_STRUCT
63
64
void
65
ComputedStyle::StartBackgroundImageLoads()
66
0
{
67
0
  // Just get our background struct; that should do the trick
68
0
  StyleBackground();
69
0
}
70
71
void
72
ComputedStyle::ResolveSameStructsAs(const ComputedStyle* aOther)
73
0
{
74
0
  // Only resolve structs that are not already resolved in this struct.
75
0
  auto newBits = aOther->mRequestedStructs & ~mRequestedStructs;
76
0
77
0
#define STYLE_STRUCT(name_)                                                    \
78
0
  if (nsStyle##name_::kHasFinishStyle &&                                       \
79
0
      (newBits & StyleStructConstants::BitFor(StyleStructID::name_))) {        \
80
0
    const nsStyle##name_* data = ComputedData()->GetStyle##name_();            \
81
0
    const nsStyle##name_* oldData = aOther->ComputedData()->GetStyle##name_(); \
82
0
    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, oldData);     \
83
0
  }
84
0
#include "nsStyleStructList.h"
85
0
#undef STYLE_STRUCT
86
0
87
0
  mRequestedStructs |= newBits;
88
0
}
89
90
} // namespace mozilla
91
92
93
#endif // ComputedStyleInlines_h