Closed Bug 1336330 Opened 3 years ago Closed Last year

[viewport] initial-scale=0.5 is treated differently in Chrome and Firefox

Categories

(Core :: Panning and Zooming, defect, P3)

54 Branch
All
Android
defect

Tracking

()

RESOLVED DUPLICATE of bug 1494422
Tracking Status
firefox54 --- affected

People

(Reporter: karlcow, Unassigned)

References

()

Details

(Whiteboard: [webcompat][gfx-noted])

Attachments

(2 files)

(change the product/component adequately if I missed something)

This issue is part of a couple of tests, I'm doing comparing Firefox Android and Chrome Android for layout differences wrt viewport values.
The tests are available at http://la-grange.net/2016/12/01/viewport/

Test 0002 - <name="viewport" content="initial-scale=0.5">
http://la-grange.net/2016/12/01/viewport/viewport-test-0002.html

* Chrome take the 360px screen size and double it to 720px which is basically the initial scale 0.5. But doing that it also increases the size of the font so it's still readable.

* Firefox makes the width: 980px (not sure why) and the font is tiny and not readable.
* Firefox test-0002-fx54.0a1.20170201-and4.4.4.png
* Chrome  test-0002-chr55.02883.91-and4.4.4.png
Whiteboard: [webcompat]
Component: Graphics, Panning and Zooming → Panning and Zooming
Product: Firefox for Android → Core
OS: Unspecified → Android
Priority: -- → P3
Hardware: Unspecified → All
Whiteboard: [webcompat] → [webcompat][gfx-noted]
(In reply to Karl Dubost :karlcow from comment #0)
> * Chrome take the 360px screen size and double it to 720px which is
> basically the initial scale 0.5.
> 
> * Firefox makes the width: 980px (not sure why)

The 980px are because Firefox seems to be treating the document as a "desktop" page and that's the default viewport width (see browser.viewport.desktopWidth in about:config) used for rendering desktop pages. If I'm reading this code (https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/dom/base/nsDocument.cpp#7566) right, then in absence of an explicit width or height specification, that's what we use (https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/dom/base/nsDocument.cpp#7755) unless the document is detected as mobile friendly, which we do by looking for "width=device-width", "height=device-height" or "initial-scale=1.0" (https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/dom/base/nsDocument.cpp#7688).

That doesn't explain what you're seeing in the "initial-scale=0.1" case, though.

> But doing that it [Chrome] also increases the size
> of the font so it's still readable. [...]
> and [in Firefox] the font is tiny and not
> readable.

That's almost certainly because on desktop pages, Chrome is using font inflation by default to bump up the font size of the main content [1] back up to a readable value. We used to do this, too, but it's been turned off by default now. You can re-enable it for comparison using the Font Size option in Firefox's Accessibility settings by changing the setting to something other than Very Tiny (the old default was Medium).
Strangely enough though, this only works for the initial-scale=0.1 example and fails for initial-scale=0.5.

[1] Or at least what the font inflation algorithm presumes to be the main content.
See Also: → 1336334
This seems to be a dup of bug 1494422?
Confirmed that the test case in comment 0 works fine with 'extend-to-zoom'.
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → DUPLICATE
Duplicate of bug: 1494422
You need to log in before you can comment on or make changes to this bug.