Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/style/nsCSSAnonBoxes.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
/* atom list for CSS anonymous boxes */
8
9
#ifndef nsCSSAnonBoxes_h___
10
#define nsCSSAnonBoxes_h___
11
12
#include "nsAtom.h"
13
#include "nsGkAtoms.h"
14
15
class nsCSSAnonBoxes {
16
public:
17
  static bool IsAnonBox(nsAtom *aAtom);
18
#ifdef MOZ_XUL
19
  static bool IsTreePseudoElement(nsAtom* aPseudo);
20
#endif
21
  static bool IsNonElement(nsAtom* aPseudo)
22
0
  {
23
0
    return aPseudo == nsCSSAnonBoxes::mozText() ||
24
0
           aPseudo == nsCSSAnonBoxes::oofPlaceholder() ||
25
0
           aPseudo == nsCSSAnonBoxes::firstLetterContinuation();
26
0
  }
27
28
  typedef uint8_t NonInheritingBase;
29
  enum class NonInheriting : NonInheritingBase {
30
#define CSS_ANON_BOX(_name, _value) /* nothing */
31
#define CSS_NON_INHERITING_ANON_BOX(_name, _value) _name,
32
#include "nsCSSAnonBoxList.h"
33
#undef CSS_NON_INHERITING_ANON_BOX
34
#undef CSS_ANON_BOX
35
    _Count
36
  };
37
38
  // Be careful using this: if we have a lot of non-inheriting anon box types it
39
  // might not be very fast.  We may want to think of ways to handle that
40
  // (e.g. by moving to an enum instead of an atom, like we did for
41
  // pseudo-elements, or by adding a new value of the pseudo-element enum for
42
  // non-inheriting anon boxes or something).
43
  static bool IsNonInheritingAnonBox(nsAtom* aPseudo)
44
0
  {
45
0
    return
46
0
#define CSS_ANON_BOX(_name, _value) /* nothing */
47
0
#define CSS_NON_INHERITING_ANON_BOX(_name, _value) \
48
0
      nsGkAtoms::AnonBox_##_name == aPseudo ||
49
0
#include "nsCSSAnonBoxList.h"
50
0
#undef CSS_NON_INHERITING_ANON_BOX
51
0
#undef CSS_ANON_BOX
52
0
      false;
53
0
  }
54
55
#ifdef DEBUG
56
  // NOTE(emilio): DEBUG only because this does a pretty slow linear search. Try
57
  // to use IsNonInheritingAnonBox if you know the atom is an anon box already
58
  // or, even better, nothing like this.  Note that this function returns true
59
  // for wrapper anon boxes as well, since they're all inheriting.
60
  static bool IsInheritingAnonBox(nsAtom* aPseudo)
61
  {
62
    return
63
#define CSS_ANON_BOX(_name, _value) nsGkAtoms::AnonBox_##_name == aPseudo ||
64
#define CSS_NON_INHERITING_ANON_BOX(_name, _value) /* nothing */
65
#include "nsCSSAnonBoxList.h"
66
#undef CSS_NON_INHERITING_ANON_BOX
67
#undef CSS_ANON_BOX
68
      false;
69
  }
70
#endif // DEBUG
71
72
  // This function is rather slow; you probably don't want to use it outside
73
  // asserts unless you have to.
74
0
  static bool IsWrapperAnonBox(nsAtom* aPseudo) {
75
0
    // We commonly get null passed here, and want to quickly return false for
76
0
    // it.
77
0
    return aPseudo &&
78
0
      (
79
0
#define CSS_ANON_BOX(_name, _value) /* nothing */
80
0
#define CSS_WRAPPER_ANON_BOX(_name, _value) nsGkAtoms::AnonBox_##_name == aPseudo ||
81
0
#define CSS_NON_INHERITING_ANON_BOX(_name, _value) /* nothing */
82
0
#include "nsCSSAnonBoxList.h"
83
0
#undef CSS_NON_INHERITING_ANON_BOX
84
0
#undef CSS_WRAPPER_ANON_BOX
85
0
#undef CSS_ANON_BOX
86
0
       false);
87
0
  }
88
89
  // Get the NonInheriting type for a given pseudo tag.  The pseudo tag must
90
  // test true for IsNonInheritingAnonBox.
91
  static NonInheriting NonInheritingTypeForPseudoTag(nsAtom* aPseudo);
92
93
#ifdef DEBUG
94
  static void AssertAtoms();
95
#endif
96
97
  // Alias nsCSSAnonBoxes::foo() to alias nsGkAtoms::AnonBox_foo.
98
  // XXX Once nsGkAtoms::AnonBox_foo become constexpr variables, these can too.
99
  // See bug 1449787.
100
  #define CSS_ANON_BOX(name_, value_)                     \
101
    static constexpr nsICSSAnonBoxPseudo* const& name_()  \
102
0
    {                                                     \
103
0
      return nsGkAtoms::AnonBox_##name_;                  \
104
0
    }
Unexecuted instantiation: nsCSSAnonBoxes::oofPlaceholder()
Unexecuted instantiation: nsCSSAnonBoxes::horizontalFramesetBorder()
Unexecuted instantiation: nsCSSAnonBoxes::verticalFramesetBorder()
Unexecuted instantiation: nsCSSAnonBoxes::framesetBlank()
Unexecuted instantiation: nsCSSAnonBoxes::tableColGroup()
Unexecuted instantiation: nsCSSAnonBoxes::tableCol()
Unexecuted instantiation: nsCSSAnonBoxes::pageBreak()
Unexecuted instantiation: nsCSSAnonBoxes::mozText()
Unexecuted instantiation: nsCSSAnonBoxes::firstLetterContinuation()
Unexecuted instantiation: nsCSSAnonBoxes::mozBlockInsideInlineWrapper()
Unexecuted instantiation: nsCSSAnonBoxes::mozMathMLAnonymousBlock()
Unexecuted instantiation: nsCSSAnonBoxes::mozXULAnonymousBlock()
Unexecuted instantiation: nsCSSAnonBoxes::mozLineFrame()
Unexecuted instantiation: nsCSSAnonBoxes::buttonContent()
Unexecuted instantiation: nsCSSAnonBoxes::cellContent()
Unexecuted instantiation: nsCSSAnonBoxes::dropDownList()
Unexecuted instantiation: nsCSSAnonBoxes::fieldsetContent()
Unexecuted instantiation: nsCSSAnonBoxes::mozDisplayComboboxControlFrame()
Unexecuted instantiation: nsCSSAnonBoxes::inlineTable()
Unexecuted instantiation: nsCSSAnonBoxes::table()
Unexecuted instantiation: nsCSSAnonBoxes::tableCell()
Unexecuted instantiation: nsCSSAnonBoxes::tableWrapper()
Unexecuted instantiation: nsCSSAnonBoxes::tableRowGroup()
Unexecuted instantiation: nsCSSAnonBoxes::tableRow()
Unexecuted instantiation: nsCSSAnonBoxes::canvas()
Unexecuted instantiation: nsCSSAnonBoxes::page()
Unexecuted instantiation: nsCSSAnonBoxes::pageContent()
Unexecuted instantiation: nsCSSAnonBoxes::pageSequence()
Unexecuted instantiation: nsCSSAnonBoxes::scrolledContent()
Unexecuted instantiation: nsCSSAnonBoxes::scrolledCanvas()
Unexecuted instantiation: nsCSSAnonBoxes::scrolledPageSequence()
Unexecuted instantiation: nsCSSAnonBoxes::columnContent()
Unexecuted instantiation: nsCSSAnonBoxes::viewport()
Unexecuted instantiation: nsCSSAnonBoxes::viewportScroll()
Unexecuted instantiation: nsCSSAnonBoxes::anonymousFlexItem()
Unexecuted instantiation: nsCSSAnonBoxes::anonymousGridItem()
Unexecuted instantiation: nsCSSAnonBoxes::ruby()
Unexecuted instantiation: nsCSSAnonBoxes::rubyBase()
Unexecuted instantiation: nsCSSAnonBoxes::rubyBaseContainer()
Unexecuted instantiation: nsCSSAnonBoxes::rubyText()
Unexecuted instantiation: nsCSSAnonBoxes::rubyTextContainer()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeColumn()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeRow()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeSeparator()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeCell()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeIndentation()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeLine()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeTwisty()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeImage()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeCellText()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeCheckbox()
Unexecuted instantiation: nsCSSAnonBoxes::mozTreeDropFeedback()
Unexecuted instantiation: nsCSSAnonBoxes::mozSVGMarkerAnonChild()
Unexecuted instantiation: nsCSSAnonBoxes::mozSVGOuterSVGAnonChild()
105
  #include "nsCSSAnonBoxList.h"
106
  #undef CSS_ANON_BOX
107
};
108
109
#endif /* nsCSSAnonBoxes_h___ */