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

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

Issue 1584493002: Skip PaintPhaseDescendantOutlinesOnly if no descendent outlines in the layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix multicol span issue Created 4 years, 11 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 #include "core/layout/PaintInvalidationState.h" 5 #include "core/layout/PaintInvalidationState.h"
6 6
7 #include "core/layout/LayoutInline.h" 7 #include "core/layout/LayoutInline.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/layout/svg/LayoutSVGModelObject.h" 9 #include "core/layout/svg/LayoutSVGModelObject.h"
10 #include "core/layout/svg/LayoutSVGRoot.h" 10 #include "core/layout/svg/LayoutSVGRoot.h"
11 #include "core/paint/PaintLayer.h" 11 #include "core/paint/PaintLayer.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow nerPaintInvalidationState) 15 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow nerPaintInvalidationState)
16 : m_clipped(false) 16 : m_clipped(false)
17 , m_cachedOffsetsEnabled(true) 17 , m_cachedOffsetsEnabled(true)
18 , m_forcedSubtreeInvalidationWithinContainer(false) 18 , m_forcedSubtreeInvalidationWithinContainer(false)
19 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false) 19 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false)
20 , m_viewClippingAndScrollOffsetDisabled(false) 20 , m_viewClippingAndScrollOffsetDisabled(false)
21 , m_paintInvalidationContainer(layoutView.containerForPaintInvalidation()) 21 , m_paintInvalidationContainer(layoutView.containerForPaintInvalidation())
22 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) 22 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations)
23 , m_enclosingLayer(*layoutView.layer()) 23 , m_enclosingSelfPaintingLayer(*layoutView.layer())
24 { 24 {
25 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer; 25 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer;
26 if (!establishesPaintInvalidationContainer) { 26 if (!establishesPaintInvalidationContainer) {
27 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled) 27 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled)
28 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { 28 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) {
29 m_cachedOffsetsEnabled = false; 29 m_cachedOffsetsEnabled = false;
30 return; 30 return;
31 } 31 }
32 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer) 32 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer)
33 m_forcedSubtreeInvalidationWithinContainer = true; 33 m_forcedSubtreeInvalidationWithinContainer = true;
34 FloatPoint point = layoutView.localToAncestorPoint(FloatPoint(), &m_pain tInvalidationContainer, TraverseDocumentBoundaries); 34 FloatPoint point = layoutView.localToAncestorPoint(FloatPoint(), &m_pain tInvalidationContainer, TraverseDocumentBoundaries);
35 m_paintOffset = LayoutSize(point.x(), point.y()); 35 m_paintOffset = LayoutSize(point.x(), point.y());
36 } 36 }
37 m_clipRect = layoutView.viewRect(); 37 m_clipRect = layoutView.viewRect();
38 m_clipRect.move(m_paintOffset); 38 m_clipRect.move(m_paintOffset);
39 m_clipped = true; 39 m_clipped = true;
40 } 40 }
41 41
42 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer) 42 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer)
43 : m_clipped(false) 43 : m_clipped(false)
44 , m_cachedOffsetsEnabled(true) 44 , m_cachedOffsetsEnabled(true)
45 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 45 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
46 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer) 46 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
47 , m_viewClippingAndScrollOffsetDisabled(false) 47 , m_viewClippingAndScrollOffsetDisabled(false)
48 , m_paintInvalidationContainer(paintInvalidationContainer) 48 , m_paintInvalidationContainer(paintInvalidationContainer)
49 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 49 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
50 , m_enclosingLayer(next.enclosingLayer(layoutObject)) 50 , m_enclosingSelfPaintingLayer(next.enclosingSelfPaintingLayer(layoutObject) )
51 { 51 {
52 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054 52 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054
53 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer; 53 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer;
54 bool fixed = layoutObject.style()->position() == FixedPosition; 54 bool fixed = layoutObject.style()->position() == FixedPosition;
55 55
56 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled) 56 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled)
57 m_cachedOffsetsEnabled = false; 57 m_cachedOffsetsEnabled = false;
58 if (establishesPaintInvalidationContainer) { 58 if (establishesPaintInvalidationContainer) {
59 // When we hit a new paint invalidation container, we don't need to 59 // When we hit a new paint invalidation container, we don't need to
60 // continue forcing a check for paint invalidation, since we're 60 // continue forcing a check for paint invalidation, since we're
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject) 102 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject)
103 : m_clipped(next.m_clipped) 103 : m_clipped(next.m_clipped)
104 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) 104 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled)
105 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 105 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
106 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer) 106 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
107 , m_viewClippingAndScrollOffsetDisabled(false) 107 , m_viewClippingAndScrollOffsetDisabled(false)
108 , m_clipRect(next.m_clipRect) 108 , m_clipRect(next.m_clipRect)
109 , m_paintOffset(next.m_paintOffset) 109 , m_paintOffset(next.m_paintOffset)
110 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) 110 , m_paintInvalidationContainer(next.m_paintInvalidationContainer)
111 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 111 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
112 , m_enclosingLayer(next.enclosingLayer(layoutObject)) 112 , m_enclosingSelfPaintingLayer(next.enclosingSelfPaintingLayer(layoutObject) )
113 { 113 {
114 ASSERT(layoutObject != m_paintInvalidationContainer); 114 ASSERT(layoutObject != m_paintInvalidationContainer);
115 115
116 if (m_cachedOffsetsEnabled) 116 if (m_cachedOffsetsEnabled)
117 m_svgTransform = AffineTransform(next.svgTransform() * layoutObject.loca lToParentTransform()); 117 m_svgTransform = AffineTransform(next.svgTransform() * layoutObject.loca lToParentTransform());
118 } 118 }
119 119
120 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize& clipSize) 120 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize& clipSize)
121 { 121 {
122 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); 122 LayoutRect clipRect(toPoint(m_paintOffset), clipSize);
(...skipping 15 matching lines...) Expand all
138 // Do not clip scroll layer contents because the compositor expects the whol e layer 138 // Do not clip scroll layer contents because the compositor expects the whol e layer
139 // to be always invalidated in-time. 139 // to be always invalidated in-time.
140 if (box.usesCompositedScrolling()) 140 if (box.usesCompositedScrolling())
141 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited. 141 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited.
142 else 142 else
143 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); 143 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size()));
144 144
145 m_paintOffset -= box.scrolledContentOffset(); 145 m_paintOffset -= box.scrolledContentOffset();
146 } 146 }
147 147
148 PaintLayer& PaintInvalidationState::enclosingLayer(const LayoutObject& layoutObj ect) const 148 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const
149 { 149 {
150 if (layoutObject.hasLayer()) 150 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer())
151 return *toLayoutBoxModelObject(layoutObject).layer(); 151 return *toLayoutBoxModelObject(layoutObject).layer();
152 152
153 // During paint invalidation, a multi-column spanner place holder invokes pa int invalidation of 153 return m_enclosingSelfPaintingLayer;
154 // its layoutObjectInFlowThread (which has a non-null spannerPlaceHolder) di rectly, skipping the
155 // parent of its layoutObjectInFlowThread which has a PaintLayer.
156 if (layoutObject.spannerPlaceholder())
157 return *layoutObject.enclosingLayer();
158
159 ASSERT(layoutObject.enclosingLayer() == &m_enclosingLayer);
160 return m_enclosingLayer;
161 } 154 }
162 155
163 } // namespace blink 156 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698