mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1120244 - Prevent viewport bounds from going outside the page bounds. r=snorp
In Fennec, we display the dynamic toolbar once we have scrolled to the bottom of the page. In this configuration, animating in the toolbar should increase the top margin in the ImmutableViewportMetrics without affecting the viewportRect[Top|Bottom], because otherwise the scroll position would exceed the maximum allowed scroll position and the bottom of the viewport would go past the end of the page. This patch corrects the calculation used to enforce this.
This commit is contained in:
parent
96e1d10dee
commit
f48835a421
@ -233,12 +233,12 @@ public class ImmutableViewportMetrics {
|
||||
public ImmutableViewportMetrics offsetViewportByAndClamp(float dx, float dy) {
|
||||
if (isRTL) {
|
||||
return setViewportOrigin(
|
||||
Math.min(pageRectRight - getWidthWithoutMargins(), Math.max(viewportRectLeft + dx, pageRectLeft)),
|
||||
Math.max(pageRectTop, Math.min(viewportRectTop + dy, pageRectBottom - getHeightWithoutMargins())));
|
||||
Math.min(pageRectRight - getWidth(), Math.max(viewportRectLeft + dx, pageRectLeft)),
|
||||
Math.max(pageRectTop, Math.min(viewportRectTop + dy, pageRectBottom - getHeight())));
|
||||
}
|
||||
return setViewportOrigin(
|
||||
Math.max(pageRectLeft, Math.min(viewportRectLeft + dx, pageRectRight - getWidthWithoutMargins())),
|
||||
Math.max(pageRectTop, Math.min(viewportRectTop + dy, pageRectBottom - getHeightWithoutMargins())));
|
||||
Math.max(pageRectLeft, Math.min(viewportRectLeft + dx, pageRectRight - getWidth())),
|
||||
Math.max(pageRectTop, Math.min(viewportRectTop + dy, pageRectBottom - getHeight())));
|
||||
}
|
||||
|
||||
public ImmutableViewportMetrics setPageRect(RectF pageRect, RectF cssPageRect) {
|
||||
|
Loading…
Reference in New Issue
Block a user