Repository navigation
Add retry for hit tests with expired epoch in result - #37085
Conversation
cbc82a5 to
ce8f9c6
Compare
afcd497 to
747726a
Compare
yezhizhen
left a comment
There was a problem hiding this comment.
Hit tests with expired epoch mean it is too early to perform the hit test.
I think it means "too late" instead "too early"? If we retry, we are essentially hit-test against the new display list. It may work well with WebDriver as it is fairly static, but may introduce weird experience for real browsing..
cc @jdm
If two events occur in sequence, their effects should be applied sequentially. |
|
I'm not sure a "retry" approach is the right one here. It feels like putting a bandaid over the real problem which is that hit testing needs to be done synchronously with script. 🫤 |
We can think retry and synchronization are similar terms here because we pick a specific point to retry. |
Maybe it leads to the problem of notify new epoch to compositor. |
759c376 to
9ced3cd
Compare
CMIIW but I think the situation is inevitable as long as we have compositor and script running on different threads, and possible solutions are:
Here 1 seems to be the easiest fix. 2 is much more complicated and may cause a bigger performance hit, and I don't see much benefits in there. However, my favorite is 3, and I would like to try it later in the year https://github.com/servo/servo/wiki/Roadmap#architecture later |
dce9c69 to
aa68ffd
Compare
2d09697 to
6da22fe
Compare
5c762c6 to
b68f5b1
Compare
Signed-off-by: batu_hoang <[email protected]>
Signed-off-by: batu_hoang <[email protected]>
Signed-off-by: batu_hoang <[email protected]>
Signed-off-by: batu_hoang <[email protected]>
Signed-off-by: batu_hoang <[email protected]>
Signed-off-by: batu_hoang <[email protected]>
8c69528 to
0d02b61
Compare
| return false; | ||
| }, | ||
| _ => { | ||
| return false; |
There was a problem hiding this comment.
In this case, may also need to retry.
There was a problem hiding this comment.
This just keeps the default logic, you can add a retry here with a proper reason.
I'm just curious, if so, basically we retry all failed hit test?
| .borrow() | ||
| .hit_test_at_point(point, get_pipeline_details) | ||
| else { | ||
| // Don't need to process pending input events in this frame any more. |
There was a problem hiding this comment.
On some complex pages, such as https://m.huaweimossel.com, a retry failure may occur once.
For touchmove, failure only affects one swipe, which has a minor impact.
However, for touchdown and touchup, a retry failure has a significant impact on the application.
A touchdown failure will prevent the subsequent touchmove or click events from being completed.
A touchup failure will prevent the click event from being triggered. Additionally, the number of active_points saved in the script thread is incorrect. When the next touchdown is triggered, the application will receive two Touch messages.
There was a problem hiding this comment.
a retry failure has a significant impact on the application
If we don't retry touch events, there is no impact?
There was a problem hiding this comment.
The touchdown and touchup events exist in pairs. If touchdown is successful and touchup fails, the application's JavaScript will consider there to be a touchpoint present. When touchdown is triggered again, the number of touchpoints becomes 2.
When this situation occurs on the https://m.huaweimossel.com/ website, the carousel will not be able to slide. This is because the developer has checked the size of e.touches.length in the JavaScript code. This is the issue I have discovered so far.
There was a problem hiding this comment.
Thanks for your details. As my understanding, the problem occurs because of hit test failings. Since the retry keeps the order of events, it doesn't play a role here.
Anyway, retry is just an improvement, not a final fix.
We can wait for this: #37085 (comment).
There was a problem hiding this comment.
For the problem found now, should we first solve it by increasing the number of retries?
There was a problem hiding this comment.
Increase amount of retry may lead to a scenario in which, 1 event takes several frames to be processed.
I'm thinking of retrying touch events as pairs of down and up, how do you think?
There was a problem hiding this comment.
Do you mean that if either down or up fails, everything will be retried?
There was a problem hiding this comment.
Yes both must succeed or fail together.
There was a problem hiding this comment.
But there could be two touchdowns, and then two touchups. Or more.

Follow up to hit_test failed occasionally when the touch event is sent and #36676 (comment), this PR adds a retry for hit tests with expired epoch in result.
Hit tests with outdated epoch mean it is too early to perform the hit test.
Solution: retry hit test for the event on the next webrender frame.
The retry should guarantee that:
Test cases:
./mach test-wpt --product servodriver -r tests\wpt\tests\webdriver\tests\classic\element_click\events.pycc: @xiaochengh , @yezhizhen