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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleDifference.h

Issue 2772353002: Revert of Add StyleDifference::needsVisualRectUpdate (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | no next file » | 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 StyleDifference_h 5 #ifndef StyleDifference_h
6 #define StyleDifference_h 6 #define StyleDifference_h
7 7
8 #include "wtf/Allocator.h" 8 #include "wtf/Allocator.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class StyleDifference { 13 class StyleDifference {
14 STACK_ALLOCATED(); 14 STACK_ALLOCATED();
15 15
16 public: 16 public:
17 enum PropertyDifference { 17 enum PropertyDifference {
18 TransformChanged = 1 << 0, 18 TransformChanged = 1 << 0,
19 OpacityChanged = 1 << 1, 19 OpacityChanged = 1 << 1,
20 ZIndexChanged = 1 << 2, 20 ZIndexChanged = 1 << 2,
21 FilterChanged = 1 << 3, 21 FilterChanged = 1 << 3,
22 BackdropFilterChanged = 1 << 4, 22 BackdropFilterChanged = 1 << 4,
23 CSSClipChanged = 1 << 5, 23 CSSClipChanged = 1 << 5,
24 // The object needs to issue paint invalidations if it is affected by text 24 // The object needs to issue paint invalidations if it is affected by text
25 // decorations or properties dependent on color (e.g., border or outline). 25 // decorations or properties dependent on color (e.g., border or outline).
26 TextDecorationOrColorChanged = 1 << 6, 26 TextDecorationOrColorChanged = 1 << 6,
27 ScrollAnchorDisablingPropertyChanged = 1 << 7,
28 // If you add a value here, be sure to update the number of bits on 27 // If you add a value here, be sure to update the number of bits on
29 // m_propertySpecificDifferences. 28 // m_propertySpecificDifferences.
30 }; 29 };
31 30
32 StyleDifference() 31 StyleDifference()
33 : m_paintInvalidationType(NoPaintInvalidation), 32 : m_paintInvalidationType(NoPaintInvalidation),
34 m_layoutType(NoLayout), 33 m_layoutType(NoLayout),
35 m_recomputeOverflow(false), 34 m_recomputeOverflow(false),
36 m_visualRectUpdate(false), 35 m_propertySpecificDifferences(0),
37 m_propertySpecificDifferences(0) {} 36 m_scrollAnchorDisablingPropertyChanged(false) {}
38 37
39 bool hasDifference() const { 38 bool hasDifference() const {
40 return m_paintInvalidationType || m_layoutType || 39 bool result = m_paintInvalidationType || m_layoutType ||
41 m_propertySpecificDifferences || m_recomputeOverflow || 40 m_propertySpecificDifferences;
42 m_visualRectUpdate; 41 // m_recomputeOverflow, m_scrollAnchorDisablingPropertyChanged and
42 // are never set without other flags set.
43 DCHECK(result ||
44 (!m_recomputeOverflow && !m_scrollAnchorDisablingPropertyChanged));
45 return result;
43 } 46 }
44 47
45 bool hasAtMostPropertySpecificDifferences( 48 bool hasAtMostPropertySpecificDifferences(
46 unsigned propertyDifferences) const { 49 unsigned propertyDifferences) const {
47 return !m_paintInvalidationType && !m_layoutType && 50 return !m_paintInvalidationType && !m_layoutType &&
48 !(m_propertySpecificDifferences & ~propertyDifferences); 51 !(m_propertySpecificDifferences & ~propertyDifferences);
49 } 52 }
50 53
51 bool needsFullPaintInvalidation() const { 54 bool needsFullPaintInvalidation() const {
52 return m_paintInvalidationType != NoPaintInvalidation; 55 return m_paintInvalidationType != NoPaintInvalidation;
(...skipping 27 matching lines...) Expand all
80 DCHECK(!needsFullLayout()); 83 DCHECK(!needsFullLayout());
81 m_layoutType = PositionedMovement; 84 m_layoutType = PositionedMovement;
82 } 85 }
83 86
84 bool needsFullLayout() const { return m_layoutType == FullLayout; } 87 bool needsFullLayout() const { return m_layoutType == FullLayout; }
85 void setNeedsFullLayout() { m_layoutType = FullLayout; } 88 void setNeedsFullLayout() { m_layoutType = FullLayout; }
86 89
87 bool needsRecomputeOverflow() const { return m_recomputeOverflow; } 90 bool needsRecomputeOverflow() const { return m_recomputeOverflow; }
88 void setNeedsRecomputeOverflow() { m_recomputeOverflow = true; } 91 void setNeedsRecomputeOverflow() { m_recomputeOverflow = true; }
89 92
90 bool needsVisualRectUpdate() const { return m_visualRectUpdate; }
91 void setNeedsVisualRectUpdate() { m_visualRectUpdate = true; }
92
93 bool transformChanged() const { 93 bool transformChanged() const {
94 return m_propertySpecificDifferences & TransformChanged; 94 return m_propertySpecificDifferences & TransformChanged;
95 } 95 }
96 void setTransformChanged() { 96 void setTransformChanged() {
97 m_propertySpecificDifferences |= TransformChanged; 97 m_propertySpecificDifferences |= TransformChanged;
98 } 98 }
99 99
100 bool opacityChanged() const { 100 bool opacityChanged() const {
101 return m_propertySpecificDifferences & OpacityChanged; 101 return m_propertySpecificDifferences & OpacityChanged;
102 } 102 }
(...skipping 22 matching lines...) Expand all
125 void setCSSClipChanged() { m_propertySpecificDifferences |= CSSClipChanged; } 125 void setCSSClipChanged() { m_propertySpecificDifferences |= CSSClipChanged; }
126 126
127 bool textDecorationOrColorChanged() const { 127 bool textDecorationOrColorChanged() const {
128 return m_propertySpecificDifferences & TextDecorationOrColorChanged; 128 return m_propertySpecificDifferences & TextDecorationOrColorChanged;
129 } 129 }
130 void setTextDecorationOrColorChanged() { 130 void setTextDecorationOrColorChanged() {
131 m_propertySpecificDifferences |= TextDecorationOrColorChanged; 131 m_propertySpecificDifferences |= TextDecorationOrColorChanged;
132 } 132 }
133 133
134 bool scrollAnchorDisablingPropertyChanged() const { 134 bool scrollAnchorDisablingPropertyChanged() const {
135 return m_propertySpecificDifferences & ScrollAnchorDisablingPropertyChanged; 135 return m_scrollAnchorDisablingPropertyChanged;
136 } 136 }
137 void setScrollAnchorDisablingPropertyChanged() { 137 void setScrollAnchorDisablingPropertyChanged() {
138 m_propertySpecificDifferences |= ScrollAnchorDisablingPropertyChanged; 138 m_scrollAnchorDisablingPropertyChanged = true;
139 } 139 }
140 140
141 private: 141 private:
142 enum PaintInvalidationType { 142 enum PaintInvalidationType {
143 NoPaintInvalidation, 143 NoPaintInvalidation,
144 PaintInvalidationObject, 144 PaintInvalidationObject,
145 PaintInvalidationSubtree, 145 PaintInvalidationSubtree,
146 }; 146 };
147 unsigned m_paintInvalidationType : 2; 147 unsigned m_paintInvalidationType : 2;
148 148
149 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; 149 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout };
150 unsigned m_layoutType : 2; 150 unsigned m_layoutType : 2;
151 unsigned m_recomputeOverflow : 1; 151 unsigned m_recomputeOverflow : 1;
152 unsigned m_visualRectUpdate : 1; 152 unsigned m_propertySpecificDifferences : 7;
153 unsigned m_propertySpecificDifferences : 8; 153 unsigned m_scrollAnchorDisablingPropertyChanged : 1;
154 }; 154 };
155 155
156 } // namespace blink 156 } // namespace blink
157 157
158 #endif // StyleDifference_h 158 #endif // StyleDifference_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698