mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 27a904e6348f (bug 990259) for suspicion of causing Android 4.0 robocop-2 permafail.
This commit is contained in:
parent
c18e728b93
commit
f90e7f054f
@ -77,7 +77,7 @@ var FindHelper = {
|
||||
this._targetTab.sendViewportUpdate();
|
||||
}
|
||||
} else {
|
||||
ZoomHelper.zoomToRect(aData.rect);
|
||||
ZoomHelper.zoomToRect(aData.rect, -1, false, true);
|
||||
this._viewportChanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -81,19 +81,22 @@ var ZoomHelper = {
|
||||
*/
|
||||
zoomToElement: function(aElement, aClickY = -1, aCanZoomOut = true, aCanScrollHorizontally = true) {
|
||||
let rect = ElementTouchHelper.getBoundingContentRect(aElement);
|
||||
ZoomHelper.zoomToRect(rect, aClickY, aCanZoomOut, aCanScrollHorizontally);
|
||||
},
|
||||
|
||||
zoomToRect: function(aRect, aClickY = -1, aCanZoomOut = true, aCanScrollHorizontally = true) {
|
||||
const margin = 15;
|
||||
|
||||
if(!rect.h || !rect.w) {
|
||||
rect.h = rect.height;
|
||||
rect.w = rect.width;
|
||||
if(!aRect.h || !aRect.w) {
|
||||
aRect.h = aRect.height;
|
||||
aRect.w = aRect.width;
|
||||
}
|
||||
|
||||
let viewport = BrowserApp.selectedTab.getViewport();
|
||||
let bRect = new Rect(aCanScrollHorizontally ? Math.max(viewport.cssPageLeft, rect.x - margin) : viewport.cssX,
|
||||
rect.y,
|
||||
aCanScrollHorizontally ? rect.w + 2 * margin : viewport.cssWidth,
|
||||
rect.h);
|
||||
let bRect = new Rect(aCanScrollHorizontally ? Math.max(viewport.cssPageLeft, aRect.x - margin) : viewport.cssX,
|
||||
aRect.y,
|
||||
aCanScrollHorizontally ? aRect.w + 2 * margin : viewport.cssWidth,
|
||||
aRect.h);
|
||||
// constrict the rect to the screen's right edge
|
||||
bRect.width = Math.min(bRect.width, viewport.cssPageRight - bRect.x);
|
||||
|
||||
@ -117,18 +120,13 @@ var ZoomHelper = {
|
||||
return;
|
||||
}
|
||||
|
||||
ZoomHelper.zoomToRect(bRect, aClickY);
|
||||
},
|
||||
|
||||
zoomToRect: function(aRect, aClickY = -1) {
|
||||
let viewport = BrowserApp.selectedTab.getViewport();
|
||||
let rect = {};
|
||||
|
||||
rect.type = "Browser:ZoomToRect";
|
||||
rect.x = aRect.x;
|
||||
rect.y = aRect.y;
|
||||
rect.w = aRect.width;
|
||||
rect.h = Math.min(aRect.width * viewport.cssHeight / viewport.cssWidth, aRect.height);
|
||||
rect.x = bRect.x;
|
||||
rect.y = bRect.y;
|
||||
rect.w = bRect.width;
|
||||
rect.h = Math.min(bRect.width * viewport.cssHeight / viewport.cssWidth, bRect.height);
|
||||
|
||||
if (aClickY >= 0) {
|
||||
// if the block we're zooming to is really tall, and we want to keep a particular
|
||||
@ -136,7 +134,7 @@ var ZoomHelper = {
|
||||
// the 1.2 multiplier is just a little fuzz to compensate for bRect including horizontal
|
||||
// margins but not vertical ones.
|
||||
let cssTapY = viewport.cssY + aClickY;
|
||||
if ((aRect.height > rect.h) && (cssTapY > rect.y + (rect.h * 1.2))) {
|
||||
if ((bRect.height > rect.h) && (cssTapY > rect.y + (rect.h * 1.2))) {
|
||||
rect.y = cssTapY - (rect.h / 2);
|
||||
}
|
||||
}
|
||||
@ -147,4 +145,4 @@ var ZoomHelper = {
|
||||
|
||||
sendMessageToJava(rect);
|
||||
},
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user