Closed Bug 942799 Opened 11 years ago Closed 11 years ago

<meta name="viewport" content="height=device-height"> is not respected on B2G

Categories

(Core :: Panning and Zooming, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: vingtetun, Assigned: botond)

References

Details

Attachments

(1 file, 2 obsolete files)

I tried to set <meta name="viewport" content="device-heigth, width=device-width, initial-scale=1, user-scalable=no"> as the default viewport for Gaia apps in order to not have too much things to change in their CSS stylesheets to have them working with APZ but it seems like device-height does not work because the viewport height is altered at http://mxr.mozilla.org/mozilla-central/source/dom/ipc/TabChild.cpp#613 For the settings apps minScale.scale == 0.5 and so the height normally expected with device-height is 460px, but it ends up beeing 920px. One work around is to add minimum-scale=1 in the initial viewport.
Botond, based on https://bugzilla.mozilla.org/show_bug.cgi?id=940691#c23 could it means that device-height is correctly honored and we really need to add minimum-scale=1, the bug here coming from the layout of Gaia apps ?
Flags: needinfo?(botond)
Matt, do you know?
Flags: needinfo?(mbrubeck)
The problem is caused by logic that we added in bug 614353 to increase the viewport height if necessary to allow zooming out to the page width. This logic violates the spec (which didn't exist at the time) and I think we should remove it. According to the CSS device-adaptation spec, if width is set to "device-width" and "height" is either unspecified or set to "device-height", then the height should be equal to the device height.
Flags: needinfo?(mbrubeck)
Let's use this bug for the fix.
Flags: needinfo?(botond)
Attached patch bug942799.patch (obsolete) — Splinter Review
Here's a patch that removes the expanding of the viewport height if user-scalable=no as Chris suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=940691#c34. I'd like some feedback on the following: - Is the condition under which we expand the viewport height appropriate? - Should we be changing some other piece of code so that if we don't expand the viewport height, the minimum zoom is clamped to be no smaller than (screen height / page height)? In TabChild::HandlePossibleViewportChange() we don't use the computed 'minScale' for anything other than determining the viewport height, so I'm guessing that not being able to zoom out any further than that is enforced somewhere else?
Assignee: nobody → botond
Attachment #8339487 - Flags: feedback?(mbrubeck)
Attachment #8339487 - Flags: feedback?(chrislord.net)
Blocks: 940691
Attached patch bug942799.patch (obsolete) — Splinter Review
Whoops, posted wrong patch by accident.
Attachment #8339487 - Attachment is obsolete: true
Attachment #8339487 - Flags: feedback?(mbrubeck)
Attachment #8339487 - Flags: feedback?(chrislord.net)
Attachment #8339492 - Flags: feedback?(mbrubeck)
Attachment #8339492 - Flags: feedback?(chrislord.net)
Comment on attachment 8339492 [details] [diff] [review] bug942799.patch Review of attachment 8339492 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/ipc/TabChild.cpp @@ +611,5 @@ > + // out) if the viewport tag doesn't specify user-scalable=no. This is because > + // this adjustment can increase the CSS viewport height beyond the screen > + // height, which means some content will be off-screen, and if we can't > + // zoom out we can't bring that content into view. > + if (viewportInfo.IsZoomAllowed()) { I don't think we should keep this logic even in the user-scalable=yes case. The constraining procedure described in the spec does not depend on the user-zoom (user-scalable) property. I think we can just remove this code completely. And the corresponding code in Fennec: http://hg.mozilla.org/mozilla-central/file/6ecf0c4dfcbe/mobile/android/chrome/content/browser.js#l4026 (In reply to Botond Ballo [:botond] from comment #5) > - Should we be changing some other piece of code so that if we don't expand > the viewport height, the minimum zoom is clamped to be no smaller than > (screen height / page height)? In TabChild::HandlePossibleViewportChange() > we don't use the computed 'minScale' for anything other than determining > the viewport height, so I'm guessing that not being able to zoom out any > further than that is enforced somewhere else? Yes, it looks like this is enforced here, and it already handles both height-limited and width-limited cases correctly (no changes needed): http://hg.mozilla.org/mozilla-central/file/5eb1c89fc2bc/gfx/layers/ipc/AsyncPanZoomController.cpp#l692
Attachment #8339492 - Flags: feedback?(mbrubeck) → feedback-
Comment on attachment 8339492 [details] [diff] [review] bug942799.patch Removing f? for now, I think mbrubeck's feedback is more relevant than mine.
Attachment #8339492 - Flags: feedback?(chrislord.net)
Attached patch bug942799.patchSplinter Review
Attachment #8339492 - Attachment is obsolete: true
Attachment #8340068 - Flags: review?(mbrubeck)
(In reply to Matt Brubeck (:mbrubeck) from comment #7) > I think we can just remove this code completely. And the corresponding code > in Fennec: > http://hg.mozilla.org/mozilla-central/file/6ecf0c4dfcbe/mobile/android/ > chrome/content/browser.js#l4026 Filed bug 944479 for Fennec.
Comment on attachment 8340068 [details] [diff] [review] bug942799.patch Review of attachment 8340068 [details] [diff] [review]: ----------------------------------------------------------------- Note that I'm not an official peer of this code (though I wrote the original JS code it was ported from), so you may want to get a DOM or B2G peer to sign off on this too.
Attachment #8340068 - Flags: review?(mbrubeck) → review+
Comment on attachment 8340068 [details] [diff] [review] bug942799.patch Flagging for additional review as per Matt's suggestion.
Attachment #8340068 - Flags: review+ → review?(jonas)
(In reply to Botond Ballo [:botond] from comment #10) > Try push: https://tbpl.mozilla.org/?tree=Try&rev=5bfc89f30d2b Looks clean.
Attachment #8340068 - Flags: review?(jonas) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: