Closed
Bug 1071620
Opened 10 years ago
Closed 10 years ago
window.innerWidth/innerHeight return incorrect values during "DOMContentLoaded" event on page with <meta name="viewport">
Categories
(Firefox for Android Graveyard :: Toolbar, defect)
Tracking
(p11+, firefox41 fixed, fennec+)
RESOLVED
FIXED
Firefox 41
People
(Reporter: damien.derouet, Assigned: esawin)
References
Details
Attachments
(2 files)
1017 bytes,
text/html
|
Details | |
2.78 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Steps to reproduce:
Using window.innerHeight on DOMContentLoaded event.
user-agent:
Mozilla/5.0 (Android; Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
Actual results:
If window.innerHeight is called on DOMContentLoaded event, the returned value is incorrect. When called after load event, the returned value is OK. (see the testsheet attached to reproduce)
Expected results:
The value should be the same before and after the load event
Reporter | ||
Updated•10 years ago
|
OS: Windows XP → Android
Hardware: x86 → All
Updated•10 years ago
|
Component: General → Graphics, Panning and Zooming
Comment 1•10 years ago
|
||
I'm also hitting this problem.
This is impacting mobile Wikipedia - the mobile site renders as if treated as if it is a tablet (all sections are open by default, table of contents shows and code that doesn't work so well on smaller screen is loaded that shouldn't be loaded!)
We had a bug reported at https://bugzilla.wikimedia.org/show_bug.cgi?id=70277
Updated•10 years ago
|
tracking-fennec: --- → ?
Comment 2•10 years ago
|
||
Kats & Mike, is this us or them?
Flags: needinfo?(miket)
Flags: needinfo?(bugmail.mozilla)
Comment 3•10 years ago
|
||
Probably us. This could happen if the DOMContentLoaded event is dispatched before we update the CSS viewport properties in the before-first-paint event handler.
Flags: needinfo?(bugmail.mozilla)
Updated•10 years ago
|
Summary: window.innerWidth/innerHeight return incorrect values during "load" event on page with <meta name="viewport"> → window.innerWidth/innerHeight return incorrect values during "DOMContentLoaded" event on page with <meta name="viewport">
Updated•10 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 4•10 years ago
|
||
This seems like Bug 771575, no?
Updated•10 years ago
|
Keywords: regressionwindow-wanted
Updated•10 years ago
|
Assignee: nobody → nchen
tracking-fennec: ? → +
Some remarks when investigating the problem. I checked with FF32 and the problem wasn't there. I tried to get a regression window by going through the nightlies, but abandon that because all builds (I've tried) failed.
Also the values can still be wrong on onload. I noticed this issue with a giant codebase and there wrong values were still present on the onload event. I have to use a setTimeout on the onload event before the proper values are used.
Comment 8•10 years ago
|
||
I believe this bug is responsible for us getting tablet-sized content on the Google Inbox homepage. See https://bugzilla.mozilla.org/show_bug.cgi?id=1091683#c3.
Comment 10•10 years ago
|
||
This bug affects document.documentElement.clientWidth, too. I've attached a test-case to another bug that probably has the same cause: https://bugzilla.mozilla.org/show_bug.cgi?id=908568#c3
Comment 11•10 years ago
|
||
This bug still affects Firefox Android 36.
You can see the error on this jsBin: http://jsbin.com/feditadufo/2
to see the code: http://jsbin.com/feditadufo/2/edit?html
I get two different screen sizes,
the first is during the Dom content loading and the second one is after the resize event.
The deal is that I can't wait the resize event,
my page depends on the size to define what will do on the first scroll.
Waiting for the resize event would delay the first scroll rendering.
Comment 12•10 years ago
|
||
Still affects Firefox 37 and 38 beta for Android.
This totally throws off Google AdSense’s responsive ads and cause site-compatibility issues on all sites that use it. It causes AdSense to serve too large ad units and often ends up covering page.
Have had to stop using Firefox for Android as may sites I visit regularly are covered up by skyscraper ads instead of cute and small mobile ads.
Comment 13•10 years ago
|
||
Is there someone that can work on this, Kats?
Assignee: nchen → nobody
Flags: needinfo?(bugmail.mozilla)
Comment 14•10 years ago
|
||
I suspect this bug is behind the issue at https://github.com/webcompat/web-bugs/issues/1025 (an important site for Japan compat).
Comment 15•10 years ago
|
||
Unfortunately I don't have cycles for working on this at the moment. Eugen has worked in related code before, so he might be a good person to tackle this.
Flags: needinfo?(bugmail.mozilla) → needinfo?(esawin)
Comment 16•10 years ago
|
||
It looks like the cause of https://github.com/webcompat/web-bugs/issues/930 as well.
Updated•10 years ago
|
tracking-p11:
--- → +
Assignee | ||
Comment 17•10 years ago
|
||
This bug has an interesting history (bug 759678 -> bug 771575 -> bug 1046631), we should find a way break out of the circle.
I will look into it.
Flags: needinfo?(esawin)
Assignee | ||
Comment 18•10 years ago
|
||
With this patch, we update meta data when handling DOMMetaAdded to set the proper CSS viewport metrics before DOMContentLoaded is fired. However, we exit early before updating the zoom/resolution in this case to prevent overriding the zoom factor which is yet to be restored (so we do not regress on bug 1046631).
This also fixes https://github.com/webcompat/web-bugs/issues/1025 and https://github.com/webcompat/web-bugs/issues/930.
However, it might not completely fix bug 908568, as the script in https://bugzilla.mozilla.org/show_bug.cgi?id=908568#c3 would return the correct values for "Load" and "DOMContentLoaded", but would still show the default 980 for "Initial". Fixing this is out of scope of this bug.
Assignee: nobody → esawin
Status: NEW → ASSIGNED
Attachment #8606327 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 19•10 years ago
|
||
I cannot verify whether it fixes bug 1091683 because of bug 1165350.
Comment 20•10 years ago
|
||
Comment on attachment 8606327 [details] [diff] [review]
0001-Bug-1071620-Update-meta-data-on-DOMMetaAdded-before-.patch
Review of attachment 8606327 [details] [diff] [review]:
-----------------------------------------------------------------
I can't think of anything that this will break but I'm like 80% sure something will break because this code is a minefield. Let's see what happens!
Attachment #8606327 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 21•10 years ago
|
||
Comment 22•10 years ago
|
||
Comment 23•10 years ago
|
||
I'm assuming this fix will also fix any other width-related properties from being way-off during DOMContentLoaded, such as document.documentElement.clientWidth.
Comment 24•10 years ago
|
||
It should, yes. Those values are all computed based on the innerWidth.
Comment 25•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
Updated•9 years ago
|
Keywords: regressionwindow-wanted
Blocks: 908568
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•