Closed
Bug 1431601
Opened 7 years ago
Closed 6 years ago
[viewport] maximum-scale = 0 in meta viewport makes the viewport awfully wide
Categories
(Core :: Panning and Zooming, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla64
Tracking | Status | |
---|---|---|
firefox64 | --- | fixed |
People
(Reporter: karlcow, Assigned: hiro)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [webcompat][gfx-noted])
Attachments
(7 files)
(deleted),
image/png
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
This is a spin-off of https://webcompat.com/issues/14888
STR:
1. Go to https://www.looopings.nl/
Actual:
Enjoy a very very wide website
Expected:
The site fits the screen like in Chrome.
Why this is happening:
The site contains the line
<meta name="viewport" content="width = device-width, initial-scale = 1, minimum-scale = 1, maximum-scale = 0">
maximum-scale = 0 is putting the layout completely off.
Updated•7 years ago
|
Component: Layout: View Rendering → Panning and Zooming
Updated•7 years ago
|
Summary: maximum-scale = 0 in meta viewport makes the viewport awfully wide → [viewport] maximum-scale = 0 in meta viewport makes the viewport awfully wide
Whiteboard: [webcompat] → [webcompat][gfx-noted]
Reporter | ||
Updated•7 years ago
|
Blocks: viewport-compat
Assignee | ||
Comment 1•6 years ago
|
||
I think this bug will be solved by implementing "Resolve min-zoom and max-zoom values" [1] in the spec.
[1] https://drafts.csswg.org/css-device-adapt/#constraining-min-max-zoom
Assignee: nobody → hikezoe
Status: NEW → ASSIGNED
Reporter | ||
Comment 2•6 years ago
|
||
Interesting just happens to have a new issue with this.
Reporter | ||
Updated•6 years ago
|
See Also: → https://webcompat.com/issues/19179
Reporter | ||
Comment 3•6 years ago
|
||
(In reply to Karl Dubost :karlcow from comment #2)
> Interesting just happens to have a new issue with this.
So something interesting also with this issue
https://webcompat.com/issues/19179
On responsive design mode (RDM) with Firefox Android UA and 360x640 window, we get a wide layout too, even if **meta viewport** is not supposed to be interpreted by RDM. but if we just go out of the RDM, and not reloading (so the mobile layout), we get a layout working even when resizing the window.
Comment 4•6 years ago
|
||
(In reply to Karl Dubost :karlcow from comment #3)
> On responsive design mode (RDM) with Firefox Android UA and 360x640 window,
> we get a wide layout too, even if **meta viewport** is not supposed to be
> interpreted by RDM. but if we just go out of the RDM, and not reloading (so
> the mobile layout), we get a layout working even when resizing the window.
Note that as of a few days ago (bug 1290420), RDM noew respects meta viewport.
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Here are two screenshots of the site with adding below meta tag in comment 0 (because the site has already dropped the meta tag).
<meta name="viewport" content="width = device-width, initial-scale = 1, minimum-scale = 1, maximum-scale = 0">
Left side is the result of current m-c, right one is the result of the binary in the try. The too wide content is actually being mitigated by the "Resolve min-zoom and max-zoom values" to some extent, but sill wider than Chrome. I think it is because of bug 1423709 and other bugs. Anyway I am going to fix one by one.
Assignee | ||
Comment 7•6 years ago
|
||
Assignee | ||
Comment 8•6 years ago
|
||
nsContentUtils::GetViewportInfo was removed and the comment for the function
was moved to nsIDocument::GetViewportInfo in
https://hg.mozilla.org/mozilla-central/rev/37d64688bf9d
Depends on D8316
Assignee | ||
Comment 9•6 years ago
|
||
Depends on D8317
Assignee | ||
Comment 10•6 years ago
|
||
Depends on D8318
Assignee | ||
Comment 11•6 years ago
|
||
Depends on D8319
Assignee | ||
Comment 12•6 years ago
|
||
https://drafts.csswg.org/css-device-adapt/#constraining-min-max-zoom
The test case in this commit fails without this change, width will be 8000 and
height will be 4800 respectively when it fails.
Depends on D8320
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 13•6 years ago
|
||
For the reference (and requested by Botond in review), I should have noted what happened when 'maximum-scale=0' is specified along with initial-scale=1.
1. https://hg.mozilla.org/mozilla-central/file/87b544fc71d5/dom/base/nsDocument.cpp#l7327
mScaleMaxFloat = mozilla::clamped(
mScaleMaxFloat, kViewportMinScale, kViewportMaxScale);
Here, the maximum-scale=0 is clamped to kViewportMinScale which is 0.1.
2. https://hg.mozilla.org/mozilla-central/file/87b544fc71d5/dom/base/nsDocument.cpp#l7452
if (mValidScaleFloat && scaleFloat >= scaleMinFloat && scaleFloat <= scaleMaxFloat) {
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleFloat;
size.width = std::max(size.width, displaySize.width);
size.height = std::max(size.height, displaySize.height);
} else if (effectiveValidMaxScale) {
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleMaxFloat;
size.width = std::max(size.width, displaySize.width);
size.height = std::max(size.height, displaySize.height);
}
Here, |scaleMaxFloat| is 0.1, thus we fails the first if check then effectiveValidMaxScale is true since we have a valid maximum-scale even if it's clamed, so we divide the screen size by |scaleMaxFloat|, which means the viewport size is 10 times bigger than the screen size. And of course, unfortunately there is 'initial-scale=1'.
Comment 14•6 years ago
|
||
Pushed by hikezoe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ecc77355ba3e
Align boolean member in nsViewportInfo. r=botond
https://hg.mozilla.org/integration/autoland/rev/930561bbe55d
Fix the comment for nsIDOMWindowUtils.getViewportInfo. r=botond
https://hg.mozilla.org/integration/autoland/rev/4a79571c40a0
Move getViewportInfo function into viewport_helpers.js. r=botond
https://hg.mozilla.org/integration/autoland/rev/d455d8d93e2c
Rewrite test_meta_viewportX.html with add_task. r=botond
https://hg.mozilla.org/integration/autoland/rev/02de107cdac4
Run meta viewport tests on Desktop. r=botond
https://hg.mozilla.org/integration/autoland/rev/2e7851b166ce
Implement "Resolve min-zoom and max-zoom values" in the spec. r=botond
Comment 15•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ecc77355ba3e
https://hg.mozilla.org/mozilla-central/rev/930561bbe55d
https://hg.mozilla.org/mozilla-central/rev/4a79571c40a0
https://hg.mozilla.org/mozilla-central/rev/d455d8d93e2c
https://hg.mozilla.org/mozilla-central/rev/02de107cdac4
https://hg.mozilla.org/mozilla-central/rev/2e7851b166ce
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Updated•6 years ago
|
status-firefox59:
affected → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•