| 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 : public NoBaseWillBeGarbageCollectedFinalized<ShadowRo
otRareData> { | 40 class ShadowRootRareData : public NoBaseWillBeGarbageCollected<ShadowRootRareDat
a> { |
| 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(PassRefPtrWillBeRawPtr<HTMLS
hadowElement> shadowInsertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot
= shadowInsertionPoint; } |
| 51 | 51 |
| 52 void didAddInsertionPoint(InsertionPoint*); | 52 void didAddInsertionPoint(InsertionPoint*); |
| 53 void didRemoveInsertionPoint(InsertionPoint*); | 53 void didRemoveInsertionPoint(InsertionPoint*); |
| 54 | 54 |
| 55 bool containsShadowElements() const { return m_descendantShadowElementCount;
} | 55 bool containsShadowElements() const { return m_descendantShadowElementCount;
} |
| 56 bool containsContentElements() const { return m_descendantContentElementCoun
t; } | 56 bool containsContentElements() const { return m_descendantContentElementCoun
t; } |
| 57 bool containsShadowRoots() const { return m_childShadowRootCount; } | 57 bool containsShadowRoots() const { return m_childShadowRootCount; } |
| 58 | 58 |
| 59 unsigned descendantShadowElementCount() const { return m_descendantShadowEle
mentCount; } | 59 unsigned descendantShadowElementCount() const { return m_descendantShadowEle
mentCount; } |
| 60 | 60 |
| 61 void didAddChildShadowRoot() { ++m_childShadowRootCount; } | 61 void didAddChildShadowRoot() { ++m_childShadowRootCount; } |
| 62 void didRemoveChildShadowRoot() { ASSERT(m_childShadowRootCount > 0); --m_ch
ildShadowRootCount; } | 62 void didRemoveChildShadowRoot() { ASSERT(m_childShadowRootCount > 0); --m_ch
ildShadowRootCount; } |
| 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 WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> >& descendantInser
tionPoints() { return m_descendantInsertionPoints; } |
| 67 void setDescendantInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m
_descendantInsertionPoints.swap(list); } | 67 void setDescendantInsertionPoints(WillBeHeapVector<RefPtrWillBeMember<Insert
ionPoint> >& 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); } | 73 void trace(Visitor* visitor) |
| 74 { |
| 75 visitor->trace(m_shadowInsertionPointOfYoungerShadowRoot); |
| 76 visitor->trace(m_descendantInsertionPoints); |
| 77 visitor->trace(m_styleSheetList); |
| 78 } |
| 74 | 79 |
| 75 private: | 80 private: |
| 76 RefPtr<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; | 81 RefPtrWillBeMember<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowR
oot; |
| 77 unsigned m_descendantShadowElementCount; | 82 unsigned m_descendantShadowElementCount; |
| 78 unsigned m_descendantContentElementCount; | 83 unsigned m_descendantContentElementCount; |
| 79 unsigned m_childShadowRootCount; | 84 unsigned m_childShadowRootCount; |
| 80 Vector<RefPtr<InsertionPoint> > m_descendantInsertionPoints; | 85 WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> > m_descendantInsertionP
oints; |
| 81 RefPtrWillBeMember<StyleSheetList> m_styleSheetList; | 86 RefPtrWillBeMember<StyleSheetList> m_styleSheetList; |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) | 89 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) |
| 85 { | 90 { |
| 86 ASSERT(point); | 91 ASSERT(point); |
| 87 if (isHTMLShadowElement(*point)) | 92 if (isHTMLShadowElement(*point)) |
| 88 ++m_descendantShadowElementCount; | 93 ++m_descendantShadowElementCount; |
| 89 else if (isHTMLContentElement(*point)) | 94 else if (isHTMLContentElement(*point)) |
| 90 ++m_descendantContentElementCount; | 95 ++m_descendantContentElementCount; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 102 else | 107 else |
| 103 ASSERT_NOT_REACHED(); | 108 ASSERT_NOT_REACHED(); |
| 104 | 109 |
| 105 ASSERT(m_descendantContentElementCount >= 0); | 110 ASSERT(m_descendantContentElementCount >= 0); |
| 106 ASSERT(m_descendantShadowElementCount >= 0); | 111 ASSERT(m_descendantShadowElementCount >= 0); |
| 107 } | 112 } |
| 108 | 113 |
| 109 } // namespace WebCore | 114 } // namespace WebCore |
| 110 | 115 |
| 111 #endif | 116 #endif |
| OLD | NEW |