Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: Source/core/css/invalidation/StyleInvalidator.h

Issue 217713002: Refactor StyleInvalidator to encapsulate all style invalidation state. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tweak. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | Source/core/css/invalidation/StyleInvalidator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/RuleFeature.h"
9 #include "heap/Heap.h" 8 #include "heap/Heap.h"
10 9
11 namespace WebCore { 10 namespace WebCore {
12 11
12 class DescendantInvalidationSet;
13 class Document;
14 class Element;
15
13 class StyleInvalidator { 16 class StyleInvalidator {
14 STACK_ALLOCATED();
15 public: 17 public:
16 explicit StyleInvalidator(Document&); 18 explicit StyleInvalidator();
esprehn 2014/03/31 19:45:33 You don't need explicit since this doesn't take an
chrishtr 2014/03/31 20:07:37 Done.
17 void invalidate(); 19 void invalidate(Document&);
20 void scheduleInvalidation(PassRefPtr<DescendantInvalidationSet>, Element&);
21
22 // Clears all style invalidation state for the passed node.
23 void clearInvalidation(Node&);
24
25 void clearPendingInvalidations();
18 26
19 private: 27 private:
20 bool invalidate(Element&); 28 bool invalidate(Element&);
21 bool invalidateChildren(Element&); 29 bool invalidateChildren(Element&);
22 30
23 bool checkInvalidationSetsAgainstElement(Element&); 31 bool checkInvalidationSetsAgainstElement(Element&);
24 32
25 struct RecursionData { 33 struct RecursionData {
26 RecursionData() : m_foundInvalidationSet(false) { } 34 RecursionData() : m_foundInvalidationSet(false) { }
27 void pushInvalidationSet(const DescendantInvalidationSet&); 35 void pushInvalidationSet(const DescendantInvalidationSet&);
(...skipping 20 matching lines...) Expand all
48 m_data->m_foundInvalidationSet = m_prevFoundInvalidationSet; 56 m_data->m_foundInvalidationSet = m_prevFoundInvalidationSet;
49 } 57 }
50 58
51 private: 59 private:
52 int m_prevClassLength; 60 int m_prevClassLength;
53 int m_prevAttributeLength; 61 int m_prevAttributeLength;
54 bool m_prevFoundInvalidationSet; 62 bool m_prevFoundInvalidationSet;
55 RecursionData* m_data; 63 RecursionData* m_data;
56 }; 64 };
57 65
58 Document& m_document; 66 typedef Vector<RefPtr<DescendantInvalidationSet> > InvalidationList;
59 RuleFeatureSet::PendingInvalidationMap& m_pendingInvalidationMap; 67 typedef HashMap<Element*, OwnPtr<InvalidationList> > PendingInvalidationMap;
68
69 InvalidationList& ensurePendingInvalidationList(Element&);
70
71 PendingInvalidationMap m_pendingInvalidationMap;
60 RecursionData m_recursionData; 72 RecursionData m_recursionData;
61 }; 73 };
62 74
63 } // namespace WebCore 75 } // namespace WebCore
64 76
65 #endif // StyleInvalidator_h 77 #endif // StyleInvalidator_h
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | Source/core/css/invalidation/StyleInvalidator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698