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

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

Issue 204873003: Factor the style invalidation tree walk out of RuleFeatureSet, and make it generic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move code around. Created 6 years, 9 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
OLDNEW
(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 StyleInvalidationTreeWalk_h
6 #define StyleInvalidationTreeWalk_h
7
8 #include "core/css/RuleFeature.h"
9
10 namespace WebCore {
11
12 class StyleInvalidationTreeWalk {
13 public:
14 static void computeStyleInvalidation(Document&, RuleFeatureSet*);
esprehn 2014/03/19 22:09:04 No static, this should work like the ChildInsertio
chrishtr 2014/03/19 22:49:39 The point of the static is to enforce invalidator
esprehn 2014/03/19 23:04:14 That's not the correct way to solve this. We have
chrishtr 2014/03/20 00:08:35 Matching style is good. Done.
15
16 private:
17 StyleInvalidationTreeWalk(const RuleFeatureSet*);
18
19 bool invalidateStyle(Element*);
20 bool invalidateStyleForChildren(Element*);
21
22 bool checkInvalidationSetsAgainstElement(Element*);
esprehn 2014/03/19 22:09:04 These should all be references.
chrishtr 2014/03/19 22:49:39 Done.
23
24 class RecursionCheckpoint;
25 class RecursionData {
26 public:
27 RecursionData() : m_foundInvalidationSet(false) { }
28 void pushInvalidationSet(const DescendantInvalidationSet&);
29 bool matchesCurrentInvalidationSets(Element*);
30 bool foundInvalidationSet() { return m_foundInvalidationSet; }
31
32 private:
33 Vector<AtomicString> m_invalidationClasses;
34 bool m_foundInvalidationSet;
35 friend class RecursionCheckpoint;
esprehn 2014/03/19 22:09:04 No friends please.
chrishtr 2014/03/19 22:49:39 Done.
36 };
37
38 class RecursionCheckpoint {
39 public:
40 RecursionCheckpoint(RecursionData* data)
41 : m_prevClassLength(data->m_invalidationClasses.size()),
42 m_prevFoundInvalidationSet(data->m_foundInvalidationSet),
43 m_data(data)
44 { }
45 ~RecursionCheckpoint()
46 {
47 m_data->m_invalidationClasses.remove(m_prevClassLength, m_data->m_in validationClasses.size() - m_prevClassLength);
48 m_data->m_foundInvalidationSet = m_prevFoundInvalidationSet;
49 }
50
51 private:
52 int m_prevClassLength;
53 bool m_prevFoundInvalidationSet;
54 RecursionData* m_data;
55 };
56
57 const RuleFeatureSet* m_featureSet;
58 RecursionData m_recursionData;
59 };
60
61 } // namespace WebCore
62
63 #endif // StyleInvalidationTreeWalk_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698