| 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 "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>,
Element&); | 22 void scheduleInvalidation(PassRefPtrWillBeRawPtr<DescendantInvalidationSet>,
Element&); |
| 23 | 23 |
| 24 // Clears all style invalidation state for the passed node. | 24 // Clears all style invalidation state for the passed node. |
| 25 void clearInvalidation(Node&); | 25 void clearInvalidation(Node&); |
| 26 | 26 |
| 27 void clearPendingInvalidations(); | 27 void clearPendingInvalidations(); |
| 28 | 28 |
| 29 void trace(Visitor*); | 29 void trace(Visitor*); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 bool invalidate(Element&); | |
| 33 bool invalidateChildren(Element&); | |
| 34 | |
| 35 bool checkInvalidationSetsAgainstElement(Element&); | |
| 36 | |
| 37 struct RecursionData { | 32 struct RecursionData { |
| 38 RecursionData() | 33 RecursionData() |
| 39 : m_invalidateCustomPseudo(false) | 34 : m_invalidateCustomPseudo(false) |
| 40 , m_wholeSubtreeInvalid(false) | 35 , m_wholeSubtreeInvalid(false) |
| 41 , m_treeBoundaryCrossing(false) | 36 , m_treeBoundaryCrossing(false) |
| 42 { } | 37 { } |
| 43 | 38 |
| 44 void pushInvalidationSet(const DescendantInvalidationSet&); | 39 void pushInvalidationSet(const DescendantInvalidationSet&); |
| 45 bool matchesCurrentInvalidationSets(Element&); | 40 bool matchesCurrentInvalidationSets(Element&); |
| 46 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in
validationSets.size(); } | 41 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in
validationSets.size(); } |
| 47 | 42 |
| 48 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } | 43 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; } |
| 49 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } | 44 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; } |
| 50 | 45 |
| 51 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } | 46 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; } |
| 52 | 47 |
| 53 typedef Vector<const DescendantInvalidationSet*, 16> InvalidationSets; | 48 typedef Vector<const DescendantInvalidationSet*, 16> InvalidationSets; |
| 54 InvalidationSets m_invalidationSets; | 49 InvalidationSets m_invalidationSets; |
| 55 bool m_invalidateCustomPseudo; | 50 bool m_invalidateCustomPseudo; |
| 56 bool m_wholeSubtreeInvalid; | 51 bool m_wholeSubtreeInvalid; |
| 57 bool m_treeBoundaryCrossing; | 52 bool m_treeBoundaryCrossing; |
| 58 }; | 53 }; |
| 59 | 54 |
| 55 bool invalidate(Element&, RecursionData&); |
| 56 bool invalidateChildren(Element&, RecursionData&); |
| 57 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&); |
| 58 |
| 60 class RecursionCheckpoint { | 59 class RecursionCheckpoint { |
| 61 public: | 60 public: |
| 62 RecursionCheckpoint(RecursionData* data) | 61 RecursionCheckpoint(RecursionData* data) |
| 63 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) | 62 : m_prevInvalidationSetsSize(data->m_invalidationSets.size()) |
| 64 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) | 63 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo) |
| 65 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) | 64 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid) |
| 66 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) | 65 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing) |
| 67 , m_data(data) | 66 , m_data(data) |
| 68 { } | 67 { } |
| 69 ~RecursionCheckpoint() | 68 ~RecursionCheckpoint() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 bool m_treeBoundaryCrossing; | 80 bool m_treeBoundaryCrossing; |
| 82 RecursionData* m_data; | 81 RecursionData* m_data; |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 typedef WillBeHeapVector<RefPtrWillBeMember<DescendantInvalidationSet> > Inv
alidationList; | 84 typedef WillBeHeapVector<RefPtrWillBeMember<DescendantInvalidationSet> > Inv
alidationList; |
| 86 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<In
validationList> > PendingInvalidationMap; | 85 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, OwnPtrWillBeMember<In
validationList> > PendingInvalidationMap; |
| 87 | 86 |
| 88 InvalidationList& ensurePendingInvalidationList(Element&); | 87 InvalidationList& ensurePendingInvalidationList(Element&); |
| 89 | 88 |
| 90 PendingInvalidationMap m_pendingInvalidationMap; | 89 PendingInvalidationMap m_pendingInvalidationMap; |
| 91 RecursionData m_recursionData; | |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 } // namespace blink | 92 } // namespace blink |
| 95 | 93 |
| 96 #endif // StyleInvalidator_h | 94 #endif // StyleInvalidator_h |
| OLD | NEW |