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

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

Issue 1368163002: Workaround rect-based paint invalidation on ancestor clip change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 "config.h" 5 #include "config.h"
6 #include "core/layout/PaintInvalidationState.h" 6 #include "core/layout/PaintInvalidationState.h"
7 7
8 #include "core/layout/LayoutInline.h" 8 #include "core/layout/LayoutInline.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/svg/LayoutSVGModelObject.h" 10 #include "core/layout/svg/LayoutSVGModelObject.h"
11 #include "core/layout/svg/LayoutSVGRoot.h" 11 #include "core/layout/svg/LayoutSVGRoot.h"
12 #include "core/paint/DeprecatedPaintLayer.h" 12 #include "core/paint/DeprecatedPaintLayer.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow nerPaintInvalidationState) 16 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow nerPaintInvalidationState)
17 : m_clipped(false) 17 : m_clipped(false)
18 , m_cachedOffsetsEnabled(true) 18 , m_cachedOffsetsEnabled(true)
19 , m_forcedSubtreeInvalidationWithinContainer(false) 19 , m_forcedSubtreeInvalidationWithinContainer(false)
20 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false)
20 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation()) 21 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation())
21 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) 22 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations)
22 { 23 {
23 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer; 24 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer;
24 if (!establishesPaintInvalidationContainer) { 25 if (!establishesPaintInvalidationContainer) {
25 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled) 26 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled)
26 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { 27 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) {
27 m_cachedOffsetsEnabled = false; 28 m_cachedOffsetsEnabled = false;
28 return; 29 return;
29 } 30 }
30 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer) 31 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer)
31 m_forcedSubtreeInvalidationWithinContainer = true; 32 m_forcedSubtreeInvalidationWithinContainer = true;
32 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries); 33 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries);
33 m_paintOffset = LayoutSize(point.x(), point.y()); 34 m_paintOffset = LayoutSize(point.x(), point.y());
34 } 35 }
35 m_clipRect = layoutView.viewRect(); 36 m_clipRect = layoutView.viewRect();
36 m_clipRect.move(m_paintOffset); 37 m_clipRect.move(m_paintOffset);
37 m_clipped = true; 38 m_clipped = true;
38 } 39 }
39 40
40 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer) 41 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer)
41 : m_clipped(false) 42 : m_clipped(false)
42 , m_cachedOffsetsEnabled(true) 43 , m_cachedOffsetsEnabled(true)
43 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 44 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
45 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
44 , m_paintInvalidationContainer(paintInvalidationContainer) 46 , m_paintInvalidationContainer(paintInvalidationContainer)
45 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 47 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
46 { 48 {
47 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054 49 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054
48 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer; 50 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer;
49 bool fixed = layoutObject.style()->position() == FixedPosition; 51 bool fixed = layoutObject.style()->position() == FixedPosition;
50 52
51 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled) 53 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled)
52 m_cachedOffsetsEnabled = false; 54 m_cachedOffsetsEnabled = false;
53 if (establishesPaintInvalidationContainer) { 55 if (establishesPaintInvalidationContainer) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 applyClipIfNeeded(layoutObject); 94 applyClipIfNeeded(layoutObject);
93 95
94 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 96 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
95 } 97 }
96 98
97 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject) 99 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject)
98 : m_clipped(next.m_clipped) 100 : m_clipped(next.m_clipped)
99 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) 101 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled)
100 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 102 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
103 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
101 , m_clipRect(next.m_clipRect) 104 , m_clipRect(next.m_clipRect)
102 , m_paintOffset(next.m_paintOffset) 105 , m_paintOffset(next.m_paintOffset)
103 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) 106 , m_paintInvalidationContainer(next.m_paintInvalidationContainer)
104 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 107 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
105 { 108 {
106 ASSERT(layoutObject != m_paintInvalidationContainer); 109 ASSERT(layoutObject != m_paintInvalidationContainer);
107 110
108 if (m_cachedOffsetsEnabled) 111 if (m_cachedOffsetsEnabled)
109 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform())); 112 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform()));
110 } 113 }
(...skipping 20 matching lines...) Expand all
131 // to be always invalidated in-time. 134 // to be always invalidated in-time.
132 if (box.usesCompositedScrolling()) 135 if (box.usesCompositedScrolling())
133 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited. 136 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited.
134 else 137 else
135 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); 138 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size()));
136 139
137 m_paintOffset -= box.scrolledContentOffset(); 140 m_paintOffset -= box.scrolledContentOffset();
138 } 141 }
139 142
140 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698