diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-11 13:23:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-11 13:23:39 -0500 |
commit | e196776c2477f5f204ce1333bd15070afbf9a7f6 (patch) | |
tree | b9b4b1ac3c1ad7b92581797e453d060d7a98301b /components/script | |
parent | f5794055108adf508bb0fd16222c4e5cf1d416d8 (diff) | |
parent | b13cf1150592f900fd83e9abb58b79365af2b108 (diff) | |
download | servo-e196776c2477f5f204ce1333bd15070afbf9a7f6.tar.gz servo-e196776c2477f5f204ce1333bd15070afbf9a7f6.zip |
Auto merge of #16807 - mrobinson:scroll-clamping, r=emilio
Fix clamping of scroll position in window.scrollBy
For rightward and downward overflow the spec says:
Let x be max(0, min(x, viewport scrolling area width - viewport width)).
Let y be max(0, min(y, viewport scrolling area height - viewport height)).
Previously, those operations were reversed, which created negative
overflow even when the overflow direction was downward. This change
ensures that Servo matches spec behavior.
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- 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/16807)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/window.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 6b8857b81b1..a2af04ad1cc 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1066,8 +1066,8 @@ impl Window { let content_size = e.upcast::<Node>().bounding_content_box_or_zero(); let content_height = content_size.size.height.to_f64_px(); let content_width = content_size.size.width.to_f64_px(); - (xfinite.max(0.0f64).min(content_width - width), - yfinite.max(0.0f64).min(content_height - height)) + (xfinite.min(content_width - width).max(0.0f64), + yfinite.min(content_height - height).max(0.0f64)) }, None => { (xfinite.max(0.0f64), yfinite.max(0.0f64)) |