aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2017-05-11 10:13:53 +0200
committerMartin Robinson <mrobinson@igalia.com>2017-05-11 19:20:31 +0200
commitb13cf1150592f900fd83e9abb58b79365af2b108 (patch)
tree6967aedc31bc4ac537c2ee45c634c6abaf621af0 /components/script/dom
parent0040160b38bfef8f4a8c99bf3a0ad85f0b415d4d (diff)
downloadservo-b13cf1150592f900fd83e9abb58b79365af2b108.tar.gz
servo-b13cf1150592f900fd83e9abb58b79365af2b108.zip
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.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/window.rs4
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))