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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef ShadowRootRareData_h | 31 #ifndef ShadowRootRareData_h |
32 #define ShadowRootRareData_h | 32 #define ShadowRootRareData_h |
33 | 33 |
34 #include "core/dom/shadow/InsertionPoint.h" | 34 #include "core/dom/shadow/InsertionPoint.h" |
35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
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 : public NoBaseWillBeGarbageCollectedFinalized<ShadowRo
otRareData> { |
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 { | 46 { |
47 } | 47 } |
48 | 48 |
49 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return
m_shadowInsertionPointOfYoungerShadowRoot.get(); } | 49 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return
m_shadowInsertionPointOfYoungerShadowRoot.get(); } |
50 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement
> shadowInsertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInse
rtionPoint; } | 50 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement
> shadowInsertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInse
rtionPoint; } |
(...skipping 12 matching lines...) Expand all Loading... |
63 | 63 |
64 unsigned childShadowRootCount() const { return m_childShadowRootCount; } | 64 unsigned childShadowRootCount() const { return m_childShadowRootCount; } |
65 | 65 |
66 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints() { return
m_descendantInsertionPoints; } | 66 const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints() { return
m_descendantInsertionPoints; } |
67 void setDescendantInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m
_descendantInsertionPoints.swap(list); } | 67 void setDescendantInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m
_descendantInsertionPoints.swap(list); } |
68 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear();
} | 68 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear();
} |
69 | 69 |
70 StyleSheetList* styleSheets() { return m_styleSheetList.get(); } | 70 StyleSheetList* styleSheets() { return m_styleSheetList.get(); } |
71 void setStyleSheets(PassRefPtrWillBeRawPtr<StyleSheetList> styleSheetList) {
m_styleSheetList = styleSheetList; } | 71 void setStyleSheets(PassRefPtrWillBeRawPtr<StyleSheetList> styleSheetList) {
m_styleSheetList = styleSheetList; } |
72 | 72 |
| 73 void trace(Visitor* visitor) { visitor->trace(m_styleSheetList); } |
| 74 |
73 private: | 75 private: |
74 RefPtr<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; | 76 RefPtr<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; |
75 unsigned m_descendantShadowElementCount; | 77 unsigned m_descendantShadowElementCount; |
76 unsigned m_descendantContentElementCount; | 78 unsigned m_descendantContentElementCount; |
77 unsigned m_childShadowRootCount; | 79 unsigned m_childShadowRootCount; |
78 Vector<RefPtr<InsertionPoint> > m_descendantInsertionPoints; | 80 Vector<RefPtr<InsertionPoint> > m_descendantInsertionPoints; |
79 RefPtrWillBePersistent<StyleSheetList> m_styleSheetList; | 81 RefPtrWillBeMember<StyleSheetList> m_styleSheetList; |
80 }; | 82 }; |
81 | 83 |
82 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) | 84 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) |
83 { | 85 { |
84 ASSERT(point); | 86 ASSERT(point); |
85 if (isHTMLShadowElement(*point)) | 87 if (isHTMLShadowElement(*point)) |
86 ++m_descendantShadowElementCount; | 88 ++m_descendantShadowElementCount; |
87 else if (isHTMLContentElement(*point)) | 89 else if (isHTMLContentElement(*point)) |
88 ++m_descendantContentElementCount; | 90 ++m_descendantContentElementCount; |
89 else | 91 else |
(...skipping 10 matching lines...) Expand all Loading... |
100 else | 102 else |
101 ASSERT_NOT_REACHED(); | 103 ASSERT_NOT_REACHED(); |
102 | 104 |
103 ASSERT(m_descendantContentElementCount >= 0); | 105 ASSERT(m_descendantContentElementCount >= 0); |
104 ASSERT(m_descendantShadowElementCount >= 0); | 106 ASSERT(m_descendantShadowElementCount >= 0); |
105 } | 107 } |
106 | 108 |
107 } // namespace WebCore | 109 } // namespace WebCore |
108 | 110 |
109 #endif | 111 #endif |
OLD | NEW |