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

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.h

Issue 1774193002: New paint invalidation using paint property tree walk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 PaintInvalidationState_h 5 #ifndef PaintInvalidationState_h
6 #define PaintInvalidationState_h 6 #define PaintInvalidationState_h
7 7
8 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/geometry/LayoutRect.h" 9 #include "platform/geometry/LayoutRect.h"
9 #include "platform/transforms/AffineTransform.h" 10 #include "platform/transforms/AffineTransform.h"
10 #include "wtf/Allocator.h" 11 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class LayoutBoxModelObject; 16 class LayoutBoxModelObject;
16 class LayoutObject; 17 class LayoutObject;
17 class LayoutSVGModelObject; 18 class LayoutSVGModelObject;
18 class LayoutView; 19 class LayoutView;
19 class PaintLayer; 20 class PaintLayer;
20 21
21 // PaintInvalidationState is an optimization used during the paint 22 // PaintInvalidationState is an optimization used during the paint
22 // invalidation phase. 23 // invalidation phase.
23 // 24 //
24 // This class is extremely close to LayoutState so see the documentation 25 // This class is extremely close to LayoutState so see the documentation
25 // of LayoutState for the class existence and performance benefits. 26 // of LayoutState for the class existence and performance benefits.
26 // 27 //
27 // The main difference with LayoutState is that it was customized for the 28 // The main difference with LayoutState is that it was customized for the
28 // needs of the paint invalidation systems (keeping visual rectangles 29 // needs of the paint invalidation systems (keeping visual rectangles
29 // instead of layout specific information). 30 // instead of layout specific information).
30 class PaintInvalidationState { 31 class PaintInvalidationState {
31 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 32 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
32 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); 33 WTF_MAKE_NONCOPYABLE(PaintInvalidationState);
33 public: 34 public:
34 PaintInvalidationState(PaintInvalidationState& next, LayoutBoxModelObject& l ayoutObject, const LayoutBoxModelObject& paintInvalidationContainer); 35 // For RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled.
36 PaintInvalidationState(const PaintInvalidationState* parent, const LayoutObj ect&, const LayoutBoxModelObject& paintInvalidationContainer, const LayoutPoint& paintOffset);
chrishtr 2016/03/11 21:30:00 Would it be better/possible to just fold the neces
Xianzhu 2016/03/11 22:01:47 I believe it would be better, but it would need a
chrishtr 2016/03/11 22:08:18 Couldn't you do it incrementally by creating Paint
37
38 PaintInvalidationState(PaintInvalidationState& next, const LayoutBoxModelObj ect& layoutObject, const LayoutBoxModelObject& paintInvalidationContainer);
35 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj ect& layoutObject); 39 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj ect& layoutObject);
36 40
37 PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations) 41 PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations)
38 : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, n ullptr) { } 42 : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, n ullptr) { }
39 PaintInvalidationState(const LayoutView& layoutView, PaintInvalidationState& ownerPaintInvalidationState) 43 PaintInvalidationState(const LayoutView& layoutView, PaintInvalidationState& ownerPaintInvalidationState)
40 : PaintInvalidationState(layoutView, ownerPaintInvalidationState.m_pendi ngDelayedPaintInvalidations, &ownerPaintInvalidationState) { } 44 : PaintInvalidationState(layoutView, *ownerPaintInvalidationState.m_pend ingDelayedPaintInvalidations, &ownerPaintInvalidationState) { }
41 45
42 const LayoutRect& clipRect() const { return m_clipRect; } 46 const LayoutRect& clipRect() const { return m_clipRect; }
43 const LayoutSize& paintOffset() const { return m_paintOffset; } 47 const LayoutSize& paintOffset() const { return m_paintOffset; }
44 const AffineTransform& svgTransform() const { return m_svgTransform; } 48 const AffineTransform& svgTransform() const { return m_svgTransform; }
45 49
46 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } 50 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; }
47 bool isClipped() const { return m_clipped; } 51 bool isClipped() const { return m_clipped; }
48 52
49 bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtr eeInvalidationWithinContainer; } 53 bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtr eeInvalidationWithinContainer; }
50 void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidat ionWithinContainer = true; } 54 void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidat ionWithinContainer = true; }
51 55
52 bool forcedSubtreeInvalidationRectUpdateWithinContainer() const { return m_f orcedSubtreeInvalidationRectUpdateWithinContainer; } 56 bool forcedSubtreeInvalidationRectUpdateWithinContainer() const { return m_f orcedSubtreeInvalidationRectUpdateWithinContainer; }
53 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationRectUpdateWithinContainer = true; } 57 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationRectUpdateWithinContainer = true; }
54 58
55 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa intInvalidationContainer; } 59 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa intInvalidationContainer; }
56 60
57 bool canMapToContainer(const LayoutBoxModelObject* container) const 61 bool canMapToContainer(const LayoutBoxModelObject* container) const
58 { 62 {
59 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai ner; 63 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai ner;
60 } 64 }
61 65
62 // Records |obj| as needing paint invalidation on the next frame. See the de finition of PaintInvalidationDelayedFull for more details. 66 // Records |obj| as needing paint invalidation on the next frame. See the de finition of PaintInvalidationDelayedFull for more details.
63 void pushDelayedPaintInvalidationTarget(LayoutObject& obj) { m_pendingDelaye dPaintInvalidations.append(&obj); } 67 void pushDelayedPaintInvalidationTarget(LayoutObject& obj) { ASSERT(!Runtime EnabledFeatures::slimmingPaintInvalidationEnabled()); m_pendingDelayedPaintInval idations->append(&obj); }
64 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { return m_p endingDelayedPaintInvalidations; } 68 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { ASSERT(!Ru ntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); return *m_pendingDela yedPaintInvalidations; }
65 69
66 // Disable view clipping and scroll offset adjustment for paint invalidation of FrameView scrollbars. 70 // Disable view clipping and scroll offset adjustment for paint invalidation of FrameView scrollbars.
67 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches. 71 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches.
68 bool viewClippingAndScrollOffsetDisabled() const { return m_viewClippingAndS crollOffsetDisabled; } 72 bool viewClippingAndScrollOffsetDisabled() const { return m_viewClippingAndS crollOffsetDisabled; }
69 void setViewClippingAndScrollOffsetDisabled(bool b) { m_viewClippingAndScrol lOffsetDisabled = b; } 73 void setViewClippingAndScrollOffsetDisabled(bool b) { m_viewClippingAndScrol lOffsetDisabled = b; }
70 74
71 PaintLayer& enclosingSelfPaintingLayer(const LayoutObject&) const; 75 PaintLayer& enclosingSelfPaintingLayer(const LayoutObject&) const;
72 76
73 private: 77 private:
74 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela yedPaintInvalidations, PaintInvalidationState* ownerPaintInvalidationState); 78 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela yedPaintInvalidations, PaintInvalidationState* ownerPaintInvalidationState);
(...skipping 17 matching lines...) Expand all
92 // The current paint invalidation container. 96 // The current paint invalidation container.
93 // 97 //
94 // It is the enclosing composited object. 98 // It is the enclosing composited object.
95 const LayoutBoxModelObject& m_paintInvalidationContainer; 99 const LayoutBoxModelObject& m_paintInvalidationContainer;
96 100
97 // Transform from the initial viewport coordinate system of an outermost 101 // Transform from the initial viewport coordinate system of an outermost
98 // SVG root to the userspace _before_ the relevant element. Combining this 102 // SVG root to the userspace _before_ the relevant element. Combining this
99 // with |m_paintOffset| yields the "final" offset. 103 // with |m_paintOffset| yields the "final" offset.
100 AffineTransform m_svgTransform; 104 AffineTransform m_svgTransform;
101 105
102 Vector<LayoutObject*>& m_pendingDelayedPaintInvalidations; 106 Vector<LayoutObject*>* m_pendingDelayedPaintInvalidations;
103 107
104 PaintLayer& m_enclosingSelfPaintingLayer; 108 PaintLayer& m_enclosingSelfPaintingLayer;
105 }; 109 };
106 110
107 } // namespace blink 111 } // namespace blink
108 112
109 #endif // PaintInvalidationState_h 113 #endif // PaintInvalidationState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698