| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DescendantInvalidationSet_h | 31 #ifndef DescendantInvalidationSet_h |
| 32 #define DescendantInvalidationSet_h | 32 #define DescendantInvalidationSet_h |
| 33 | 33 |
| 34 #include "core/css/invalidation/StyleInvalidationTracingEnabledFlag.h" |
| 34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 35 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 36 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
| 37 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/text/AtomicStringHash.h" | 40 #include "wtf/text/AtomicStringHash.h" |
| 40 #include "wtf/text/StringHash.h" | 41 #include "wtf/text/StringHash.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 class Element; | 45 class Element; |
| 46 class TracedValue; |
| 45 | 47 |
| 46 // Tracks data to determine which elements of a DOM subtree need to have style | 48 // Tracks data to determine which elements of a DOM subtree need to have style |
| 47 // recalculated. | 49 // recalculated. |
| 48 class DescendantInvalidationSet FINAL : public RefCountedWillBeGarbageCollected<
DescendantInvalidationSet> { | 50 class DescendantInvalidationSet FINAL : public RefCountedWillBeGarbageCollected<
DescendantInvalidationSet> { |
| 49 public: | 51 public: |
| 50 static PassRefPtrWillBeRawPtr<DescendantInvalidationSet> create() | 52 static PassRefPtrWillBeRawPtr<DescendantInvalidationSet> create() |
| 51 { | 53 { |
| 52 return adoptRefWillBeNoop(new DescendantInvalidationSet); | 54 return adoptRefWillBeNoop(new DescendantInvalidationSet); |
| 53 } | 55 } |
| 54 | 56 |
| 57 template <StyleInvalidationTracingEnabledFlag> |
| 55 bool invalidatesElement(Element&) const; | 58 bool invalidatesElement(Element&) const; |
| 56 | 59 |
| 57 void combine(const DescendantInvalidationSet& other); | 60 void combine(const DescendantInvalidationSet& other); |
| 58 | 61 |
| 59 void addClass(const AtomicString& className); | 62 void addClass(const AtomicString& className); |
| 60 void addId(const AtomicString& id); | 63 void addId(const AtomicString& id); |
| 61 void addTagName(const AtomicString& tagName); | 64 void addTagName(const AtomicString& tagName); |
| 62 void addAttribute(const AtomicString& attributeLocalName); | 65 void addAttribute(const AtomicString& attributeLocalName); |
| 63 | 66 |
| 64 void setWholeSubtreeInvalid(); | 67 void setWholeSubtreeInvalid(); |
| 65 bool wholeSubtreeInvalid() const { return m_allDescendantsMightBeInvalid; } | 68 bool wholeSubtreeInvalid() const { return m_allDescendantsMightBeInvalid; } |
| 66 | 69 |
| 67 void setTreeBoundaryCrossing() { m_treeBoundaryCrossing = true; } | 70 void setTreeBoundaryCrossing() { m_treeBoundaryCrossing = true; } |
| 68 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } | 71 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } |
| 69 | 72 |
| 70 void setCustomPseudoInvalid() { m_customPseudoInvalid = true; } | 73 void setCustomPseudoInvalid() { m_customPseudoInvalid = true; } |
| 71 bool customPseudoInvalid() const { return m_customPseudoInvalid; } | 74 bool customPseudoInvalid() const { return m_customPseudoInvalid; } |
| 72 | 75 |
| 73 bool isEmpty() const { return !m_classes && !m_ids && !m_tagNames && !m_attr
ibutes; } | 76 bool isEmpty() const { return !m_classes && !m_ids && !m_tagNames && !m_attr
ibutes; } |
| 74 | 77 |
| 75 void trace(Visitor*); | 78 void trace(Visitor*); |
| 76 | 79 |
| 80 void toTracedValue(TracedValue*) const; |
| 81 |
| 77 #ifndef NDEBUG | 82 #ifndef NDEBUG |
| 78 void show() const; | 83 void show() const; |
| 79 #endif | 84 #endif |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 DescendantInvalidationSet(); | 87 DescendantInvalidationSet(); |
| 83 | 88 |
| 84 WillBeHeapHashSet<AtomicString>& ensureClassSet(); | 89 WillBeHeapHashSet<AtomicString>& ensureClassSet(); |
| 85 WillBeHeapHashSet<AtomicString>& ensureIdSet(); | 90 WillBeHeapHashSet<AtomicString>& ensureIdSet(); |
| 86 WillBeHeapHashSet<AtomicString>& ensureTagNameSet(); | 91 WillBeHeapHashSet<AtomicString>& ensureTagNameSet(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 // If true, all descendants which are custom pseudo elements must be invalid
ated. | 103 // If true, all descendants which are custom pseudo elements must be invalid
ated. |
| 99 unsigned m_customPseudoInvalid : 1; | 104 unsigned m_customPseudoInvalid : 1; |
| 100 | 105 |
| 101 // If true, the invalidation must traverse into ShadowRoots with this set. | 106 // If true, the invalidation must traverse into ShadowRoots with this set. |
| 102 unsigned m_treeBoundaryCrossing : 1; | 107 unsigned m_treeBoundaryCrossing : 1; |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace blink | 110 } // namespace blink |
| 106 | 111 |
| 107 #endif // DescendantInvalidationSet_h | 112 #endif // DescendantInvalidationSet_h |
| OLD | NEW |