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

Unified Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 1838853007: Print more information when slow-path/fast-path rects mismatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
index 6270c5476ec627376575d63bbfc22d7962703389..da24540c772fa23bffe2d7aeec75bbc91d6bd079 100644
--- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
+++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
@@ -21,6 +21,43 @@
namespace blink {
+#if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
+// Make sure that the fast path and the slow path generate the same rect.
+void assertRectsEqual(const LayoutObject& object, const LayoutBoxModelObject& ancestor, const LayoutRect& rect, const LayoutRect& slowPathRect)
+{
+ // TODO(wangxianzhu): This is for cases that a sub-frame creates a root PaintInvalidationState
+ // which doesn't inherit clip from ancestor frames.
+ // Remove the condition when we eliminate the latter case of PaintInvalidationState(const LayoutView&, ...).
+ if (object.isLayoutView())
+ return;
+
+ // TODO(crbug.com/597903): Fast path and slow path should generate equal empty rects.
+ if (rect.isEmpty() && slowPathRect.isEmpty())
+ return;
+
+ if (rect == slowPathRect)
+ return;
+
+ // Tolerate the difference between the two paths when crossing frame boundaries.
+ if (object.view() != ancestor.view()) {
+ LayoutRect inflatedRect = rect;
+ inflatedRect.inflate(1);
+ if (inflatedRect.contains(slowPathRect))
+ return;
+ LayoutRect inflatedSlowPathRect = slowPathRect;
+ inflatedSlowPathRect.inflate(1);
+ if (inflatedSlowPathRect.contains(rect))
+ return;
+ }
+
+#ifndef NDEBUG
+ WTFLogAlways("Fast-path paint invalidation rect differs from slow-path: %s vs %s", rect.toString().ascii().data(), slowPathRect.toString().ascii().data());
+ showLayoutTree(&object);
+#endif
+ ASSERT_NOT_REACHED();
+}
+#endif
+
static bool isAbsolutePositionUnderRelativePositionInline(const LayoutObject& object)
{
if (object.styleRef().position() != AbsolutePosition)
@@ -266,12 +303,11 @@ LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG()
if (m_clipped)
rect.intersect(m_clipRect);
#if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
- LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_currentObject, m_paintInvalidationContainer);
// TODO(crbug.com/597902): Slow path misses clipping of paintInvalidationContainer.
+ LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_currentObject, m_paintInvalidationContainer);
if (m_clipped)
slowPathRect.intersect(m_clipRect);
- // TODO(crbug.com/597903): Fast path and slow path should generate equal empty rects.
- ASSERT((rect.isEmpty() && slowPathRect.isEmpty()) || rect == slowPathRect);
+ assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, slowPathRect);
#endif
} else {
// TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't mean we can't use cached
@@ -286,11 +322,6 @@ LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG()
static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect)
{
- // TODO(crbug.com/597965): LayoutBox::mapToVisualRectInAncestorSpace() incorrectly flips a rect
- // in its own space for writing mode. Here flip to workaround the flip.
- if (object.isBox() && (toLayoutBox(object).isWritingModeRoot() || (ancestor == object && object.styleRef().isFlippedBlocksWritingMode())))
chrishtr 2016/03/31 00:27:12 Put this into the CL description (at the top since
Xianzhu 2016/03/31 00:48:08 It's wrong to change this in this CL. Reverted to
- toLayoutBox(object).flipForWritingMode(rect);
-
if (object.isLayoutView()) {
toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, InputIsInFrameCoordinates, DefaultVisualRectFlags);
} else if (object.isSVGRoot()) {
@@ -314,15 +345,10 @@ void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect&
if (m_clipped)
rect.intersect(m_clipRect);
#if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
- // Make sure that the fast path and the slow path generate the same rect.
// TODO(crbug.com/597902): Slow path misses clipping of paintInvalidationContainer.
if (m_clipped)
slowPathRect.intersect(m_clipRect);
- // TODO(wangxianzhu): The isLayoutView() condition is for cases that a sub-frame creates a
- // root PaintInvalidationState which doesn't inherit clip from ancestor frames.
- // Remove the condition when we eliminate the latter case of PaintInvalidationState(const LayoutView&, ...).
- // TODO(crbug.com/597903): Fast path and slow path should generate equal empty rects.
- ASSERT(m_currentObject.isLayoutView() || (rect.isEmpty() && slowPathRect.isEmpty()) || rect == slowPathRect);
+ assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, slowPathRect);
#endif
} else {
slowMapToVisualRectInAncestorSpace(m_currentObject, m_paintInvalidationContainer, rect);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698