Chromium Code Reviews| Index: Source/core/css/invalidation/StyleInvalidator.h |
| diff --git a/Source/core/css/invalidation/StyleInvalidator.h b/Source/core/css/invalidation/StyleInvalidator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e8df4113649a50440c3a6d99e5e7f6ee74bc0b0a |
| --- /dev/null |
| +++ b/Source/core/css/invalidation/StyleInvalidator.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef StyleInvalidator_h |
| +#define StyleInvalidator_h |
| + |
| +#include "core/css/RuleFeature.h" |
| +#include "heap/Heap.h" |
| + |
| +namespace WebCore { |
| + |
| +class StyleInvalidator { |
| + STACK_ALLOCATED(); |
| +public: |
| + StyleInvalidator(Document&); |
|
esprehn
2014/03/20 00:33:03
explicit
chrishtr
2014/03/20 03:46:33
Done.
|
| + void invalidate(); |
| + |
| +private: |
| + bool invalidate(Element&); |
| + bool invalidateChildren(Element&); |
| + |
| + bool checkInvalidationSetsAgainstElement(Element&); |
| + |
| + struct RecursionData { |
| + RecursionData() : m_foundInvalidationSet(false) { } |
| + void pushInvalidationSet(const DescendantInvalidationSet&); |
| + bool matchesCurrentInvalidationSets(Element&); |
| + bool foundInvalidationSet() { return m_foundInvalidationSet; } |
| + |
| + Vector<AtomicString> m_invalidationClasses; |
| + bool m_foundInvalidationSet; |
| + }; |
| + |
| + class RecursionCheckpoint { |
| + public: |
| + RecursionCheckpoint(RecursionData* data) |
| + : m_prevClassLength(data->m_invalidationClasses.size()), |
| + m_prevFoundInvalidationSet(data->m_foundInvalidationSet), |
| + m_data(data) |
| + { } |
| + ~RecursionCheckpoint() |
| + { |
| + m_data->m_invalidationClasses.remove(m_prevClassLength, m_data->m_invalidationClasses.size() - m_prevClassLength); |
| + m_data->m_foundInvalidationSet = m_prevFoundInvalidationSet; |
| + } |
| + |
| + private: |
| + int m_prevClassLength; |
| + bool m_prevFoundInvalidationSet; |
| + RecursionData* m_data; |
| + }; |
| + |
| + Document& m_document; |
| + RuleFeatureSet::PendingInvalidationMap& m_pendingInvalidationMap; |
| + RecursionData m_recursionData; |
| +}; |
| + |
| +} // namespace WebCore |
| + |
| +#endif // StyleInvalidator_h |