Commit c1637af7 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[BlinkGenPropertyTrees] Collect non-drawing layers for hit testing

Some non-drawing layers need to be collected for hit testing. For
example, if there's a composited animation on an empty div, we still
need to create a composited layer for the purposes of hit testing.

Bug: 870728

Cq-Include-Trybots: luci.chromium.try:linux-blink-gen-property-trees;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ibbf8bcd60242b901db9b35821450111d4a7c5d63
Reviewed-on: https://chromium-review.googlesource.com/1180464Reviewed-by: default avatarTien-Ren Chen <trchen@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584267}
parent eb0a66c4
<!doctype html>
<style>
.scroll {
overflow: auto;
width: 100px;
height: 100px;
will-change: transform;
}
.scrolled-content {
width: 50px;
height: 1000px;
background-image: linear-gradient(green, red);
}
</style>
It should not be possible to scroll this content:<br>
<div class="scroll">
<div class="scrolled-content"></div>
</div>
<!doctype html>
<style>
.scroll {
overflow: auto;
width: 100px;
height: 100px;
will-change: transform;
}
.scrolled-content {
width: 50px;
height: 1000px;
background-image: linear-gradient(green, red);
}
#animated-overlap {
height: 100px;
width: 110px;
animation: cover 1s infinite;
}
@keyframes cover {
0% { transform: translateY(0); }
1% { transform: translateY(-100px); }
100% { transform: translateY(-100px); }
}
</style>
It should not be possible to scroll this content:<br>
<div class="scroll">
<div class="scrolled-content"></div>
</div>
<div id="animated-overlap"></div>
<script>
testRunner.waitUntilDone();
// Wait for the animation to advance.
requestAnimationFrame(function() {
const GESTURE_SOURCE_TYPE = 2; // MOUSE_INPUT from synthetic_gesture_params.h
chrome.gpuBenchmarking.smoothScrollBy(
1000,
function() {
testRunner.notifyDone();
},
50 /* start_x */,
50 /* start_y */,
GESTURE_SOURCE_TYPE,
'down',
20000 /* speed */);
});
</script>
...@@ -2708,7 +2708,11 @@ static void CollectDrawableLayersForLayerListRecursively( ...@@ -2708,7 +2708,11 @@ static void CollectDrawableLayersForLayerListRecursively(
if (!layer || layer->Client().ShouldThrottleRendering()) if (!layer || layer->Client().ShouldThrottleRendering())
return; return;
if (layer->DrawsContent()) { // We need to collect all layers that draw content, as well as some layers
// that don't for the purposes of hit testing. For example, an empty div
// will not draw content but needs to create a layer to ensure scroll events
// do not pass through it.
if (layer->DrawsContent() || layer->GetHitTestableWithoutDrawsContent()) {
ScopedPaintChunkProperties scope(context.GetPaintController(), ScopedPaintChunkProperties scope(context.GetPaintController(),
layer->GetPropertyTreeState(), *layer, layer->GetPropertyTreeState(), *layer,
DisplayItem::kForeignLayerWrapper); DisplayItem::kForeignLayerWrapper);
......
...@@ -1038,8 +1038,7 @@ TEST_F(CompositedLayerMappingTest, ...@@ -1038,8 +1038,7 @@ TEST_F(CompositedLayerMappingTest,
mapping->ForegroundLayer()->PaintingPhase()); mapping->ForegroundLayer()->PaintingPhase());
// Regression test for crbug.com/767908: a foreground layer should also // Regression test for crbug.com/767908: a foreground layer should also
// participates hit testing. // participates hit testing.
EXPECT_TRUE(mapping->ForegroundLayer() EXPECT_TRUE(mapping->ForegroundLayer()->GetHitTestableWithoutDrawsContent());
->GetHitTestableWithoutDrawsContentForTesting());
Element* negative_composited_child = Element* negative_composited_child =
GetDocument().getElementById("negative-composited-child"); GetDocument().getElementById("negative-composited-child");
......
...@@ -188,7 +188,7 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient, ...@@ -188,7 +188,7 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
void SetIsRootForIsolatedGroup(bool); void SetIsRootForIsolatedGroup(bool);
void SetHitTestableWithoutDrawsContent(bool); void SetHitTestableWithoutDrawsContent(bool);
bool GetHitTestableWithoutDrawsContentForTesting() { bool GetHitTestableWithoutDrawsContent() const {
return hit_testable_without_draws_content_; return hit_testable_without_draws_content_;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment