OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class ShadowRootRareData { | 40 class ShadowRootRareData { |
41 public: | 41 public: |
42 ShadowRootRareData() | 42 ShadowRootRareData() |
43 : m_descendantShadowElementCount(0) | 43 : m_descendantShadowElementCount(0) |
44 , m_descendantContentElementCount(0) | 44 , m_descendantContentElementCount(0) |
45 , m_childShadowRootCount(0) | 45 , m_childShadowRootCount(0) |
46 , m_childrenAffectedByDirectAdjacentRules(false) | |
47 , m_childrenAffectedByIndirectAdjacentRules(false) | |
48 , m_childrenAffectedByForwardPositionalRules(false) | |
49 , m_childrenAffectedByBackwardPositionalRules(false) | |
50 , m_childrenAffectedByFirstChildRules(false) | |
51 , m_childrenAffectedByLastChildRules(false) | |
52 { | 46 { |
53 } | 47 } |
54 | 48 |
55 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return
m_shadowInsertionPointOfYoungerShadowRoot.get(); } | 49 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return
m_shadowInsertionPointOfYoungerShadowRoot.get(); } |
56 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement
> shadowInsertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInse
rtionPoint; } | 50 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement
> shadowInsertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInse
rtionPoint; } |
57 | 51 |
58 void didAddInsertionPoint(InsertionPoint*); | 52 void didAddInsertionPoint(InsertionPoint*); |
59 void didRemoveInsertionPoint(InsertionPoint*); | 53 void didRemoveInsertionPoint(InsertionPoint*); |
60 | 54 |
61 bool containsShadowElements() const { return m_descendantShadowElementCount;
} | 55 bool containsShadowElements() const { return m_descendantShadowElementCount;
} |
62 bool containsContentElements() const { return m_descendantContentElementCoun
t; } | 56 bool containsContentElements() const { return m_descendantContentElementCoun
t; } |
63 bool containsShadowRoots() const { return m_childShadowRootCount; } | 57 bool containsShadowRoots() const { return m_childShadowRootCount; } |
64 | 58 |
65 unsigned descendantShadowElementCount() const { return m_descendantShadowEle
mentCount; } | 59 unsigned descendantShadowElementCount() const { return m_descendantShadowEle
mentCount; } |
66 | 60 |
67 void didAddChildShadowRoot() { ++m_childShadowRootCount; } | 61 void didAddChildShadowRoot() { ++m_childShadowRootCount; } |
68 void didRemoveChildShadowRoot() { ASSERT(m_childShadowRootCount > 0); --m_ch
ildShadowRootCount; } | 62 void didRemoveChildShadowRoot() { ASSERT(m_childShadowRootCount > 0); --m_ch
ildShadowRootCount; } |
69 | 63 |
70 unsigned childShadowRootCount() const { return m_childShadowRootCount; } | 64 unsigned childShadowRootCount() const { return m_childShadowRootCount; } |
71 | 65 |
72 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints() { return
m_descendantInsertionPoints; } | 66 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints() { return
m_descendantInsertionPoints; } |
73 void setDescendantInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m
_descendantInsertionPoints.swap(list); } | 67 void setDescendantInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m
_descendantInsertionPoints.swap(list); } |
74 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear();
} | 68 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear();
} |
75 | 69 |
76 StyleSheetList* styleSheets() { return m_styleSheetList.get(); } | 70 StyleSheetList* styleSheets() { return m_styleSheetList.get(); } |
77 void setStyleSheets(PassRefPtrWillBeRawPtr<StyleSheetList> styleSheetList) {
m_styleSheetList = styleSheetList; } | 71 void setStyleSheets(PassRefPtrWillBeRawPtr<StyleSheetList> styleSheetList) {
m_styleSheetList = styleSheetList; } |
78 | 72 |
79 bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffect
edByDirectAdjacentRules; } | |
80 void setChildrenAffectedByDirectAdjacentRules(bool value) { m_childrenAffect
edByDirectAdjacentRules = value; } | |
81 | |
82 bool childrenAffectedByIndirectAdjacentRules() const { return m_childrenAffe
ctedByIndirectAdjacentRules; } | |
83 void setChildrenAffectedByIndirectAdjacentRules(bool value) { m_childrenAffe
ctedByIndirectAdjacentRules = value; } | |
84 | |
85 bool childrenAffectedByForwardPositionalRules() const { return m_childrenAff
ectedByForwardPositionalRules; } | |
86 void setChildrenAffectedByForwardPositionalRules(bool value) { m_childrenAff
ectedByForwardPositionalRules = value; } | |
87 | |
88 bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAf
fectedByBackwardPositionalRules; } | |
89 void setChildrenAffectedByBackwardPositionalRules(bool value) { m_childrenAf
fectedByBackwardPositionalRules = value; } | |
90 | |
91 bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedBy
FirstChildRules; } | |
92 void setChildrenAffectedByFirstChildRules(bool value) { m_childrenAffectedBy
FirstChildRules = value; } | |
93 | |
94 bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByL
astChildRules; } | |
95 void setChildrenAffectedByLastChildRules(bool value) { m_childrenAffectedByL
astChildRules = value; } | |
96 | |
97 private: | 73 private: |
98 RefPtr<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; | 74 RefPtr<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; |
99 unsigned m_descendantShadowElementCount; | 75 unsigned m_descendantShadowElementCount; |
100 unsigned m_descendantContentElementCount; | 76 unsigned m_descendantContentElementCount; |
101 unsigned m_childShadowRootCount; | 77 unsigned m_childShadowRootCount; |
102 Vector<RefPtr<InsertionPoint> > m_descendantInsertionPoints; | 78 Vector<RefPtr<InsertionPoint> > m_descendantInsertionPoints; |
103 RefPtrWillBePersistent<StyleSheetList> m_styleSheetList; | 79 RefPtrWillBePersistent<StyleSheetList> m_styleSheetList; |
104 | |
105 unsigned m_childrenAffectedByDirectAdjacentRules : 1; | |
106 unsigned m_childrenAffectedByIndirectAdjacentRules : 1; | |
107 unsigned m_childrenAffectedByForwardPositionalRules : 1; | |
108 unsigned m_childrenAffectedByBackwardPositionalRules : 1; | |
109 unsigned m_childrenAffectedByFirstChildRules : 1; | |
110 unsigned m_childrenAffectedByLastChildRules : 1; | |
111 }; | 80 }; |
112 | 81 |
113 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) | 82 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) |
114 { | 83 { |
115 ASSERT(point); | 84 ASSERT(point); |
116 if (isHTMLShadowElement(*point)) | 85 if (isHTMLShadowElement(*point)) |
117 ++m_descendantShadowElementCount; | 86 ++m_descendantShadowElementCount; |
118 else if (isHTMLContentElement(*point)) | 87 else if (isHTMLContentElement(*point)) |
119 ++m_descendantContentElementCount; | 88 ++m_descendantContentElementCount; |
120 else | 89 else |
(...skipping 10 matching lines...) Expand all Loading... |
131 else | 100 else |
132 ASSERT_NOT_REACHED(); | 101 ASSERT_NOT_REACHED(); |
133 | 102 |
134 ASSERT(m_descendantContentElementCount >= 0); | 103 ASSERT(m_descendantContentElementCount >= 0); |
135 ASSERT(m_descendantShadowElementCount >= 0); | 104 ASSERT(m_descendantShadowElementCount >= 0); |
136 } | 105 } |
137 | 106 |
138 } // namespace WebCore | 107 } // namespace WebCore |
139 | 108 |
140 #endif | 109 #endif |
OLD | NEW |