From 9e7e1bd19fecd541ce4192e24039b746a88ce3df Mon Sep 17 00:00:00 2001 From: Xianzhu Wang Date: Tue, 23 Apr 2024 14:28:51 -0700 Subject: [PATCH] Fall back to main thread if scroll hit test is affected by rounded corners We had two issues: 1. Before we had fast rounded corners, we always created mask layers for rounded corner clips, and the mask layer made the scroll begin unreliable and fall back to the main thread. With fast rounded corners, the scrolls were treated as reliable without checking if the point is in or out of the rounded corners. 2. If the scroller has a rounded corner by itself (instead of from an ancestor), as we only create InnerBorderRadiusClip for the contents, the compositor doesn't actually know which part of the layer bounds is transparent to hit test (e.g. if the scroller has a border which is outside of the InnerBorderRadiusClip). Now with HitTestOpaqueness, such layers have HitTestOpaqueness::kMixed. This CL changes the behavior of LayerTreeImpl::FindLayersUpToFirstOpaqueToHitTest (renamed from FindLayerUpToFirstScrollableOrOpaqueToHitTest): - For issue #1: LayerImpl::OpaqueToHitTest() also checks whether the layer is affected by any fast rounded corners; - For issue #2: FindLayerUpToFirstOpaqueToHitTest checks only OpaqueToHitTest() (without checking IsScrollerOrScrollbar()) because a hit test on a scrollable layer is reliable only if it's opaque to hit test. Bug: 40277896 Change-Id: I1acb16f2c6790760661e8239ea1599035f83ea51 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5466909 Commit-Queue: Xianzhu Wang Reviewed-by: Steve Kobes Cr-Commit-Position: refs/heads/main@{#1291538} --- .../scroll-with-ancestor-border-radius.html | 59 +++++++++++++++++++ .../scroll-with-border-radius.html | 51 ++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 css/css-overflow/scroll-with-ancestor-border-radius.html create mode 100644 css/css-overflow/scroll-with-border-radius.html diff --git a/css/css-overflow/scroll-with-ancestor-border-radius.html b/css/css-overflow/scroll-with-ancestor-border-radius.html new file mode 100644 index 00000000000000..9192c613e9eb54 --- /dev/null +++ b/css/css-overflow/scroll-with-ancestor-border-radius.html @@ -0,0 +1,59 @@ + + +Should not scroll out of rounded corner + + + + + + + + + +
+
+
+
+
+
+ + diff --git a/css/css-overflow/scroll-with-border-radius.html b/css/css-overflow/scroll-with-border-radius.html new file mode 100644 index 00000000000000..88bb0f1fa88f7a --- /dev/null +++ b/css/css-overflow/scroll-with-border-radius.html @@ -0,0 +1,51 @@ + + +Should not scroll out of rounded corner + + + + + + + + + +
+
+
+
+ +