Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/layout/LayoutInline.h" | 9 #include "core/layout/LayoutInline.h" |
| 10 #include "core/layout/LayoutPart.h" | 10 #include "core/layout/LayoutPart.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const | 366 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const |
| 367 { | 367 { |
| 368 LayoutRect rect; | 368 LayoutRect rect; |
| 369 if (m_cachedOffsetsEnabled) { | 369 if (m_cachedOffsetsEnabled) { |
| 370 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject); | 370 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject); |
| 371 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect); | 371 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect); |
| 372 rect.move(m_paintOffset); | 372 rect.move(m_paintOffset); |
| 373 if (m_clipped) | 373 if (m_clipped) |
| 374 rect.intersect(m_clipRect); | 374 rect.intersect(m_clipRect); |
| 375 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH | 375 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH |
| 376 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer. | |
| 377 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer); | 376 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer); |
| 378 if (m_clipped) | |
| 379 slowPathRect.intersect(m_clipRect); | |
| 380 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect); | 377 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect); |
| 381 #endif | 378 #endif |
| 382 } else { | 379 } else { |
| 383 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached | 380 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached |
| 384 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot). | 381 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot). |
| 385 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer); | 382 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer); |
| 386 } | 383 } |
| 387 | 384 |
| 388 if (m_paintInvalidationContainer->layer()->groupedMapping()) | 385 if (m_paintInvalidationContainer->layer()->groupedMapping()) |
| 389 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); | 386 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); |
| 390 return rect; | 387 return rect; |
| 391 } | 388 } |
| 392 | 389 |
| 393 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect) | 390 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect) |
| 394 { | 391 { |
| 395 if (object.isLayoutView()) { | 392 if (object.isLayoutView()) { |
| 396 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags); | 393 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags); |
| 397 } else { | 394 } else { |
| 398 object.mapToVisualRectInAncestorSpace(&ancestor, rect); | 395 object.mapToVisualRectInAncestorSpace(&ancestor, rect); |
| 399 } | 396 } |
| 397 | |
| 398 // LayoutObject::mapToVisualRectInAncestorSpace() doesn't apply overflow cli p of ancestor. | |
|
chrishtr
2016/04/06 23:18:19
Do any other call sites of mapToVisualRectInAncest
Xianzhu
2016/04/06 23:37:33
Didn't think of this. Just looked at several calls
| |
| 399 if (ancestor.isBox() && !ancestor.isLayoutView() && !toLayoutBox(ancestor).s crollsOverflow()) | |
| 400 rect.intersect(toLayoutBox(ancestor).overflowClipRect(LayoutPoint())); | |
| 400 } | 401 } |
| 401 | 402 |
| 402 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const | 403 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const |
| 403 { | 404 { |
| 404 ASSERT(!m_didUpdateForChildren); | 405 ASSERT(!m_didUpdateForChildren); |
| 405 | 406 |
| 406 if (m_cachedOffsetsEnabled) { | 407 if (m_cachedOffsetsEnabled) { |
| 407 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH | 408 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH |
| 408 LayoutRect slowPathRect(rect); | 409 LayoutRect slowPathRect(rect); |
| 409 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect); | 410 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect); |
| 410 #endif | 411 #endif |
| 411 rect.move(m_paintOffset); | 412 rect.move(m_paintOffset); |
| 412 if (m_clipped) | 413 if (m_clipped) |
| 413 rect.intersect(m_clipRect); | 414 rect.intersect(m_clipRect); |
| 414 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH | 415 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH |
| 415 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer. | |
| 416 if (m_clipped) | |
| 417 slowPathRect.intersect(m_clipRect); | |
| 418 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect); | 416 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect); |
| 419 #endif | 417 #endif |
| 420 } else { | 418 } else { |
| 421 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect); | 419 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect); |
| 422 } | 420 } |
| 423 | 421 |
| 424 if (m_paintInvalidationContainer->layer()->groupedMapping()) | 422 if (m_paintInvalidationContainer->layer()->groupedMapping()) |
| 425 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); | 423 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); |
| 426 } | 424 } |
| 427 | 425 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 439 | 437 |
| 440 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const | 438 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const |
| 441 { | 439 { |
| 442 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer()) | 440 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer()) |
| 443 return *toLayoutBoxModelObject(layoutObject).layer(); | 441 return *toLayoutBoxModelObject(layoutObject).layer(); |
| 444 | 442 |
| 445 return m_enclosingSelfPaintingLayer; | 443 return m_enclosingSelfPaintingLayer; |
| 446 } | 444 } |
| 447 | 445 |
| 448 } // namespace blink | 446 } // namespace blink |
| OLD | NEW |