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

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

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 "core/CoreExport.h"
9 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/geometry/LayoutRect.h" 10 #include "platform/geometry/LayoutRect.h"
9 #include "platform/transforms/AffineTransform.h" 11 #include "platform/transforms/AffineTransform.h"
10 #include "wtf/Allocator.h" 12 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
12 14
13 namespace blink { 15 namespace blink {
14 16
15 class LayoutBoxModelObject; 17 class LayoutBoxModelObject;
16 class LayoutObject; 18 class LayoutObject;
17 class LayoutSVGModelObject; 19 class LayoutSVGModelObject;
18 class LayoutView; 20 class LayoutView;
19 class PaintLayer; 21 class PaintLayer;
20 22
21 // PaintInvalidationState is an optimization used during the paint 23 // PaintInvalidationState is an optimization used during the paint
22 // invalidation phase. 24 // invalidation phase.
23 // 25 //
24 // This class is extremely close to LayoutState so see the documentation 26 // This class is extremely close to LayoutState so see the documentation
25 // of LayoutState for the class existence and performance benefits. 27 // of LayoutState for the class existence and performance benefits.
26 // 28 //
27 // The main difference with LayoutState is that it was customized for the 29 // The main difference with LayoutState is that it was customized for the
28 // needs of the paint invalidation systems (keeping visual rectangles 30 // needs of the paint invalidation systems (keeping visual rectangles
29 // instead of layout specific information). 31 // instead of layout specific information).
30 class PaintInvalidationState { 32 class CORE_EXPORT PaintInvalidationState {
31 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 33 ALLOW_ONLY_INLINE_ALLOCATION();
32 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); 34 WTF_MAKE_NONCOPYABLE(PaintInvalidationState);
33 public: 35 public:
34 PaintInvalidationState(PaintInvalidationState& next, LayoutBoxModelObject& l ayoutObject, const LayoutBoxModelObject& paintInvalidationContainer); 36 PaintInvalidationState(PaintInvalidationState& next, const LayoutBoxModelObj ect& layoutObject, const LayoutBoxModelObject& paintInvalidationContainer);
35 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj ect& layoutObject); 37 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj ect& layoutObject);
36 38
37 PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations) 39 PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations)
38 : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, n ullptr) { } 40 : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, n ullptr) { }
39 PaintInvalidationState(const LayoutView& layoutView, PaintInvalidationState& ownerPaintInvalidationState) 41 PaintInvalidationState(const LayoutView& layoutView, PaintInvalidationState& ownerPaintInvalidationState)
40 : PaintInvalidationState(layoutView, ownerPaintInvalidationState.m_pendi ngDelayedPaintInvalidations, &ownerPaintInvalidationState) { } 42 : PaintInvalidationState(layoutView, *ownerPaintInvalidationState.m_pend ingDelayedPaintInvalidations, &ownerPaintInvalidationState) { }
43
44 // For slimming paint v2.
45 enum PaintInvalidationStateFlags {
46 HasClip = 1 << 0,
47 HasNonIdentityAndNonTranslateTransform = 1 << 1,
48 };
49 PaintInvalidationState(const LayoutBoxModelObject& paintingContainer, const LayoutRect& clipRect, unsigned /* PaintInvalidationStateFlags */);
50
51 // When PaintInvalidationState is created, m_paintOffset stores the offset o f the paintingContainer in
52 // its paintInvalidationContainer. LayoutObject::invalidatePaintIfNeededForS ynchronizedPainting() will
53 // set paint offset to the LayoutObject's paint offset in paintInvalidationC ontainer temporarily.
54 void setPaintOffset(const LayoutSize& paintOffset)
55 {
56 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled( ));
57 m_paintOffset = paintOffset;
58 }
59 void setCachedOffsetsEnabled(bool b)
60 {
61 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled( ));
62 m_cachedOffsetsEnabled = b;
63 }
41 64
42 const LayoutRect& clipRect() const { return m_clipRect; } 65 const LayoutRect& clipRect() const { return m_clipRect; }
43 const LayoutSize& paintOffset() const { return m_paintOffset; } 66 const LayoutSize& paintOffset() const { return m_paintOffset; }
44 const AffineTransform& svgTransform() const { return m_svgTransform; } 67 const AffineTransform& svgTransform() const { return m_svgTransform; }
45 68
46 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } 69 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; }
47 bool isClipped() const { return m_clipped; } 70 bool isClipped() const { return m_clipped; }
48 71
49 bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtr eeInvalidationWithinContainer; } 72 bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtr eeInvalidationWithinContainer; }
50 void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidat ionWithinContainer = true; } 73 void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidat ionWithinContainer = true; }
51 74
52 bool forcedSubtreeInvalidationRectUpdateWithinContainer() const { return m_f orcedSubtreeInvalidationRectUpdateWithinContainer; } 75 bool forcedSubtreeInvalidationRectUpdateWithinContainer() const { return m_f orcedSubtreeInvalidationRectUpdateWithinContainer; }
53 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationRectUpdateWithinContainer = true; } 76 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationRectUpdateWithinContainer = true; }
54 77
55 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa intInvalidationContainer; } 78 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa intInvalidationContainer; }
56 79
57 bool canMapToContainer(const LayoutBoxModelObject* container) const 80 bool canMapToContainer(const LayoutBoxModelObject* container) const
58 { 81 {
59 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai ner; 82 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai ner;
60 } 83 }
61 84
62 // Records |obj| as needing paint invalidation on the next frame. See the de finition of PaintInvalidationDelayedFull for more details. 85 // 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); } 86 void pushDelayedPaintInvalidationTarget(LayoutObject& obj)
64 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { return m_p endingDelayedPaintInvalidations; } 87 {
88 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_pendingDel ayedPaintInvalidations);
89 m_pendingDelayedPaintInvalidations->append(&obj);
90 }
91 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets()
92 {
93 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_pendingDel ayedPaintInvalidations);
94 return *m_pendingDelayedPaintInvalidations;
95 }
65 96
66 // Disable view clipping and scroll offset adjustment for paint invalidation of FrameView scrollbars. 97 // Disable view clipping and scroll offset adjustment for paint invalidation of FrameView scrollbars.
67 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches. 98 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches.
68 bool viewClippingAndScrollOffsetDisabled() const { return m_viewClippingAndS crollOffsetDisabled; } 99 bool viewClippingAndScrollOffsetDisabled() const { return m_viewClippingAndS crollOffsetDisabled; }
69 void setViewClippingAndScrollOffsetDisabled(bool b) { m_viewClippingAndScrol lOffsetDisabled = b; } 100 void setViewClippingAndScrollOffsetDisabled(bool b) { m_viewClippingAndScrol lOffsetDisabled = b; }
70 101
71 PaintLayer& enclosingSelfPaintingLayer(const LayoutObject&) const; 102 PaintLayer& enclosingSelfPaintingLayer(const LayoutObject&) const;
72 103
73 private: 104 private:
74 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela yedPaintInvalidations, PaintInvalidationState* ownerPaintInvalidationState); 105 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela yedPaintInvalidations, PaintInvalidationState* ownerPaintInvalidationState);
(...skipping 17 matching lines...) Expand all
92 // The current paint invalidation container. 123 // The current paint invalidation container.
93 // 124 //
94 // It is the enclosing composited object. 125 // It is the enclosing composited object.
95 const LayoutBoxModelObject& m_paintInvalidationContainer; 126 const LayoutBoxModelObject& m_paintInvalidationContainer;
96 127
97 // Transform from the initial viewport coordinate system of an outermost 128 // Transform from the initial viewport coordinate system of an outermost
98 // SVG root to the userspace _before_ the relevant element. Combining this 129 // SVG root to the userspace _before_ the relevant element. Combining this
99 // with |m_paintOffset| yields the "final" offset. 130 // with |m_paintOffset| yields the "final" offset.
100 AffineTransform m_svgTransform; 131 AffineTransform m_svgTransform;
101 132
102 Vector<LayoutObject*>& m_pendingDelayedPaintInvalidations; 133 Vector<LayoutObject*>* m_pendingDelayedPaintInvalidations;
103 134
104 PaintLayer& m_enclosingSelfPaintingLayer; 135 PaintLayer& m_enclosingSelfPaintingLayer;
105 }; 136 };
106 137
107 } // namespace blink 138 } // namespace blink
108 139
109 #endif // PaintInvalidationState_h 140 #endif // PaintInvalidationState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698