mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 882120 - Apply rounding to the layer-pixel rect in Java to fix robopan regression. r=kentuckyfriedtakahe
This commit is contained in:
parent
7db6856a13
commit
160450aea8
@ -560,10 +560,12 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
|
||||
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
|
||||
RectF pageRect = RectUtils.scaleAndRound(cssPageRect, zoom);
|
||||
|
||||
final ImmutableViewportMetrics newMetrics = currentMetrics
|
||||
.setViewportOrigin(offsetX, offsetY)
|
||||
.setZoomFactor(zoom)
|
||||
.setPageRect(RectUtils.scale(cssPageRect, zoom), cssPageRect)
|
||||
.setPageRect(pageRect, cssPageRect)
|
||||
.setIsRTL(tab.getIsRTL());
|
||||
// Since we have switched to displaying a different document, we need to update any
|
||||
// viewport-related state we have lying around. This includes mGeckoViewport and
|
||||
@ -610,9 +612,10 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
*/
|
||||
public void setPageRect(float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
|
||||
synchronized (getLock()) {
|
||||
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
|
||||
float ourZoom = getViewportMetrics().zoomFactor;
|
||||
setPageRect(RectUtils.scale(cssPageRect, ourZoom), cssPageRect);
|
||||
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
|
||||
RectF pageRect = RectUtils.scaleAndRound(cssPageRect, ourZoom);
|
||||
setPageRect(pageRect, cssPageRect);
|
||||
// Here the page size of the document has changed, but the document being displayed
|
||||
// is still the same. Therefore, we don't need to send anything to browser.js; any
|
||||
// changes we need to make to the display port will get sent the next time we call
|
||||
|
@ -74,6 +74,15 @@ public final class RectUtils {
|
||||
y + (rect.height() * scale));
|
||||
}
|
||||
|
||||
public static RectF scaleAndRound(RectF rect, float scale) {
|
||||
float left = rect.left * scale;
|
||||
float top = rect.top * scale;
|
||||
return new RectF(Math.round(left),
|
||||
Math.round(top),
|
||||
Math.round(left + (rect.width() * scale)),
|
||||
Math.round(top + (rect.height() * scale)));
|
||||
}
|
||||
|
||||
/** Returns the nearest integer rect of the given rect. */
|
||||
public static Rect round(RectF rect) {
|
||||
Rect r = new Rect();
|
||||
|
Loading…
Reference in New Issue
Block a user