Site with a fixed width is not zoomed in Firefox, zoomed in Chrome by CSS zoom property
Categories
(Core :: Layout, defect, P3)
Tracking
()
Webcompat Priority | P3 |
People
(Reporter: karlcow, Unassigned)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [webcompat])
Attachments
(1 file)
1.19 KB,
text/html
|
Details |
Steps to reproduce
- Go to http://game.granbluefantasy.jp/#top
- See the black bar on the right side.
The site is 320px wide.
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
The body is the width of the screen on Firefox Android, which on a Pixel 2 will be 411px, with these relevant values.
body {
margin: 0;
}
body:not(.jssdk) {
position: relative;
}
but on chrome, it adjusts the body width to what is set for the wrapper.
The main wrapper for the page is setting a fixed width of 320px.
.wrapper {
background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #88aeb7), color-stop(5%, #b8d0d3), color-stop(20%, #cfe8eb), color-stop(80%, #d2d4cf), color-stop(95%, #c7cebd), color-stop(100%, #afc1c5));
background-image: -webkit-linear-gradient(left, #88aeb7 0%,#b8d0d3 5%,#cfe8eb 20%,#d2d4cf 80%,#c7cebd 95%,#afc1c5 100%);
background-image: linear-gradient(left, #88aeb7 0%,#b8d0d3 5%,#cfe8eb 20%,#d2d4cf 80%,#c7cebd 95%,#afc1c5 100%);
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 320px;
min-height: 450px;
padding-bottom: 104px;
position: relative;
margin: 0 0 50px;
line-height: 1;
}
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Perhaps Chrome computes the "content size" for this page differently from us, and sometimes it can be smaller than the ICB size?
Comment 2•5 years ago
|
||
Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.
Comment 3•5 years ago
|
||
See bug 1547409. Migrating whiteboard priority tags to program flags.
Comment 4•5 years ago
|
||
Perhaps Chrome is just initially zooming to fit all of the content? For instance, citilink.ru does not specify any meta viewport
; it just sets the width of its header, footer and such to 1450px
. Upon loading the page, Firefox ends up zooming in so some content is off-screen (with window.innerWidth < 1450px
), while Chrome shows the full page zoomed out (with window.innerWidth == 1450px
).
I've attached a test case that shows a similar result with just a body
with min-width:1450px
and enough text for it to wrap.
Updated•5 years ago
|
Comment 5•5 years ago
|
||
(In reply to Thomas Wisniewski [:twisniewski] from comment #4)
I've attached a test case that shows a similar result with just a
body
withmin-width:1450px
and enough text for it to wrap.
There is something else going on in this test case than just zoom level: in Chrome, the text wraps into 7 lines for me, and in Firefox 5 lines. The text size looks about the same, so perhaps Chrome is disregarding with min-width:1450px
and wrapping the text earlier than that?
Comment 6•5 years ago
•
|
||
(In reply to Thomas Wisniewski [:twisniewski] from comment #4)
For instance, citilink.ru does not specify any
meta viewport
; it just sets the width of its header, footer and such to1450px
. Upon loading the page, Firefox ends up zooming in so some content is off-screen (withwindow.innerWidth < 1450px
), while Chrome shows the full page zoomed out (withwindow.innerWidth == 1450px
).
This deserves further investigation; it sounds like the mechanism added in bug 1423709 for determining the initial zoom level may not be working correctly on this page.
Comment 7•5 years ago
|
||
Moved citilink.ru case in bug 1553689.
Comment 8•5 years ago
|
||
The granbluefantasy.jp site has <html lang="jp" style="zoom: 1.125;">
, and the .wrapper div element's width is 320px, and 320px x 1.125 = 360px that is actually the phone's display width I am using. Is it a trick? I am not sure how they can calculate the zoom value though.
Reporter | ||
Comment 9•5 years ago
|
||
Hiroyuki,
they do it here computation and writing
window.displayInitialize = function() {
var deviceRatio = window.innerWidth / 320;
return deviceRatio;
};
window.fitScreenByZoom = function(deviceRatio) {
var html = document.getElementsByTagName("html")[0];
html.style.zoom = deviceRatio;
};
and they reuse the value here by reading it for setting preferences for the game initialization.
Game.getZoom = fzunction() {
// PC Web版のみ gameContainer を参照する
return +$("html").css("zoom");
};
Reporter | ||
Comment 10•5 years ago
|
||
as for the dependency on Zoom. Bug 390936 for my previous Comment #9
Comment 11•5 years ago
|
||
oops, sorry for the confusion. The html element with zoom value is what I can see on Chrome on the Android device. So presumably,
(In reply to Karl Dubost💡 :karlcow from comment #9)
and they reuse the value here by reading it for setting preferences for the game initialization.
Game.getZoom = fzunction() { // PC Web版のみ gameContainer を参照する return +$("html").css("zoom"); };
This code runs for Chrome on Android as well. (The comment implies it's only for Desktop though)
Comment 12•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #11)
(In reply to Karl Dubost💡 :karlcow from comment #9)
and they reuse the value here by reading it for setting preferences for the game initialization.
Game.getZoom = fzunction() { // PC Web版のみ gameContainer を参照する return +$("html").css("zoom"); };
Oh wait, fzunction ... Is it a valid function?? I am not sure.
Reporter | ||
Comment 13•5 years ago
|
||
yes, we can only see it on Chrome. But isn't it because this has no meaning in Firefox.
html.style.zoom = deviceRatio;
In Chrome (Android)
14:51:36.942 var html = document.getElementsByTagName("html")[0];
14:51:36.948 undefined
14:51:44.811 html
14:51:44.816 <html lang="jp" style="zoom: 1.28438;"><head>…</head><body style>…</body></html>
14:51:57.897 html.style.zoom
14:51:57.902 "1.28438"
14:52:15.415 html.style.zoom = 2
14:52:15.421 2
14:52:21.333 html
14:52:21.337 <html lang="jp" style="zoom: 2;"><head>…</head><body style>…</body></html>
In Firefox (Android)
14:49:42.813 var html = document.getElementsByTagName("html")[0];
14:49:42.825 undefined
14:49:45.936 html
14:49:45.945
<html lang="jp">
14:49:57.029 html.style.zoom
14:49:57.037 1.284375
14:54:22.210 html.style.zoom = 2
14:54:22.221 2
14:54:25.070 html
14:54:25.079
<html lang="jp">
or maybe I misunderstood.
Reporter | ||
Comment 14•5 years ago
|
||
fzunction is a typo cut/paste from me. :) sorry about that.
Updated•5 years ago
|
Updated•4 years ago
|
Reporter | ||
Updated•3 years ago
|
Reporter | ||
Updated•3 years ago
|
Comment 15•3 years ago
|
||
A web compat intervention for this is being added in bug 1722954
Updated•2 years ago
|
Comment 16•9 days ago
|
||
This appears to be fixed. The reported site breakage have been fixed a while ago, but also Tom's testcase from comment 4 now works: Firefox and Chrome show ~the same layout in both cases. I'll close this as worksforme.
Description
•