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

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

Issue 2000053002: WIP: Reset paint invalidation at transform boundaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
11 #include "core/layout/LayoutPart.h" 11 #include "core/layout/LayoutPart.h"
12 #include "core/layout/LayoutView.h" 12 #include "core/layout/LayoutView.h"
13 #include "core/layout/svg/LayoutSVGRoot.h" 13 #include "core/layout/svg/LayoutSVGRoot.h"
14 #include "core/layout/svg/SVGLayoutSupport.h" 14 #include "core/layout/svg/SVGLayoutSupport.h"
15 #include "core/paint/PaintLayer.h" 15 #include "core/paint/PaintLayer.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 static bool supportsCachedOffsets(const LayoutObject& object) 19 static bool supportsCachedOffsets(const LayoutObject& object)
20 { 20 {
21 return !object.hasTransformRelatedProperty() 21 return !object.hasReflection()
22 && !object.hasReflection()
23 && !object.hasFilterInducingProperty() 22 && !object.hasFilterInducingProperty()
24 && !object.isLayoutFlowThread() 23 && !object.isLayoutFlowThread()
25 && !object.isLayoutMultiColumnSpannerPlaceholder() 24 && !object.isLayoutMultiColumnSpannerPlaceholder()
26 && !object.styleRef().isFlippedBlocksWritingMode() 25 && !object.styleRef().isFlippedBlocksWritingMode()
27 && !(object.isLayoutBlock() && object.isSVG()); 26 && !(object.isLayoutBlock() && object.isSVG());
28 } 27 }
29 28
30 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations) 29 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec tor<LayoutObject*>& pendingDelayedPaintInvalidations)
31 : m_currentObject(layoutView) 30 : m_currentObject(layoutView)
32 , m_forcedSubtreeInvalidationFlags(0) 31 , m_forcedSubtreeInvalidationFlags(0)
33 , m_clipped(false) 32 , m_clipped(false)
34 , m_clippedForAbsolutePosition(false) 33 , m_clippedForAbsolutePosition(false)
35 , m_cachedOffsetsEnabled(true) 34 , m_cachedOffsetsEnabled(true)
36 , m_cachedOffsetsForAbsolutePositionEnabled(true) 35 , m_cachedOffsetsForAbsolutePositionEnabled(true)
37 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation()) 36 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation())
37 , m_realPaintInvalidationContainer(m_paintInvalidationContainer)
38 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine r) 38 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine r)
39 , m_realPaintInvalidationContainerForStackedContents(m_paintInvalidationCont ainer)
39 , m_containerForAbsolutePosition(layoutView) 40 , m_containerForAbsolutePosition(layoutView)
40 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) 41 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations)
41 , m_paintingLayer(*layoutView.layer()) 42 , m_paintingLayer(*layoutView.layer())
43 , m_transformParent(nullptr)
44 , m_parentPaintInvalidationState(nullptr)
42 #if ENABLE(ASSERT) 45 #if ENABLE(ASSERT)
43 , m_didUpdateForChildren(false) 46 , m_didUpdateForChildren(false)
44 #endif 47 #endif
45 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 48 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
46 , m_canCheckFastPathSlowPathEquality(layoutView == m_paintInvalidationContai ner) 49 , m_canCheckFastPathSlowPathEquality(layoutView == m_paintInvalidationContai ner)
47 #endif 50 #endif
48 { 51 {
49 if (!supportsCachedOffsets(layoutView)) { 52 if (!supportsCachedOffsets(layoutView)) {
50 m_cachedOffsetsEnabled = false; 53 m_cachedOffsetsEnabled = false;
54 LOG(ERROR) << "set to false";
51 return; 55 return;
52 } 56 }
53 57
54 FloatPoint point = layoutView.localToAncestorPoint(FloatPoint(), m_paintInva lidationContainer, TraverseDocumentBoundaries | InputIsInFrameCoordinates); 58 FloatPoint point = layoutView.localToAncestorPoint(FloatPoint(), m_paintInva lidationContainer, TraverseDocumentBoundaries | InputIsInFrameCoordinates);
55 m_paintOffset = LayoutSize(point.x(), point.y()); 59 m_paintOffset = LayoutSize(point.x(), point.y());
56 m_paintOffsetForAbsolutePosition = m_paintOffset; 60 m_paintOffsetForAbsolutePosition = m_paintOffset;
57 } 61 }
58 62
59 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& par entState, const LayoutObject& currentObject) 63 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& par entState, const LayoutObject& currentObject)
60 : m_currentObject(currentObject) 64 : m_currentObject(currentObject)
61 , m_forcedSubtreeInvalidationFlags(parentState.m_forcedSubtreeInvalidationFl ags) 65 , m_forcedSubtreeInvalidationFlags(parentState.m_forcedSubtreeInvalidationFl ags)
62 , m_clipped(parentState.m_clipped) 66 , m_clipped(parentState.m_clipped)
63 , m_clippedForAbsolutePosition(parentState.m_clippedForAbsolutePosition) 67 , m_clippedForAbsolutePosition(parentState.m_clippedForAbsolutePosition)
64 , m_clipRect(parentState.m_clipRect) 68 , m_clipRect(parentState.m_clipRect)
65 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition) 69 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition)
66 , m_paintOffset(parentState.m_paintOffset) 70 , m_paintOffset(parentState.m_paintOffset)
67 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit ion) 71 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit ion)
68 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled) 72 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled)
69 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb solutePositionEnabled) 73 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb solutePositionEnabled)
70 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer) 74 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer)
75 , m_realPaintInvalidationContainer(parentState.m_realPaintInvalidationContai ner)
71 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida tionContainerForStackedContents) 76 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida tionContainerForStackedContents)
77 , m_realPaintInvalidationContainerForStackedContents(parentState.m_realPaint InvalidationContainerForStackedContents)
72 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj ects() ? currentObject : parentState.m_containerForAbsolutePosition) 78 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj ects() ? currentObject : parentState.m_containerForAbsolutePosition)
73 , m_svgTransform(parentState.m_svgTransform) 79 , m_svgTransform(parentState.m_svgTransform)
74 , m_pendingDelayedPaintInvalidations(parentState.pendingDelayedPaintInvalida tionTargets()) 80 , m_pendingDelayedPaintInvalidations(parentState.pendingDelayedPaintInvalida tionTargets())
75 , m_paintingLayer(currentObject.hasLayer() && toLayoutBoxModelObject(current Object).hasSelfPaintingLayer() ? *toLayoutBoxModelObject(currentObject).layer() : parentState.m_paintingLayer) 81 , m_paintingLayer(currentObject.hasLayer() && toLayoutBoxModelObject(current Object).hasSelfPaintingLayer() ? *toLayoutBoxModelObject(currentObject).layer() : parentState.m_paintingLayer)
82 , m_transformParent(parentState.m_transformParent)
83 , m_parentPaintInvalidationState(nullptr)
76 #if ENABLE(ASSERT) 84 #if ENABLE(ASSERT)
77 , m_didUpdateForChildren(false) 85 , m_didUpdateForChildren(false)
78 #endif 86 #endif
79 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 87 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
80 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE quality) 88 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE quality)
81 #endif 89 #endif
82 { 90 {
91 if (parentState.m_currentObject.styleRef().hasTransform()) {
92 m_transformParent = &parentState;
93 }
94
83 ASSERT(&m_paintingLayer == currentObject.paintingLayer()); 95 ASSERT(&m_paintingLayer == currentObject.paintingLayer());
84 96
85 if (currentObject == parentState.m_currentObject) { 97 if (currentObject == parentState.m_currentObject) {
86 // Sometimes we create a new PaintInvalidationState from parentState on the same object 98 // Sometimes we create a new PaintInvalidationState from parentState on the same object
87 // (e.g. LayoutView, and the HorriblySlowRectMapping cases in LayoutBloc k::invalidatePaintOfSubtreesIfNeeded()). 99 // (e.g. LayoutView, and the HorriblySlowRectMapping cases in LayoutBloc k::invalidatePaintOfSubtreesIfNeeded()).
88 // TODO(wangxianzhu): Avoid this for RuntimeEnabledFeatures::slimmingPai ntInvalidationEnabled(). 100 // TODO(wangxianzhu): Avoid this for RuntimeEnabledFeatures::slimmingPai ntInvalidationEnabled().
89 #if ENABLE(ASSERT) 101 #if ENABLE(ASSERT)
90 m_didUpdateForChildren = parentState.m_didUpdateForChildren; 102 m_didUpdateForChildren = parentState.m_didUpdateForChildren;
91 #endif 103 #endif
92 return; 104 return;
93 } 105 }
94 106
95 ASSERT(parentState.m_didUpdateForChildren); 107 ASSERT(parentState.m_didUpdateForChildren);
96 108
97 if (currentObject.isPaintInvalidationContainer()) { 109 if (currentObject.isPaintInvalidationContainer() || (currentObject.isBox() & & currentObject.styleRef().hasTransform())) {
98 m_paintInvalidationContainer = toLayoutBoxModelObject(&currentObject); 110 m_paintInvalidationContainer = toLayoutBoxModelObject(&currentObject);
99 if (currentObject.styleRef().isStackingContext()) 111 if (currentObject.styleRef().isStackingContext())
100 m_paintInvalidationContainerForStackedContents = toLayoutBoxModelObj ect(&currentObject); 112 m_paintInvalidationContainerForStackedContents = m_paintInvalidation Container;
113
114 if (currentObject.isPaintInvalidationContainer()) {
115 m_realPaintInvalidationContainer = toLayoutBoxModelObject(&currentOb ject);
116 if (currentObject.styleRef().isStackingContext())
117 m_realPaintInvalidationContainerForStackedContents = toLayoutBox ModelObject(&currentObject);
118 } else {
119 m_parentPaintInvalidationState = &parentState;
120 }
101 } else if (currentObject.isLayoutView()) { 121 } else if (currentObject.isLayoutView()) {
102 // m_paintInvalidationContainerForStackedContents is only for stacked de scendants in its own frame, 122 // m_paintInvalidationContainerForStackedContents is only for stacked de scendants in its own frame,
103 // because it doesn't establish stacking context for stacked contents in sub-frames. 123 // because it doesn't establish stacking context for stacked contents in sub-frames.
104 // Contents stacked in the root stacking context in this frame should us e this frame's paintInvalidationContainer. 124 // Contents stacked in the root stacking context in this frame should us e this frame's paintInvalidationContainer.
125 m_realPaintInvalidationContainerForStackedContents = m_realPaintInvalida tionContainer;
105 m_paintInvalidationContainerForStackedContents = m_paintInvalidationCont ainer; 126 m_paintInvalidationContainerForStackedContents = m_paintInvalidationCont ainer;
106 } else if (currentObject.styleRef().isStacked() 127 } else if (currentObject.styleRef().isStacked()
107 // This is to exclude some objects (e.g. LayoutText) inheriting stacked style from parent but aren't actually stacked. 128 // This is to exclude some objects (e.g. LayoutText) inheriting stacked style from parent but aren't actually stacked.
108 && currentObject.hasLayer() 129 && currentObject.hasLayer()
109 && m_paintInvalidationContainer != m_paintInvalidationContainerForStacke dContents) { 130 && m_paintInvalidationContainer != m_paintInvalidationContainerForStacke dContents) {
110 // The current object is stacked, so we should use m_paintInvalidationCo ntainerForStackedContents as its 131 // The current object is stacked, so we should use m_paintInvalidationCo ntainerForStackedContents as its
111 // paint invalidation container on which the current object is painted. 132 // paint invalidation container on which the current object is painted.
112 m_paintInvalidationContainer = m_paintInvalidationContainerForStackedCon tents; 133 m_paintInvalidationContainer = m_paintInvalidationContainerForStackedCon tents;
134 m_realPaintInvalidationContainer = m_realPaintInvalidationContainerForSt ackedContents;
113 // We are changing paintInvalidationContainer to m_paintInvalidationCont ainerForStackedContents. Must disable 135 // We are changing paintInvalidationContainer to m_paintInvalidationCont ainerForStackedContents. Must disable
114 // cached offsets because we didn't track paint offset from m_paintInval idationContainerForStackedContents. 136 // cached offsets because we didn't track paint offset from m_paintInval idationContainerForStackedContents.
115 // TODO(wangxianzhu): There are optimization opportunities: 137 // TODO(wangxianzhu): There are optimization opportunities:
116 // - Like what we do for fixed-position, calculate the paint offset in s low path and enable fast path for 138 // - Like what we do for fixed-position, calculate the paint offset in s low path and enable fast path for
117 // descendants if possible; or 139 // descendants if possible; or
118 // - Track offset between the two paintInvalidationContainers. 140 // - Track offset between the two paintInvalidationContainers.
119 m_cachedOffsetsEnabled = false; 141 m_cachedOffsetsEnabled = false;
120 if (m_forcedSubtreeInvalidationFlags & FullInvalidationForStackedContent s) 142 if (m_forcedSubtreeInvalidationFlags & FullInvalidationForStackedContent s)
121 m_forcedSubtreeInvalidationFlags |= FullInvalidation; 143 m_forcedSubtreeInvalidationFlags |= FullInvalidation;
122 } 144 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 213
192 EPosition position = m_currentObject.styleRef().position(); 214 EPosition position = m_currentObject.styleRef().position();
193 215
194 if (position == FixedPosition) { 216 if (position == FixedPosition) {
195 if (m_paintInvalidationContainer != m_currentObject.view() && m_paintInv alidationContainer->view() == m_currentObject.view()) { 217 if (m_paintInvalidationContainer != m_currentObject.view() && m_paintInv alidationContainer->view() == m_currentObject.view()) {
196 // TODO(crbug.com/598762): localToAncestorPoint() is incorrect for f ixed-position when paintInvalidationContainer 218 // TODO(crbug.com/598762): localToAncestorPoint() is incorrect for f ixed-position when paintInvalidationContainer
197 // is under the containing LayoutView. 219 // is under the containing LayoutView.
198 m_cachedOffsetsEnabled = false; 220 m_cachedOffsetsEnabled = false;
199 return; 221 return;
200 } 222 }
223 // Does this still work correctly??
201 // Use slow path to get the offset of the fixed-position, and enable fas t path for descendants. 224 // Use slow path to get the offset of the fixed-position, and enable fas t path for descendants.
202 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint(FloatPoint (), m_paintInvalidationContainer, TraverseDocumentBoundaries); 225 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint(FloatPoint (), m_paintInvalidationContainer, TraverseDocumentBoundaries);
203 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); 226 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y());
204 // In the above way to get paint offset, we can't get accurate clip rect , so just assume no clip. 227 // In the above way to get paint offset, we can't get accurate clip rect , so just assume no clip.
205 // Clip on fixed-position is rare, in case that paintInvalidationContain er crosses frame boundary 228 // Clip on fixed-position is rare, in case that paintInvalidationContain er crosses frame boundary
206 // and the LayoutView is clipped by something in owner document. 229 // and the LayoutView is clipped by something in owner document.
207 if (m_clipped) { 230 if (m_clipped) {
208 m_clipped = false; 231 m_clipped = false;
209 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 232 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
210 m_canCheckFastPathSlowPathEquality = false; 233 m_canCheckFastPathSlowPathEquality = false;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void PaintInvalidationState::updateForNormalChildren() 303 void PaintInvalidationState::updateForNormalChildren()
281 { 304 {
282 if (!m_cachedOffsetsEnabled) 305 if (!m_cachedOffsetsEnabled)
283 return; 306 return;
284 307
285 if (!m_currentObject.isBoxModelObject() && !m_currentObject.isSVG()) 308 if (!m_currentObject.isBoxModelObject() && !m_currentObject.isSVG())
286 return; 309 return;
287 310
288 if (m_currentObject.isLayoutView()) { 311 if (m_currentObject.isLayoutView()) {
289 if (!m_currentObject.document().settings() || !m_currentObject.document( ).settings()->rootLayerScrolls()) { 312 if (!m_currentObject.document().settings() || !m_currentObject.document( ).settings()->rootLayerScrolls()) {
290 if (m_currentObject != m_paintInvalidationContainer) { 313 if (m_currentObject != m_realPaintInvalidationContainer) {
291 m_paintOffset -= toLayoutView(m_currentObject).frameView()->scro llOffset(); 314 m_paintOffset -= toLayoutView(m_currentObject).frameView()->scro llOffset();
292 addClipRectRelativeToPaintOffset(toLayoutView(m_currentObject).v iewRect()); 315 addClipRectRelativeToPaintOffset(toLayoutView(m_currentObject).v iewRect());
293 } 316 }
294 return; 317 return;
295 } 318 }
296 } else if (m_currentObject.isSVGRoot()) { 319 } else if (m_currentObject.isSVGRoot()) {
297 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject); 320 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject);
298 if (svgRoot.shouldApplyViewportClip()) 321 if (svgRoot.shouldApplyViewportClip())
299 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize()))); 322 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize())));
300 } else if (m_currentObject.isTableRow()) { 323 } else if (m_currentObject.isTableRow()) {
301 // Child table cell's locationOffset() includes its row's locationOffset (). 324 // Child table cell's locationOffset() includes its row's locationOffset ().
302 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); 325 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset();
303 } 326 }
304 327
305 if (!m_currentObject.hasOverflowClip()) 328 if (!m_currentObject.hasOverflowClip())
306 return; 329 return;
307 330
308 const LayoutBox& box = toLayoutBox(m_currentObject); 331 const LayoutBox& box = toLayoutBox(m_currentObject);
309 332
310 // Do not clip scroll layer contents because the compositor expects the whol e layer 333 // Do not clip scroll layer contents because the compositor expects the whol e layer
311 // to be always invalidated in-time. 334 // to be always invalidated in-time.
312 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) 335 if (box == m_realPaintInvalidationContainer && box.scrollsOverflow())
313 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. 336 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited.
314 else 337 else
315 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint())); 338 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint()));
316 339
317 m_paintOffset -= box.scrolledContentOffset(); 340 m_paintOffset -= box.scrolledContentOffset();
318 341
319 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 342 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
320 } 343 }
321 344
322 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) 345 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect) 413 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect)
391 { 414 {
392 if (object.isLayoutView()) 415 if (object.isLayoutView())
393 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags); 416 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags);
394 else 417 else
395 object.mapToVisualRectInAncestorSpace(&ancestor, rect); 418 object.mapToVisualRectInAncestorSpace(&ancestor, rect);
396 } 419 }
397 420
398 void PaintInvalidationState::mapLocalRectToPaintInvalidationContainer(LayoutRect & rect) const 421 void PaintInvalidationState::mapLocalRectToPaintInvalidationContainer(LayoutRect & rect) const
399 { 422 {
400 ASSERT(!m_didUpdateForChildren);
401
402 if (m_cachedOffsetsEnabled) { 423 if (m_cachedOffsetsEnabled) {
403 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 424 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
404 LayoutRect slowPathRect(rect); 425 LayoutRect slowPathRect(rect);
405 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect); 426 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_realPaintInvalida tionContainer, slowPathRect);
406 #endif 427 #endif
407 rect.move(m_paintOffset); 428 rect.move(m_paintOffset);
408 if (m_clipped) 429 if (m_clipped)
409 rect.intersect(m_clipRect); 430 rect.intersect(m_clipRect);
431
432 if (m_parentPaintInvalidationState) {
433 if (m_currentObject.container()) {
434 RELEASE_ASSERT(m_currentObject.container()->isBoxModelObject());
435 LayoutBoxModelObject* box = toLayoutBoxModelObject(m_currentObje ct.container());
436 m_currentObject.mapToVisualRectInAncestorSpace(box, rect);
437 }
438
439 m_parentPaintInvalidationState->mapLocalRectToPaintInvalidationConta iner(rect);
440 } else if (m_transformParent) {
441 m_transformParent->mapLocalRectToPaintInvalidationContainer(rect);
442 }
443
410 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 444 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
411 assertFastPathAndSlowPathRectsEqual(rect, slowPathRect); 445 assertFastPathAndSlowPathRectsEqual(rect, slowPathRect);
412 #endif 446 #endif
413 } else { 447 } else {
414 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect); 448 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_realPaintInvalida tionContainer, rect);
415 } 449 }
416 } 450 }
417 451
418 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const 452 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const
419 { 453 {
420 mapLocalRectToPaintInvalidationContainer(rect); 454 mapLocalRectToPaintInvalidationContainer(rect);
421 455
422 if (m_paintInvalidationContainer->layer()->groupedMapping()) 456 if (m_paintInvalidationContainer->layer()->groupedMapping())
423 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); 457 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_realPaintInv alidationContainer, rect);
424 } 458 }
425 459
426 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect) 460 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect)
427 { 461 {
428 LayoutRect clipRect = localClipRect; 462 LayoutRect clipRect = localClipRect;
429 clipRect.move(m_paintOffset); 463 clipRect.move(m_paintOffset);
430 if (m_clipped) { 464 if (m_clipped) {
431 m_clipRect.intersect(clipRect); 465 m_clipRect.intersect(clipRect);
432 } else { 466 } else {
433 m_clipRect = clipRect; 467 m_clipRect = clipRect;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s", 521 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s",
488 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data()); 522 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data());
489 showLayoutTree(&m_currentObject); 523 showLayoutTree(&m_currentObject);
490 524
491 ASSERT_NOT_REACHED(); 525 ASSERT_NOT_REACHED();
492 } 526 }
493 527
494 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY 528 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY
495 529
496 } // namespace blink 530 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698