Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix several bugs related to scrolling #17385
Conversation
highfive
commented
Jun 17, 2017
|
@bors-servo: try |
Fix several bugs related to scrolling * scrollLeft/scrollTop returned values of parent or even document root Only the scroll of the node itself is returned. Otherwise 0.0. * Scrolling via script had set viewport. This resulted in other nodes appearing scrolled. Now scroll_offsets are updated with correct node id. These bugs caused other odd behavior like both body and document.documentElement being scrolled or the view for scrolled elements jumping. Also try scrolling this [example page](https://pyfisch.org/stuff/scrolltest.html) in servo with and without this change. <!-- 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 #17342 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes (partially) <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17385) <!-- Reviewable:end -->
|
|
|
The tests fail because I modified one web-platform-test to include more checks. Should web platform tests not be changed or do I need to update the manifest? |
|
r? @mrobinson |
|
./mach update-manifest |
|
Thanks. Ran |
| @@ -169897,6 +169897,66 @@ | |||
| {} | |||
| ] | |||
| ], | |||
| "_certs/064162.pem": [ | |||
This comment has been minimized.
This comment has been minimized.
pyfisch
Jun 17, 2017
Author
Contributor
Should these lines really be here? To me they look more like some left-over temporary files.
| ReflowReason::Query) { | ||
| return; | ||
| } | ||
|
|
||
| self.scroll_offsets.borrow_mut().insert(node.to_untrusted_node_address(), |
This comment has been minimized.
This comment has been minimized.
mrobinson
Jun 19, 2017
Member
Currently these scroll offsets come from WebRender. What is the issue here with waiting until WebRender updates the scroll offset map?
This comment has been minimized.
This comment has been minimized.
pyfisch
Jun 19, 2017
Author
Contributor
Webrender does not update the scroll offset map if the change is caused by a Msg::UpdateScrollStateFromScript (per documentation). So the offset map needs to updated in script. The reason I think is that if a script does elem.scrollTop = 42 the next line may be console.log(elem.scrollTop). If there is some message-passing involved the log statement will print wrong information. (Another case where this is important is when a website sets scrollTop and scrollLeft at the same time as done in the tests).
This comment has been minimized.
This comment has been minimized.
mrobinson
Jun 19, 2017
Member
Hrm. The next time that WebRender sends new scroll offsets, the offsets really should reflect this change (otherwise that is a bug, I think). You are right though, that if we query the offsets immediately they won't reflect the new status. That's probably worth writing in a comment there.
This comment has been minimized.
This comment has been minimized.
pyfisch
Jun 19, 2017
Author
Contributor
I don't think it is a bug since it is described. If you scroll with mouse or keyboard the scroll state is updated by webrender. It also takes the changes from the script into account that happened before.
(Setting the offsets from webrender again in this case could be harmful. It may happen that webrender overwrites newer values.)
This comment has been minimized.
This comment has been minimized.
mrobinson
Jun 19, 2017
Member
Changes in scroll position need to be forwarded to WebRender to proper render the scrolled content. WebRender should then return the new offsets, but they won't be available immediately. I'm not sure the documentation touches on this.
This comment has been minimized.
This comment has been minimized.
pyfisch
Jun 19, 2017
Author
Contributor
Yes this is how it is done for normal scrolling with mouse and keyboard. I think the note on the enum member is sufficient but maybe you want to document it other places too or give more details.
| @@ -397231,6 +397291,54 @@ | |||
| "b960bef807da94c0146ed2f537eaa1e05ec9a0ab", | |||
| "testharness" | |||
| ], | |||
| "_certs/064162.pem": [ | |||
This comment has been minimized.
This comment has been minimized.
mrobinson
Jun 19, 2017
Member
The update-manifest script isn't smart enough to ignore files that it shouldn't include, so you'll need to remove all of these extraneous lines manually. Sorry, I find this behavior really annoying too!
This comment has been minimized.
This comment has been minimized.
|
Added a comment and removed lines from manifest. @mrobinson can you please r+? @bors-servo try |
|
|
|
Thanks! This looks good. |
|
@bors-servo r+ |
|
|
|
|
|
|
|
* scrollLeft/scrollTop returned values of parent or even document root Only the scroll of the node itself is returned. Otherwise 0.0. * Scrolling via script had set viewport. This resulted in other nodes appearing scrolled. Now scroll_offsets are updated with correct node id. These bugs caused other odd behavior like both body and document.documentElement being scrolled or the view for scrolled elements jumping.
This is a standards mode document (
These failures are real bugs caused by me removing the line I have updated the pull request to disable the first test and added |
|
Let's file an issue upstream about 003.html in that case. |
|
Filed an issue at web-platform-tests/wpt#6289. |
|
Is there anything still blocking this PR? The broken test is broken in Firefox too so it no servo bug. In Chrome it will work because of a known and soon fixed incompatibility. |
|
@bors-servo r+ |
|
|
|
|
Fix several bugs related to scrolling * scrollLeft/scrollTop returned values of parent or even document root Only the scroll of the node itself is returned. Otherwise 0.0. * Scrolling via script had set viewport. This resulted in other nodes appearing scrolled. Now scroll_offsets are updated with correct node id. These bugs caused other odd behavior like both body and document.documentElement being scrolled or the view for scrolled elements jumping. Also try scrolling this [example page](https://pyfisch.org/stuff/scrolltest.html) in servo with and without this change. <!-- 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 #17342 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes (partially) <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17385) <!-- Reviewable:end -->
|
|
pyfisch commentedJun 17, 2017
•
edited by larsbergstrom
Only the scroll of the node itself is returned. Otherwise 0.0.
This resulted in other nodes appearing scrolled.
Now scroll_offsets are updated with correct node id.
These bugs caused other odd behavior like both body and
document.documentElement being scrolled or the view for scrolled
elements jumping.
Also try scrolling this example page in servo with and without this change.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is