Closed Bug 1550105 Opened 5 years ago Closed 5 years ago

Negative values in meta viewport result in different initial viewports on Firefox and Chrome

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Webcompat Priority ?
Tracking Status
firefox-esr68 69+ fixed
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: twisniewski, Assigned: hiro)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [webcompat])

Attachments

(1 file)

For instance, using this:

<meta name="viewport" content="width=device-width, initial-scale=-1, maximum-scale=-1">

Causes Firefox and Chrome to show different initial viewports, as seen on kpn.portal.fon.com.

As per the device adaptation spec, negative values should be treated as if it's not specified, but we don't.

https://www.w3.org/TR/css-device-adapt-1/#min-scale-max-scale

Priority: -- → P3
Webcompat Priority: --- → ?

The relevant definition in the spec;
https://drafts.csswg.org/css-device-adapt/#min-scale-max-scale

Before this change, if both of initial-scale and maximum-scale are negative,
both values are clamped to 0.25. Whereas with this change, negative scale
values are treated as if it's not specified so that initial-scale value is
automatically calculated based on the layout viewport size.
negative-initial-and-maximum-scale.html is a test case for the case.

Also with this change, initial-scale values are going to be clamped to the
range [0.1, 10] during parsing it as the spec says so that
initial-scale-100.html needs to be modified, now the test is scaled by 10x.
(Before this change, initial-scale=100 was treated as a invalid scale value
in nsViewportInfo::ConstrainViewportValues[1])

[1] https://searchfox.org/mozilla-central/rev/6c9f60f8cc064a1005cd8141ecd526578ae9da7a/dom/base/nsViewportInfo.cpp#15

Pushed by hikezoe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4cd6d838796a Implement the parser for scale values in viewport meta tag as what the spec defines. r=botond
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

This fixed at least a couple of webcompat issues reported against Fennec. Could we ask for a 68 uplift so the fix reaches Fennec users? (Fennec is transitioning to 68 ESR, so a fix on the 69 branch would not reach Fennec users.)

Flags: needinfo?(hikezoe)

Comment on attachment 9066616 [details]
Bug 1550105 - Implement the parser for scale values in viewport meta tag as what the spec defines. r?botond

Beta/Release Uplift Approval Request

  • User impact if declined: Some kind of sites are not rendered properly on both on Mobile Firefox and on Responsive Design Mode in devtools
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): One caveat about this patch is that the patch changes initial-scale calculation (i.e. auto scaling to fit the content to the screen size) and the change is not compatible with prior versions of Mobile Firefox, so if there were sites that are optimized only for Mobile Firefox, the site will be broken to some extent, but I believe the change is the right thing to do because it's exactly what the spec defines, what Chome does actually.
  • String changes made/needed: None
Flags: needinfo?(hikezoe)
Attachment #9066616 - Flags: approval-mozilla-beta?

(In reply to Botond Ballo [:botond] from comment #7)

This fixed at least a couple of webcompat issues reported against Fennec. Could we ask for a 68 uplift so the fix reaches Fennec users? (Fennec is transitioning to 68 ESR, so a fix on the 69 branch would not reach Fennec users.)

Yeah, indeed. We should. I did forget about ESR. Thanks for suggestion!

I'm tempted to punt right now but keep this on the radar for the 68.1 cycle. Leaving the uplift request as-is until we have esr68 flags in bugzilla.

Comment on attachment 9066616 [details]
Bug 1550105 - Implement the parser for scale values in viewport meta tag as what the spec defines. r?botond

see comment 8

Attachment #9066616 - Flags: approval-mozilla-esr68?
Attachment #9066616 - Flags: approval-mozilla-beta?
Attachment #9066616 - Flags: approval-mozilla-beta-

Comment on attachment 9066616 [details]
Bug 1550105 - Implement the parser for scale values in viewport meta tag as what the spec defines. r?botond

Fixes a mobile web compat issue. Approved for 68.1esr and Fennec 68.1b1.

Attachment #9066616 - Flags: approval-mozilla-esr68? → approval-mozilla-esr68+

Thank you!

Flags: qe-verify-
Regressions: 1573648
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: