Closed Bug 597210 Opened 9 years ago Closed 9 years ago

Multitouch: page jumps when zooming out to full page width on a mobile-friendly page


(Firefox for Android Graveyard :: Panning/Zooming, defect)

Not set



Tracking Status
fennec 2.0b1+ ---


(Reporter: aakashd, Assigned: mbrubeck)




(1 file, 1 obsolete file)

Build Id:
Mozilla/5.0 (Android; Linux armv71; rv:2.0b6pre) Gecko/20100916 Namoroka/4.0b7pre Fennec/2.0b1pre

Steps to Reproduce:
1. Go to
2. Try to zoom out

Actual Results:
The page will jump to the right and half of the screen (left-side) will be gray for a split second during the zoom phase.

Expected Results:
The page shouldn't jump during the middle of zoom out.
This seems to happen whenever you start a pinch gesture while already zoomed in a ways *and* already panned away from the left edge of the page.
Assignee: nobody → mbrubeck
This should maybe block beta.  If you are zoomed in close, near the bottom right of a page, pinch zooming is totally broken - you jump to a completely different area of the page.
tracking-fennec: --- → ?
Attached patch patch (obsolete) — Splinter Review
This should fix all jumps during panning.

Rather than an incremental patch, this completely replaces the zoomrect calculation.  Rather than use _getZoomRectForPoint, the new pinch zoom code always starts with the initial visible rect, and transforms it based on the gesture movements.

This also fixes a slightly-related bug in _getZoomRectForPoint where double-tapping near the right or bottom edge of the page would animate incorrectly.
Attachment #476254 - Flags: review?(mark.finkle)
Attached patch patchSplinter Review
uploaded the wrong version
Attachment #476254 - Attachment is obsolete: true
Attachment #476257 - Flags: review?(mark.finkle)
Attachment #476254 - Flags: review?(mark.finkle)
tracking-fennec: ? → 2.0b1+
Duplicate of this bug: 597090
Comment on attachment 476257 [details] [diff] [review]

>diff -r 920af3b32bd2 chrome/content/AnimatedZoom.js

>+  getStartRect: function getStartRect() {
>+    let browserRect = Rect.fromRect(getBrowser().getBoundingClientRect());
>+    let scroll = getBrowser().getPosition();
>+    return browserRect.translate(scroll.x, scroll.y);
>+  },

Local for getBrowser() ?

>diff -r 920af3b32bd2 chrome/content/InputHandler.js

Stover bitrotted you in this file for sure

>diff -r 920af3b32bd2 chrome/content/browser.js

>   _getZoomRectForPoint: function _getZoomRectForPoint(x, y, zoomLevel) {
>     x = x * getBrowser().scale;
>     y = y * getBrowser().scale;
>     zoomLevel = Math.min(ZoomManager.MAX, zoomLevel);
>-    let zoomRatio = zoomLevel / getBrowser().scale;
>+    let oldScale = getBrowser().scale;
>+    let zoomRatio = zoomLevel / oldScale;
>     let newVisW = window.innerWidth / zoomRatio, newVisH = window.innerHeight / zoomRatio;
>     let result = new Rect(x - newVisW / 2, y - newVisH / 2, newVisW, newVisH);
>     // Make sure rectangle doesn't poke out of viewport
>-    return result.translateInside(new Rect(0, 0, getBrowser().contentDocumentWidth, getBrowser().contentDocumentHeight));
>+    return result.translateInside(new Rect(0, 0, getBrowser().contentDocumentWidth * oldScale,
>+                                                 getBrowser().contentDocumentHeight * oldScale));

Local for getBrowser()
Attachment #476257 - Flags: review?(mark.finkle) → review+
(In reply to comment #6)
> Local for getBrowser() ?


> >diff -r 920af3b32bd2 chrome/content/InputHandler.js
> Stover bitrotted you in this file for sure

Not if I bitrot him first!  >:)

> Local for getBrowser()

Done, and pushed:
Closed: 9 years ago
Resolution: --- → FIXED
verified FIXED on builds:
Mozilla/5.0 (Android; Linux armv71; rv:2.0b6pre) Gecko/20100920 Namoroka/4.0b7pre Fennec/2.0b1pre
You need to log in before you can comment on or make changes to this bug.