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

Side by Side Diff: Source/core/rendering/style/StyleDifference.h

Issue 361283002: StyleDifference should store property-specific difference in a bit field (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | « no previous file | 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/Assertions.h" 8 #include "wtf/Assertions.h"
9 9
10 namespace WebCore { 10 namespace WebCore {
11 11
12 class StyleDifference { 12 class StyleDifference {
13 public: 13 public:
14 StyleDifference() 14 StyleDifference()
15 : m_repaintType(NoRepaint) 15 : m_repaintType(NoRepaint)
16 , m_layoutType(NoLayout) 16 , m_layoutType(NoLayout)
17 , m_transformChanged(false) 17 , m_propertySpecificDifferences(0)
18 , m_opacityChanged(false)
19 , m_zIndexChanged(false)
20 , m_filterChanged(false)
21 , m_textOrColorChanged(false)
22 { } 18 { }
23 19
24 bool hasDifference() const { return m_repaintType || m_layoutType || m_trans formChanged || m_opacityChanged || m_zIndexChanged || m_filterChanged || m_textO rColorChanged; } 20 bool hasDifference() const { return m_repaintType || m_layoutType || m_prope rtySpecificDifferences; }
25 21
26 bool needsRepaint() const { return m_repaintType != NoRepaint; } 22 bool needsRepaint() const { return m_repaintType != NoRepaint; }
27 void clearNeedsRepaint() { m_repaintType = NoRepaint; } 23 void clearNeedsRepaint() { m_repaintType = NoRepaint; }
28 24
29 // The object just needs to be repainted. 25 // The object just needs to be repainted.
30 bool needsRepaintObject() const { return m_repaintType == RepaintObject; } 26 bool needsRepaintObject() const { return m_repaintType == RepaintObject; }
31 void setNeedsRepaintObject() 27 void setNeedsRepaintObject()
32 { 28 {
33 ASSERT(!needsRepaintLayer()); 29 ASSERT(!needsRepaintLayer());
34 m_repaintType = RepaintObject; 30 m_repaintType = RepaintObject;
(...skipping 10 matching lines...) Expand all
45 bool needsPositionedMovementLayout() const { return m_layoutType == Position edMovement; } 41 bool needsPositionedMovementLayout() const { return m_layoutType == Position edMovement; }
46 void setNeedsPositionedMovementLayout() 42 void setNeedsPositionedMovementLayout()
47 { 43 {
48 ASSERT(!needsFullLayout()); 44 ASSERT(!needsFullLayout());
49 m_layoutType = PositionedMovement; 45 m_layoutType = PositionedMovement;
50 } 46 }
51 47
52 bool needsFullLayout() const { return m_layoutType == FullLayout; } 48 bool needsFullLayout() const { return m_layoutType == FullLayout; }
53 void setNeedsFullLayout() { m_layoutType = FullLayout; } 49 void setNeedsFullLayout() { m_layoutType = FullLayout; }
54 50
55 bool transformChanged() const { return m_transformChanged; } 51 bool transformChanged() const { return m_propertySpecificDifferences & Trans formChanged; }
56 void setTransformChanged() { m_transformChanged = true; } 52 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang ed; }
57 53
58 bool opacityChanged() const { return m_opacityChanged; } 54 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity Changed; }
59 void setOpacityChanged() { m_opacityChanged = true; } 55 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged; }
60 56
61 bool zIndexChanged() const { return m_zIndexChanged; } 57 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh anged; }
62 void setZIndexChanged() { m_zIndexChanged = true; } 58 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; }
63 59
64 bool filterChanged() const { return m_filterChanged; } 60 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh anged; }
65 void setFilterChanged() { m_filterChanged = true; } 61 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; }
66 62
67 bool textOrColorChanged() const { return m_textOrColorChanged; } 63 bool textOrColorChanged() const { return m_propertySpecificDifferences & Tex tOrColorChanged; }
68 void setTextOrColorChanged() { m_textOrColorChanged = true; } 64 void setTextOrColorChanged() { m_propertySpecificDifferences |= TextOrColorC hanged; }
69 65
70 private: 66 private:
71 enum RepaintType { 67 enum RepaintType {
72 NoRepaint = 0, 68 NoRepaint = 0,
73 RepaintObject, 69 RepaintObject,
74 RepaintLayer 70 RepaintLayer
75 }; 71 };
76 unsigned m_repaintType : 2; 72 unsigned m_repaintType : 2;
77 73
78 enum LayoutType { 74 enum LayoutType {
79 NoLayout = 0, 75 NoLayout = 0,
80 PositionedMovement, 76 PositionedMovement,
81 FullLayout 77 FullLayout
82 }; 78 };
83 unsigned m_layoutType : 2; 79 unsigned m_layoutType : 2;
84 80
85 unsigned m_transformChanged : 1; 81 enum PropertyDifference {
86 unsigned m_opacityChanged : 1; 82 TransformChanged = 1 << 0,
87 unsigned m_zIndexChanged : 1; 83 OpacityChanged = 1 << 1,
88 unsigned m_filterChanged : 1; 84 ZIndexChanged = 1 << 2,
89 // The object needs to be repainted if it contains text or properties depend ent on color (e.g., border or outline). 85 FilterChanged = 1 << 3,
90 unsigned m_textOrColorChanged : 1; 86 // The object needs to be repainted if it contains text or properties de pendent on color (e.g., border or outline).
87 TextOrColorChanged = 1 << 4,
88 };
89
90 unsigned m_propertySpecificDifferences : 5;
91 }; 91 };
92 92
93 } // namespace WebCore 93 } // namespace WebCore
94 94
95 #endif // StyleDifference_h 95 #endif // StyleDifference_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698