A question about non-tight touch action region

3 views
Skip to first unread message

Xianzhu Wang

unread,
Jun 13, 2024, 8:51:39 PM6/13/24
to inpu...@chromium.org, Philip Rogers
Hi,

For the question, pdr@ created a test case:

<div id=scroller style="width: 500px; height: 500px; overflow-y: scroll; border: 1px solid black;">
  <div id=touchaction style="width: 200px; height: 200px; background: lightblue; touch-action: none; clip-path: circle(50%);"></div>
  <div id=forcescroll style="height: 2000px;"></div>
</div>

I tested the case with local logs and confirmed that we can correctly handle touch actions in and out of the circle by falling back to the main thread. This is good, but we would like to ask the following questions to make sure we fully understand the logic:

1. Does any hit test in any touch action region require the main thread?
2. If the answer to #1 is yes, is it possible to handle some touch actions without needing the main thread, if we know the touch action region is tight?
3. In theory (if ignoring performance impact), can we expand a touch action region freely without affecting correctness? For example, if a touch action region is too complex, can we simplify the region by using the bounding box instead?

Thanks,
Xianzhu

Robert Flack

unread,
Jun 24, 2024, 10:19:19 AM6/24/24
to Xianzhu Wang, inpu...@chromium.org, Philip Rogers
Hey, sorry I missed this earlier,

1. Does any hit test in any touch action region require the main thread?

This depends on how well we can hit test elements. In many cases I think it does, in particular it's not just about the geometry of the element itself but the geometry of any hit testable element which occludes it.

2. If the answer to #1 is yes, is it possible to handle some touch actions without needing the main thread, if we know the touch action region is tight?

Yes, but we would have to know that there are no elements with a different touch action in front of that element. E.g. imagine another div with a different touch action which overlaps that element with touch-action: none.

3. In theory (if ignoring performance impact), can we expand a touch action region freely without affecting correctness? For example, if a touch action region is too complex, can we simplify the region by using the bounding box instead?

So this is similar to the model that we have with touch action. We create a bounding box and if you hit the bounding box then we do the more complex main thread hit test.

It would be breaking to simply expand the region and treat the larger bounding rect as if it had the alternate touch action.

Perhaps it would be easier to meet and chat through ideas here. I wrote this doc a long time ago with some examples of overlap cases.

Robert Flack

unread,
Jun 24, 2024, 10:28:29 AM6/24/24
to Xianzhu Wang, inpu...@chromium.org, Philip Rogers
Note that we implemented support for using the partial touch action until we have the full touch action result on the compositor thread, see the use of the compositor_allowed_touch_action in touch_action_filter.cc. This allows us to for example start scrolling vertically and queue horitontal scrolling if we're over a region which may not allow horizontal scrolling (e.g. because we're over a bounding box which has touch-action: pan-y).

The main issue is that if you're over a bounding box for some touch-action: none region we can't tell until the hit test is complete whether any scrolling should be allowed.

It would be great if we could figure out some regions over which we know the touch-action for sure or better improve the representation of the touch action on the compositor side to avoid needing to block on these hit tests where possible.
Reply all
Reply to author
Forward
0 new messages