mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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.
This commit is contained in:
parent
0040160b38
commit
b13cf11505
3 changed files with 38 additions and 2 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue