Closed Bug 1046631 Opened 10 years ago Closed 10 years ago

Zoom level changes on some mobile sites on pressing the back button

Categories

(Firefox for Android Graveyard :: Toolbar, defect)

32 Branch
ARM
Android
defect
Not set
normal

Tracking

(firefox32+ verified, firefox33+ verified, firefox34 verified, fennec32+)

VERIFIED FIXED
Firefox 34
Tracking Status
firefox32 + verified
firefox33 + verified
firefox34 --- verified
fennec 32+ ---

People

(Reporter: adriftr+bID, Assigned: esawin)

References

Details

(Keywords: regression, reproducible, testcase)

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 (Beta/Release) Build ID: 20140731061946 Steps to reproduce: 1. Open Firefox Beta for Android 2. Go to http://m.dw.de/english 3. Click on any article link to go to the article 4. Click the back button to go to the main dw.de page Actual results: 1. The mobile site http://m.dw.de/english is zoomable using pinch-to-zoom. 2. After going back to the main page in step 4, the main page is zoomed-in a lot; you have to zoom out fully using pinch-to-zoom to reset it. Screenshots: https://imgur.com/a/Wi9B6 Expected results: 1. The mobile site http://m.dw.de/english should not have been zoomable[#] using pinch-to-zoom. 2. After going back to the main page in step 4, the original zoom level should have persisted. [#] Note: I am not a developer or a UX expert, but I have read that by convention, pinch-to-zoom is (should be?) disabled on mobile-optimized sites. I don't know whether this is done at the browser level or the site-level.
Component: General → Graphics, Panning and Zooming
OS: Linux → Android
Hardware: x86_64 → ARM
I can reproduce on nightly as well. The page being zoomable is fine because that is specified at the website level and this site chose to make themselves zoomable. However the zoom shouldn't change when going back. Eugen, is this a known issue?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(esawin)
It's not reproducing on Fennec 31, here I am hitting bug 1003800 instead. It is reproducing consistently on Fennec 32+. It could be a regression on bug 1002426, I can check for that next week.
Flags: needinfo?(esawin)
tracking-fennec: --- → ?
Assignee: nobody → esawin
tracking-fennec: ? → 32+
Status: NEW → ASSIGNED
It's a regression caused by bug 1003962. Line http://dxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#4263 sets |browserWidth| to the default browser width, which is then used in http://dxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#4475 to compute the wrong |zoomScale|. Here's a comment from bug 1003962. > This code is has been a source of problems like this for a while. In this > case I *think* the right solution might be to call > > this.setBrowserSize(kDefaultCSSViewportWidth, kDefaultCSSViewportHeight); > > inside this block: > > http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/ > browser.js?rev=5be519918f65#4155 > > I suspect that will fix this problem but I have no idea if it will break > other things. So this seems to something that it breaks. I could find a workaround for this, or we find a safer solution for the original issue. What do you think, Kats?
Flags: needinfo?(bugmail.mozilla)
Keywords: regression
I don't think it should be going into that block at all when you hit 'back'. |zoom && aInitialLoad| should be true, and it should skip over that block, I think. Mostly likely it's getting called with aInitialLoad=false, do you know from where?
Flags: needinfo?(bugmail.mozilla) → needinfo?(esawin)
We do call |updateViewportSize| with |aInitialLoad=false| for each page load, but that's not what is causing the regression, I think. What I see happening, is that we update the zoom by multiplying it with a wrong zoom scale right after clicking on a link and before loading the linked page. That wrongly assigned zoom is being saved for the session and loaded when going back. Here is what happens in more detail (portrait mode on Nexus 7, (*) shows the value has been regressed). A. Initial page load (http://m.dw.de): 1. DOMMetaAdded -> updateMetadata -> updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = false oldBrowserWidth = 980 (*) zoomScale = 1.53 (*) viewportW = 640 restoredSessionZoom() = null metadata.defaultZoom = undefined/null/0 2. setResolution: 1.22 -> 1.88 3. before-first-paint: restoredSessionZoom() = null zoom = 1.22 4. setResolution: 1.88 -> 1.22 5. updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = true oldBrowserWidth = 980 (*) zoomScale = 1.53 (*) viewportW = 640 restoredSessionZoom() = null metadata.defaultZoom = undefined/null/0 6. setResolution: 1.22 -> 1.88 B. Clicking on an article link: 1. DOMMetaAdded -> updateMetadata -> updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = false oldBrowserWidth = 980 (*) zoomScale = 1.53 (*) viewportW = 640 restoredSessionZoom() = null metadata.defaultZoom = undefined/null/0 2. setResolution: 1.88 -> 2.87 3. before-first-paint: restoredSessionZoom() = null zoom = 1.22 4. setResolution: 2.87 -> 1.22 5. updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = true oldBrowserWidth = 980 (*) zoomScale = 1.53 (*) viewportW = 640 restoredSessionZoom() = null metadata.defaultZoom = undefined/null/0 6. setResolution: 1.22 -> 1.88 C. Clicking back button: 1. DOMMetaAdded -> updateMetadata -> updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = false oldBrowserWidth = 980 (*) zoomScale = 1.53 (*) viewportW = 640 restoredSessionZoom() = null metadata.defaultZoom = undefined/null/0 2. setResolution: 1.88 -> 2.87 3. before-first-paint: restoredSessionZoom() = 2.87 zoom = 2.87 4. setResolution: 2.87 -> 2.87 5. updateViewportMetadata -> updateViewportSize: aOldScreenWidth = 1200 aInitialLoad = true restoredSessionZoom() = 2.87 6. setResolution: 2.87 -> 2.87
Flags: needinfo?(esawin)
Nice description, thanks! A couple of things: (1) It looks like the DOMMetaAdded for a page is getting fired before the first-paint stuff. That seems unexpected, and might be the "root" cause here. (2) The restoredSessionZoom() that returns 2.87 (second-last line in comment 5) - when does that zoom get saved? Is it between C1 and C2? If my theory is correct then when we get the DOMMetaAdded event, we should only process it if BrowserApp.isBrowserContentDocumentDisplayed() is true. That way in the cases where we get the DOMMetaAdded before the first-paint (A1, B1, and C1 in your flow) we will just ignore it and do nothing. The correct zoom will be set as part of A5, B5, and C5. It looks like all of A1, B1, and C1 set a wrong zoom value anyway which we shouldn't be doing. Does that make sense?
> A couple of things: (1) It looks like the DOMMetaAdded for a page is getting > fired before the first-paint stuff. That seems unexpected, and might be the > "root" cause here. I haven't paid much attention to this fact, since this has been the case for the past few months (at least) and it didn't seem to cause other issues yet. > (2) The restoredSessionZoom() that returns 2.87 > (second-last line in comment 5) - when does that zoom get saved? Is it > between C1 and C2? From what I could read from the debug output, it is being set in B2; so *after* clicking on the link, but before the before-first-paint handling. > If my theory is correct then when we get the DOMMetaAdded event, we should > only process it if BrowserApp.isBrowserContentDocumentDisplayed() is true. > That way in the cases where we get the DOMMetaAdded before the first-paint > (A1, B1, and C1 in your flow) we will just ignore it and do nothing. The > correct zoom will be set as part of A5, B5, and C5. It looks like all of A1, > B1, and C1 set a wrong zoom value anyway which we shouldn't be doing. > > Does that make sense? That sounds good and does indeed fix the issue, I will test it some more to see if it breaks anything else. However, I'm still uneasy about oldBrowserWidth always holding the default width value because of bug 1003962. Is that expected behavior?
Yeah I think that is expected. oldBrowserWidth is supposed to only matter for changes in size/CSS viewport after the initial page load. So for example if you load a page and rotate the device, the oldBrowserWidth helps compute the new zoom that we should display the content at after rotation. For the initial stages of page load oldBrowserWidth should not be carrying over random values from the previous page, and bug 1003962 makes that happen.
Attached patch Fix meta data update (obsolete) — Splinter Review
Attachment #8471585 - Flags: review?(bugmail.mozilla)
Comment on attachment 8471585 [details] [diff] [review] Fix meta data update Review of attachment 8471585 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the change below. Also please change the commit message, it's not very descriptive of the patch. Something more like "Don't process meta-viewport tags from a new page load before displaying the new page" ::: mobile/android/chrome/content/browser.js @@ +6201,5 @@ > break; > let document = target.ownerDocument; > let browser = BrowserApp.getBrowserForDocument(document); > let tab = BrowserApp.getTabForBrowser(browser); > + if (tab && BrowserApp.isBrowserContentDocumentLoaded()) Actually since we have the tab here already we can just do tab.contentDocumentIsDisplayed instead of BrowserApp.isBrowserContentDocumentLoaded()
Attachment #8471585 - Flags: review?(bugmail.mozilla) → review+
Attached patch Fix meta data update (obsolete) — Splinter Review
Attachment #8471585 - Attachment is obsolete: true
Attachment #8471780 - Flags: review+
Comment on attachment 8471780 [details] [diff] [review] Fix meta data update Review of attachment 8471780 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/chrome/content/browser.js @@ +6201,5 @@ > break; > let document = target.ownerDocument; > let browser = BrowserApp.getBrowserForDocument(document); > let tab = BrowserApp.getTabForBrowser(browser); > + if (tab && tab.contentDocumentIsDisplayed()) It's not a function
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #12) > Comment on attachment 8471780 [details] [diff] [review] > Fix meta data update > > Review of attachment 8471780 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: mobile/android/chrome/content/browser.js > @@ +6201,5 @@ > > break; > > let document = target.ownerDocument; > > let browser = BrowserApp.getBrowserForDocument(document); > > let tab = BrowserApp.getTabForBrowser(browser); > > + if (tab && tab.contentDocumentIsDisplayed()) > > It's not a function Oh wow, thanks for catching that.
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 34
[Tracking Requested - why for this release]: noticeable regression Eugen we only have 2 more betas before 32 goes out the door. Would you request approval aurora and beta on this patch? Else explain why we should not uplift it.e
Flags: needinfo?(esawin)
Verified as fixed in build: Firefox for Android 34.0a1 (2014-08-17) Device: Samsung S3 (Android 4.3)
tracking+ for 32 and 33 as this is a visible regression. Eugen - This has been on m-c for 4 days. Can you nom for beta and aurora today so that we can get this into beta8?
We can still get this into beta10 on Monday. Eugen, can I get an approval request?
Comment on attachment 8471811 [details] [diff] [review] Fix meta data update Sorry: Eugen has been on PTO. Approval Request Comment [Feature/regressing bug #]: bug 1003962 [User impact if declined]: Bad zooming behavior [Describe test coverage new/current, TBPL]: Several days on m-c and a verification [Risks and why]: moderate risks given the area of code, but no regression have been filed yet after a week or so of Nightly usage. [String/UUID change made/needed]: none
Attachment #8471811 - Flags: approval-mozilla-beta?
Attachment #8471811 - Flags: approval-mozilla-aurora?
Flags: needinfo?(esawin)
Comment on attachment 8471811 [details] [diff] [review] Fix meta data update Thanks Mark. Approved for Aurora and Beta. This fix will be in 32 beta10.
Attachment #8471811 - Flags: approval-mozilla-beta?
Attachment #8471811 - Flags: approval-mozilla-beta+
Attachment #8471811 - Flags: approval-mozilla-aurora?
Attachment #8471811 - Flags: approval-mozilla-aurora+
Thanks Mark! I'll make sure to update my profile name on my next PTO.
Status: RESOLVED → VERIFIED
Flags: qe-verify-
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: