| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef StyleInvalidator_h | 5 #ifndef StyleInvalidator_h |
| 6 #define StyleInvalidator_h | 6 #define StyleInvalidator_h |
| 7 | 7 |
| 8 #include "core/css/invalidation/StyleInvalidationTracingEnabledFlag.h" |
| 8 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 class DescendantInvalidationSet; | 13 class DescendantInvalidationSet; |
| 13 class Document; | 14 class Document; |
| 14 class Element; | 15 class Element; |
| 15 | 16 |
| 16 class StyleInvalidator { | 17 class StyleInvalidator { |
| 17 DISALLOW_ALLOCATION(); | 18 DISALLOW_ALLOCATION(); |
| 18 public: | 19 public: |
| 19 StyleInvalidator(); | 20 StyleInvalidator(); |
| 20 ~StyleInvalidator(); | 21 ~StyleInvalidator(); |
| 22 |
| 21 void invalidate(Document&); | 23 void invalidate(Document&); |
| 22 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>,
Element&); | 24 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>,
Element&); |
| 23 | 25 |
| 24 // Clears all style invalidation state for the passed node. | 26 // Clears all style invalidation state for the passed node. |
| 25 void clearInvalidation(Node&); | 27 void clearInvalidation(Node&); |
| 26 | 28 |
| 27 void clearPendingInvalidations(); | 29 void clearPendingInvalidations(); |
| 28 | 30 |
| 29 void trace(Visitor*); | 31 void trace(Visitor*); |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 struct RecursionData { | 34 struct RecursionData { |
| 33 RecursionData() | 35 RecursionData() |
| 34 : m_invalidateCustomPseudo(false) | 36 : m_invalidateCustomPseudo(false) |
| 35 , m_wholeSubtreeInvalid(false) | 37 , m_wholeSubtreeInvalid(false) |
| 36 , m_treeBoundaryCrossing(false) | 38 , m_treeBoundaryCrossing(false) |
| 37 { } | 39 { } |
| 38 | 40 |
| 39 void pushInvalidationSet(const DescendantInvalidationSet&); | 41 void pushInvalidationSet(const DescendantInvalidationSet&); |
| 42 template <StyleInvalidationTracingEnabledFlag> |
| 40 bool matchesCurrentInvalidationSets(Element&); | 43 bool matchesCurrentInvalidationSets(Element&); |
| 41 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in
validationSets.size(); } | 44 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in
validationSets.size(); } |
| 42 | 45 |
| 43 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } | 46 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } |
| 44 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } | 47 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } |
| 45 | 48 |
| 46 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } | 49 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } |
| 47 | 50 |
| 48 typedef Vector<const DescendantInvalidationSet*, 16> InvalidationSets; | 51 typedef Vector<const DescendantInvalidationSet*, 16> InvalidationSets; |
| 49 InvalidationSets m_invalidationSets; | 52 InvalidationSets m_invalidationSets; |
| 50 bool m_invalidateCustomPseudo; | 53 bool m_invalidateCustomPseudo; |
| 51 bool m_wholeSubtreeInvalid; | 54 bool m_wholeSubtreeInvalid; |
| 52 bool m_treeBoundaryCrossing; | 55 bool m_treeBoundaryCrossing; |
| 53 }; | 56 }; |
| 54 | 57 |
| 58 template <StyleInvalidationTracingEnabledFlag> |
| 55 bool invalidate(Element&, RecursionData&); | 59 bool invalidate(Element&, RecursionData&); |
| 60 template <StyleInvalidationTracingEnabledFlag> |
| 56 bool invalidateChildren(Element&, RecursionData&); | 61 bool invalidateChildren(Element&, RecursionData&); |
| 62 template <StyleInvalidationTracingEnabledFlag> |
| 57 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&); | 63 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&); |
| 58 | 64 |
| 59 class RecursionCheckpoint { | 65 class RecursionCheckpoint { |
| 60 public: | 66 public: |
| 61 RecursionCheckpoint(RecursionData* data) | 67 RecursionCheckpoint(RecursionData* data) |
| 62 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) | 68 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) |
| 63 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) | 69 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) |
| 64 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) | 70 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) |
| 65 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) | 71 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) |
| 66 , m_data(data) | 72 , m_data(data) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 85 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<In
validationList> > PendingInvalidationMap; | 91 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<In
validationList> > PendingInvalidationMap; |
| 86 | 92 |
| 87 InvalidationList& ensurePendingInvalidationList(Element&); | 93 InvalidationList& ensurePendingInvalidationList(Element&); |
| 88 | 94 |
| 89 PendingInvalidationMap m_pendingInvalidationMap; | 95 PendingInvalidationMap m_pendingInvalidationMap; |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 } // namespace blink | 98 } // namespace blink |
| 93 | 99 |
| 94 #endif // StyleInvalidator_h | 100 #endif // StyleInvalidator_h |
| OLD | NEW |