зеркало из https://github.com/mozilla/gecko-dev.git
Bug 597036 - Find in page does not display results on screen when page is zoomed [r=mfinkle]
This commit is contained in:
Родитель
eedabd6d0c
Коммит
fe65832775
|
@ -838,6 +838,8 @@
|
|||
]]>
|
||||
</constructor>
|
||||
|
||||
<field name="scrollSync">true</field>
|
||||
|
||||
<field name="_messageListenerRemote"><![CDATA[
|
||||
({
|
||||
self: this,
|
||||
|
@ -847,6 +849,9 @@
|
|||
|
||||
switch (aMessage.name) {
|
||||
case "scroll":
|
||||
if (!this.scrollSync)
|
||||
return;
|
||||
|
||||
// When CSS scroll offset changes, we must redefine our cache viewport because
|
||||
// the cache viewport coordinate system's origin is the CSS scroll offset. Setting
|
||||
// _pendingPixels* guarantees that _updateCacheViewport is called in scrollTo.
|
||||
|
|
|
@ -1682,12 +1682,16 @@ var FindHelperUI = {
|
|||
this._container.show(this);
|
||||
this.search("");
|
||||
this._textbox.focus();
|
||||
|
||||
// Prevent the view to scroll automatically while searching
|
||||
Browser.selectedBrowser.scrollSync = false;
|
||||
},
|
||||
|
||||
hide: function findHelperHide() {
|
||||
this._textbox.value = "";
|
||||
this._textbox.blur();
|
||||
this._container.hide(this);
|
||||
Browser.selectedBrowser.scrollSync = true;
|
||||
},
|
||||
|
||||
goToPrevious: function findHelperGoToPrevious() {
|
||||
|
|
|
@ -897,8 +897,9 @@ var Browser = {
|
|||
|
||||
zoomLevel = tab.clampZoomLevel(zoomLevel);
|
||||
|
||||
let center = browser.transformClientToBrowser(window.innerWidth / 2,
|
||||
window.innerHeight / 2);
|
||||
let browserRect = browser.getBoundingClientRect();
|
||||
let center = browser.transformClientToBrowser(browserRect.width / 2,
|
||||
browserRect.height / 2);
|
||||
let rect = this._getZoomRectForPoint(center.x, center.y, zoomLevel);
|
||||
this.animatedZoomTo(rect);
|
||||
},
|
||||
|
@ -940,7 +941,8 @@ var Browser = {
|
|||
zoomLevel = Math.min(ZoomManager.MAX, zoomLevel);
|
||||
let oldScale = browser.scale;
|
||||
let zoomRatio = zoomLevel / oldScale;
|
||||
let newVisW = window.innerWidth / zoomRatio, newVisH = window.innerHeight / zoomRatio;
|
||||
let browserRect = browser.getBoundingClientRect();
|
||||
let newVisW = browserRect.width / zoomRatio, newVisH = browserRect.height / zoomRatio;
|
||||
let result = new Rect(x - newVisW / 2, y - newVisH / 2, newVisW, newVisH);
|
||||
|
||||
// Make sure rectangle doesn't poke out of viewport
|
||||
|
|
|
@ -907,7 +907,12 @@ var FindHandler = {
|
|||
|
||||
let rangeRect = selection.getRangeAt(0).getBoundingClientRect();
|
||||
let rect = new Rect(scroll.x + rangeRect.left, scroll.y + rangeRect.top, rangeRect.width, rangeRect.height);
|
||||
sendAsyncMessage("FindAssist:Show", { rect: rect.isEmpty() ? null: rect , result: findResult });
|
||||
|
||||
// Ensure the potential "scroll" event fired during a search as already fired
|
||||
let timer = new Util.Timeout(function() {
|
||||
sendAsyncMessage("FindAssist:Show", { rect: rect.isEmpty() ? null: rect , result: findResult });
|
||||
});
|
||||
timer.once(0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче