Refactor scrolling on the window object#29680
Conversation
|
cc @atbrakhi |
window object from script
|
@bors-servo try=wpt |
Fix scrolls run on the `window` object from script The calculation of the viewport scrolling area was incorrect, because it was based on the body element instead of the viewport. This change makes the argument to the layout query optional and when it is not specified, the return value reflects the viewport's scrolling area. In addition, scrolling the window object early on in the page load could sometimes lead to a situation where WebRender would scroll, but not request a frame with the scrolled content. Always request a frame when updating scroll positions from script. This patch was written in collaboration with Rakhi Sharma <[email protected]>. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21321. - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
Test results for linux-wpt-layout-2013 from try job (#4830008121): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (17)
Stable unexpected results (22)
|
|
💔 Test failed - checks-github |
window object from scriptwindow object from script
|
This needs a bit more work. In particular, we need to properly handle overflow: scroll on the |
|
☔ The latest upstream changes (presumably #29699) made this pull request unmergeable. Please resolve the merge conflicts. |
f72285c to
07b09ff
Compare
|
@bors-servo try |
|
🔨 Triggering try run (#5787185708) with platform=all and layout=all |
07b09ff to
7659356
Compare
|
@bors-servo try |
|
🔨 Triggering try run (#5787302817) with platform=all and layout=all |
7659356 to
fa379c7
Compare
|
@bors-servo try |
|
🔨 Triggering try run (#5787603936) with platform=all and layout=all |
|
|
|
🔨 Triggering try run (#5787603936) with platform=all and layout=all |
|
Test results for linux-wpt-layout-2020 from try job (#5787603936): Flaky unexpected result (1)
Stable unexpected results that are known to be intermittent (2)Stable unexpected results (52)
|
|
Test results for linux-wpt-layout-2013 from try job (#5787603936): Flaky unexpected result (14)
Stable unexpected results that are known to be intermittent (20)
|
|
|
fa379c7 to
ff05543
Compare
|
@bors-servo try |
|
🔨 Triggering try run (#5806668478) with platform=all and layout=all |
|
Test results for linux-wpt-layout-2020 from try job (#5806668478): Flaky unexpected result (2)
Stable unexpected results (1)
|
|
Test results for linux-wpt-layout-2013 from try job (#5806668478): Flaky unexpected result (16)
Stable unexpected results that are known to be intermittent (12)
|
|
|
ff05543 to
822a618
Compare
window object from script822a618 to
470f5de
Compare
|
@bors-servo try |
|
🔨 Triggering try run (#5824060244) with platform=all and layout=all |
470f5de to
ef0d95d
Compare
|
Test results for linux-wpt-layout-2020 from try job (#5824060244): Flaky unexpected result (1)
Stable unexpected results that are known to be intermittent (1)
Stable unexpected results (3)
|
|
Test results for linux-wpt-layout-2013 from try job (#5824060244): Flaky unexpected result (15)
Stable unexpected results that are known to be intermittent (15)
|
|
|
ef0d95d to
fc1988f
Compare
|
@bors-servo try=wpt-2020 |
|
🔨 Triggering try run (#5830627435) with platform=linux and layout=2020 |
|
Test results for linux-wpt-layout-2020 from try job (#5830627435): |
|
✨ Try run (#5830627435) succeeded. |
| pub fn scrolling_area(&self, containing_block: &PhysicalRect<Length>) -> PhysicalRect<Length> { | ||
| match self { | ||
| Fragment::Box(fragment) | Fragment::Float(fragment) => fragment | ||
| .scrollable_overflow(&containing_block) |
There was a problem hiding this comment.
Do we need to re-borrow containing_block here? fn scrollable_overflow takes a &PhysicalRect, so I think we should be able to pass containing_block directly?
There was a problem hiding this comment.
Nope. You're right. I've removed this.
Refactor the scrolling and scrollable area calculation on the window object, to make it better match the specification. This has some mild changes to behavior, but in general things work the same as they did before. This is mainly preparation for properly handling viewport propagation of the `overflow` property but seems to fix a few issues as well. There is one new failure in Layout 2020 regarding `position: sticky`, but this isn't a big deal because there is no support for `position: sticky` in Layout 2020 yet. Co-authored-by: Rakhi Sharma <[email protected]>
fc1988f to
1192895
Compare
|
Thanks for the review! |
Refactor the scrolling and scrollable area calculation on the window object, to make it better match the specification. This has some mild changes to behavior, but in general things work the same as they did before. This is mainly preparation for properly handling viewport propagation of the
overflowproperty.There is one new pass in Layout 2020 regarding
position: sticky, but this isn't a big deal because there is no support forposition: stickyin Layout 2020 yet. In addition,tests/wpt/mozilla/tests/mozilla/scrollTo.htmlis updated to fix a flakiness timing issue. It tries to scroll the page before the entire page is loaded.Co-authored-by: Rakhi Sharma [email protected]
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors