OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef StyleInvalidator_h |
| 6 #define StyleInvalidator_h |
| 7 |
| 8 #include "core/css/RuleFeature.h" |
| 9 #include "heap/Heap.h" |
| 10 |
| 11 namespace WebCore { |
| 12 |
| 13 class StyleInvalidator { |
| 14 STACK_ALLOCATED(); |
| 15 public: |
| 16 explicit StyleInvalidator(Document&); |
| 17 void invalidate(); |
| 18 |
| 19 private: |
| 20 bool invalidate(Element&); |
| 21 bool invalidateChildren(Element&); |
| 22 |
| 23 bool checkInvalidationSetsAgainstElement(Element&); |
| 24 |
| 25 struct RecursionData { |
| 26 RecursionData() : m_foundInvalidationSet(false) { } |
| 27 void pushInvalidationSet(const DescendantInvalidationSet&); |
| 28 bool matchesCurrentInvalidationSets(Element&); |
| 29 bool foundInvalidationSet() { return m_foundInvalidationSet; } |
| 30 |
| 31 Vector<AtomicString> m_invalidationClasses; |
| 32 bool m_foundInvalidationSet; |
| 33 }; |
| 34 |
| 35 class RecursionCheckpoint { |
| 36 public: |
| 37 RecursionCheckpoint(RecursionData* data) |
| 38 : m_prevClassLength(data->m_invalidationClasses.size()), |
| 39 m_prevFoundInvalidationSet(data->m_foundInvalidationSet), |
| 40 m_data(data) |
| 41 { } |
| 42 ~RecursionCheckpoint() |
| 43 { |
| 44 m_data->m_invalidationClasses.remove(m_prevClassLength, m_data->m_in
validationClasses.size() - m_prevClassLength); |
| 45 m_data->m_foundInvalidationSet = m_prevFoundInvalidationSet; |
| 46 } |
| 47 |
| 48 private: |
| 49 int m_prevClassLength; |
| 50 bool m_prevFoundInvalidationSet; |
| 51 RecursionData* m_data; |
| 52 }; |
| 53 |
| 54 Document& m_document; |
| 55 RuleFeatureSet::PendingInvalidationMap& m_pendingInvalidationMap; |
| 56 RecursionData m_recursionData; |
| 57 }; |
| 58 |
| 59 } // namespace WebCore |
| 60 |
| 61 #endif // StyleInvalidator_h |
OLD | NEW |