From 46d496d2be96a4713cf614a6c61f27da4ce7a065 Mon Sep 17 00:00:00 2001 From: Xianzhu Wang Date: Thu, 18 Apr 2024 20:08:24 -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 --- .../scroll-with-ancestor-border-radius.html | 57 +++++++++++++++++++ .../scroll-with-border-radius.html | 49 ++++++++++++++++ 2 files changed, 106 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 000000000000000..6ba7c1f3d9717f6 --- /dev/null +++ b/css/css-overflow/scroll-with-ancestor-border-radius.html @@ -0,0 +1,57 @@ + + +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 000000000000000..3fe6674e83109a5 --- /dev/null +++ b/css/css-overflow/scroll-with-border-radius.html @@ -0,0 +1,49 @@ + + +Should not scroll out of rounded corner + + + + + + + + +
+
+
+
+ +