-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
compositor: Do not allow script to scroll beyond node boundaries #37412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🔨 Triggering try run (#15609368948) for Linux (WPT) |
|
Test results for linux-wpt from try job (#15609368948): Flaky unexpected result (20)
Stable unexpected results that are known to be intermittent (21)
Stable unexpected results (2)
|
|
|
3d0ea2d to
a06eb2b
Compare
a06eb2b to
6d317a1
Compare
|
🔨 Triggering try run (#15613142047) for Linux (WPT) |
|
Test results for linux-wpt from try job (#15613142047): Flaky unexpected result (19)
Stable unexpected results that are known to be intermittent (23)
|
|
✨ Try run (#15613142047) succeeded. |
6d317a1 to
4c4a224
Compare
components/compositing/compositor.rs
Outdated
| { | ||
| warn!("Could not scroll not with id: {external_scroll_id:?}"); | ||
| else { | ||
| warn!("Could not scroll node with id: {external_scroll_id:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to warn when the element isn't a scroll container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. My thought is that we shouldn't even be getting to this point, as it shouldn't advance from script to the compositor, but I'm fine removing the warning.
| if !self.scroll_sensitivity.x.contains(context) && | ||
| !self.scroll_sensitivity.y.contains(context) | ||
| { | ||
| return None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems inconsistent that if the element isn't scrollable in any axis this returns None, but if it's only scrollable in a single axis then it returns Some(LayoutVector2D). Should it be Vector2D<Option<f32>>?
scroll_node_or_ancestor relies on the current logic but it seems a bit broken to me, e.g. the request is for scrolling to a position with a different vertical offset, and the scrolling container can only scroll horizontally, then this will return a Some(), and scroll_node_or_ancestor will not keep iterating ancestors. Is that correct?
Not blocking this PR since it's an existing thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think your understanding of the behavior is correct. We would need to return a more complicated data structure if it's possible to scroll more than a single node with the same operation. This cannot happen via script and I'm not exactly sure how things should operate when processing input events. Likely we really only want to support scrolling a single scroll node at a time, but I could be wrong.
The compositor was accepting scroll offsets from the ScriptThread without checking their boundaries. In some cases this could cause a temporary discrepancy with the rendered scroll offset. This change makes it so that all offset updates for scroll ayers in the compositor do not scroll past the scroll boundaries of the node. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
4c4a224 to
c395026
Compare
In #37412 we renamed `ScrollSensitivity` to `ScrollType`. This PR updates the doc. Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
The compositor was accepting scroll offsets from the ScriptThread
without checking their boundaries. In some cases this could cause a
temporary discrepancy with the rendered scroll offset. This change makes
it so that all offset updates for scroll ayers in the compositor do not
scroll past the scroll boundaries of the node.
Testing: Two new tests pass with this change:
/css/css-position/sticky/position-sticky-left-003.html/css/css-position/sticky/position-sticky-top-003.html