Closed Bug 861463 Opened 12 years ago Closed 9 years ago

On orientation change to portrait, document width is frequently wrong but window.innerWidth is always correct

Categories

(Firefox for Android Graveyard :: General, defect)

21 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: donrhummy, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0 Build ID: 20130326150557 Steps to reproduce: Rotated to landscape and then back to portrait and used the following code inside a listener for window.onresize: (onresize fires twice) alert( //This alerts incorrectly as 500 and then finally 415 Math.max( document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth ) + "," + //This alerts correctly both times as 384 window.innerWidth ); Actual results: the document/body width is incorrect but the window.innerWidth is correct. I checked that the reported widths were incorrect by attempting to croll to the left or right and could not move the page, indicating that the width was exactly the same as the window's innerWidth. Expected results: document/body width should be correct and the same as innerWidth
When I load http://people.mozilla.com/~kgupta/bug/861463.html on my Nexus 4 running latest nightly, it alerts the expected values (980 for everything except document.body.offsetWidth, which is 964). I do get a lot of alert dialogs but that is tracked in bug 748495. Please attach a complete standalone test case that demonstrates the problem you are seeing.
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #1) > When I load http://people.mozilla.com/~kgupta/bug/861463.html on my Nexus 4 > running latest nightly, it alerts the expected values (980 for everything > except document.body.offsetWidth, which is 964). I do get a lot of alert > dialogs but that is tracked in bug 748495. > > Please attach a complete standalone test case that demonstrates the problem > you are seeing. I'll put together a test to show it but I noticed a bug revealed by your code: 1. In portrait, it reports 980 and 964 as the widths (the Nexus 4 in portrait is 768 width max) 2. In landscape it reports EXACTLY the same values. This shouldn't be possible. The width in landscape on the Nexus 4 is greater than the portrait width, so why does it always report the same 980 and 964?
The CSS viewport width doesn't change, and so all the layout values (also in CSS pixels) don't change either.
Closing as WFM since the test case from comment 2 hasn't materialized and without that I can't reproduce anything that looks like a bug and matches the description from comment 0.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.