From 2dcf849261ba18c1a56cc0d11ffc9e3c46fdfd9e Mon Sep 17 00:00:00 2001 From: Xianzhu Wang Date: Wed, 18 Oct 2017 17:05:38 +0000 Subject: [PATCH] Invalidate layer when its composited scrolling status changed When a composited scrolling layer's object is set 'pointer-events:none', the layer will no longer use composited scrolling (though it is still composited). This is controlled by ComputedStyle::VisibleToHitTesting(). When this happens, no other conditions trigger invalidation of the layer. Now invalidate a layer when its composited scrolling status changed. TBR=wangxianzhu@chromium.org (cherry picked from commit 9ba22278e4707ce05a237a720aa2f993e99353d9) Bug: 758474 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I3c01a543a5424d8c746e901047abc606874e0290 Reviewed-on: https://chromium-review.googlesource.com/717028 Reviewed-by: Philip Rogers Commit-Queue: Xianzhu Wang Cr-Original-Commit-Position: refs/heads/master@{#509172} Reviewed-on: https://chromium-review.googlesource.com/726379 Reviewed-by: Xianzhu Wang Cr-Commit-Position: refs/branch-heads/3239@{#53} Cr-Branched-From: adb61db19020ed8ecee5e91b1a0ea4c924ae2988-refs/heads/master@{#508578} --- .../FlagExpectations/enable-slimming-paint-v2 | 2 + ...-events-composited-scrolling-expected.html | 2 + ...r-events-composited-scrolling-expected.txt | 67 +++++++++++++++++++ .../pointer-events-composited-scrolling.html | 15 +++++ .../destroy-composited-scrollbar-expected.txt | 15 ++++- .../compositing/GraphicsLayerUpdater.cpp | 8 ++- .../graphics/paint/PaintController.cpp | 2 +- 7 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.html create mode 100644 third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.txt create mode 100644 third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling.html diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 index 500c341b57d8..c6d3cd6bcaee 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 @@ -1717,6 +1717,8 @@ crbug.com/762098 compositing/overflow/non-composited-sticky-element-in-main-thre # Subsequence under-invalidation of scroller related to ScrollHitTest. crbug.com/738613 compositing/overflow/overflow-scroll-with-pointer-events-toggle.html [ Failure Crash ] +# Null pointer in PaintArtifactCompositor::ScrollHitTestLayerForPendingLayer(). +crbug.com/738613 paint/invalidation/compositing/pointer-events-composited-scrolling.html [ Crash ] # See comment regarding this test in NeverFixTests. It also fails for other # reasons, in particular that the composited layerization algorithm provides diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.html b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.html new file mode 100644 index 000000000000..103d4f285894 --- /dev/null +++ b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.html @@ -0,0 +1,2 @@ + +
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.txt new file mode 100644 index 000000000000..eda0ab1d6eff --- /dev/null +++ b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling-expected.txt @@ -0,0 +1,67 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutBlockFlow DIV id='target'", + "position": [8, 8], + "bounds": [100, 100], + "paintInvalidations": [ + { + "object": "LayoutBlockFlow DIV id='target'", + "rect": [0, 0, 100, 100], + "reason": "full" + }, + { + "object": "LayoutBlockFlow DIV id='target'", + "rect": [0, 0, 100, 100], + "reason": "compositing update" + }, + { + "object": "LayoutBlockFlow DIV id='content'", + "rect": [0, 30, 50, 50], + "reason": "compositing update" + } + ] + }, + { + "name": "Overflow Controls Host Layer", + "position": [8, 8], + "bounds": [100, 100], + "drawsContent": false + }, + { + "name": "Horizontal Scrollbar Layer", + "position": [8, 108], + "bounds": [100, 0] + }, + { + "name": "Vertical Scrollbar Layer", + "position": [108, 8], + "bounds": [0, 100] + } + ], + "objectPaintInvalidations": [ + { + "object": "LayoutBlockFlow DIV id='target'", + "reason": "compositing update" + }, + { + "object": "LayoutBlockFlow DIV id='target'", + "reason": "geometry" + }, + { + "object": "LayoutBlockFlow DIV id='target'", + "reason": "geometry" + }, + { + "object": "LayoutBlockFlow DIV id='content'", + "reason": "compositing update" + } + ] +} + diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling.html b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling.html new file mode 100644 index 000000000000..5e164ab35e02 --- /dev/null +++ b/third_party/WebKit/LayoutTests/paint/invalidation/compositing/pointer-events-composited-scrolling.html @@ -0,0 +1,15 @@ + + +
+
+
+ + diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/destroy-composited-scrollbar-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/destroy-composited-scrollbar-expected.txt index 556ab76c77e6..83a3e147d1b3 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/destroy-composited-scrollbar-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/destroy-composited-scrollbar-expected.txt @@ -25,8 +25,13 @@ }, { "object": "LayoutBlockFlow (positioned) DIV", - "rect": [185, 0, 15, 200], - "reason": "scroll control" + "rect": [0, 0, 200, 200], + "reason": "compositing update" + }, + { + "object": "LayoutBlockFlow DIV id='content'", + "rect": [0, 0, 100, 100], + "reason": "compositing update" } ] } @@ -34,7 +39,11 @@ "objectPaintInvalidations": [ { "object": "LayoutBlockFlow (positioned) DIV", - "reason": "geometry" + "reason": "compositing update" + }, + { + "object": "LayoutBlockFlow DIV id='content'", + "reason": "compositing update" } ] } diff --git a/third_party/WebKit/Source/core/paint/compositing/GraphicsLayerUpdater.cpp b/third_party/WebKit/Source/core/paint/compositing/GraphicsLayerUpdater.cpp index 4df8b08531c5..4fda8a091d95 100644 --- a/third_party/WebKit/Source/core/paint/compositing/GraphicsLayerUpdater.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/GraphicsLayerUpdater.cpp @@ -107,8 +107,14 @@ void GraphicsLayerUpdater::UpdateRecursive( CompositedLayerMapping* mapping = layer.GetCompositedLayerMapping(); if (update_type == kForceUpdate || mapping->NeedsGraphicsLayerUpdate()) { - if (mapping->UpdateGraphicsLayerConfiguration()) + bool had_scrolling_layer = mapping->ScrollingLayer(); + if (mapping->UpdateGraphicsLayerConfiguration()) { needs_rebuild_tree_ = true; + // Change of existence of scrolling layer affects visual rect offsets of + // descendants via LayoutObject::ScrollAdjustmentForPaintInvalidation(). + if (had_scrolling_layer != !!mapping->ScrollingLayer()) + layers_needing_paint_invalidation.push_back(&layer); + } mapping->UpdateGraphicsLayerGeometry(context.CompositingContainer(layer), context.CompositingStackingContext(), layers_needing_paint_invalidation); diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index 261bce639d87..9b088f74ebf6 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp @@ -1026,7 +1026,7 @@ void PaintController::ShowSequenceUnderInvalidationError( LOG(ERROR) << under_invalidation_message_prefix_ << " " << reason; LOG(ERROR) << "Subsequence client: " << client.DebugName(); #ifndef NDEBUG -// showDebugData(); + ShowDebugData(); #else LOG(ERROR) << "Run debug build to get more details."; #endif