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

Side by Side Diff: sky/engine/core/css/invalidation/StyleInvalidator.h

Issue 712173002: Remove StyleInvalidator machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 StyleInvalidator_h
6 #define StyleInvalidator_h
7
8 #include "platform/heap/Handle.h"
9 #include "wtf/HashMap.h"
10 #include "wtf/Vector.h"
11
12 namespace blink {
13
14 class DescendantInvalidationSet;
15 class Document;
16 class Element;
17 class Node;
18
19 class StyleInvalidator {
20 DISALLOW_ALLOCATION();
21 public:
22 StyleInvalidator();
23 ~StyleInvalidator();
24 void invalidate(Document&);
25 void scheduleInvalidation(PassRefPtr<DescendantInvalidationSet>, Element&);
26
27 // Clears all style invalidation state for the passed node.
28 void clearInvalidation(Node&);
29
30 void clearPendingInvalidations();
31
32 void trace(Visitor*);
33
34 private:
35 struct RecursionData {
36 RecursionData()
37 : m_invalidateCustomPseudo(false)
38 , m_wholeSubtreeInvalid(false)
39 , m_treeBoundaryCrossing(false)
40 { }
41
42 void pushInvalidationSet(const DescendantInvalidationSet&);
43 bool matchesCurrentInvalidationSets(Element&);
44 bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_in validationSets.size(); }
45
46 bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; }
47 void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; }
48
49 bool treeBoundaryCrossing() const { return m_treeBoundaryCrossing; }
50
51 typedef Vector<const DescendantInvalidationSet*, 16> InvalidationSets;
52 InvalidationSets m_invalidationSets;
53 bool m_invalidateCustomPseudo;
54 bool m_wholeSubtreeInvalid;
55 bool m_treeBoundaryCrossing;
56 };
57
58 bool invalidate(Element&, RecursionData&);
59 bool invalidateChildren(Element&, RecursionData&);
60 bool checkInvalidationSetsAgainstElement(Element&, RecursionData&);
61
62 class RecursionCheckpoint {
63 public:
64 RecursionCheckpoint(RecursionData* data)
65 : m_prevInvalidationSetsSize(data->m_invalidationSets.size())
66 , m_prevInvalidateCustomPseudo(data->m_invalidateCustomPseudo)
67 , m_prevWholeSubtreeInvalid(data->m_wholeSubtreeInvalid)
68 , m_treeBoundaryCrossing(data->m_treeBoundaryCrossing)
69 , m_data(data)
70 { }
71 ~RecursionCheckpoint()
72 {
73 m_data->m_invalidationSets.remove(m_prevInvalidationSetsSize, m_data ->m_invalidationSets.size() - m_prevInvalidationSetsSize);
74 m_data->m_invalidateCustomPseudo = m_prevInvalidateCustomPseudo;
75 m_data->m_wholeSubtreeInvalid = m_prevWholeSubtreeInvalid;
76 m_data->m_treeBoundaryCrossing = m_treeBoundaryCrossing;
77 }
78
79 private:
80 int m_prevInvalidationSetsSize;
81 bool m_prevInvalidateCustomPseudo;
82 bool m_prevWholeSubtreeInvalid;
83 bool m_treeBoundaryCrossing;
84 RecursionData* m_data;
85 };
86
87 typedef Vector<RefPtr<DescendantInvalidationSet> > InvalidationList;
88 typedef HashMap<RawPtr<Element>, OwnPtr<InvalidationList> > PendingInvalidat ionMap;
89
90 InvalidationList& ensurePendingInvalidationList(Element&);
91
92 PendingInvalidationMap m_pendingInvalidationMap;
93 };
94
95 } // namespace blink
96
97 #endif // StyleInvalidator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698