Closed
Bug 771575
Opened 14 years ago
Closed 14 years ago
window.innerWidth/innerHeight return incorrect values during "load" event on page with <meta name="viewport">
Categories
(Firefox for Android Graveyard :: Toolbar, defect, P1)
Tracking
(firefox14 affected, firefox15 affected, firefox16 verified, firefox17 verified, firefox18 verified, fennec16+)
VERIFIED
FIXED
Firefox 17
People
(Reporter: vlad, Assigned: kats)
References
()
Details
(Keywords: regression)
Attachments
(2 files)
|
4.47 KB,
patch
|
mbrubeck
:
review+
lsblakk
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
|
1019 bytes,
patch
|
mbrubeck
:
review+
|
Details | Diff | Splinter Review |
On a Galaxy Nexus and other high dpi devices (720p), trying to create an element that takes up the entire body area with no scrolling or scaling doesn't work -- the body is 2x as big as it should be. Testcase is at http://conduit.bitops.com/~vladimir/misc/device-width-test.html -- this should be a green page with an orange border, but on fennec you have twice the width and height that you should on a high dpi device.
| Reporter | ||
Comment 1•14 years ago
|
||
The testcase works as expected in stock ICS Browser and in Chrome. This I think is a pretty big deal for anyone trying to create web apps/pages that work well in fennec, so nominating.
tracking-fennec: --- → ?
status-firefox14:
--- → affected
status-firefox15:
--- → affected
status-firefox16:
--- → affected
| Assignee | ||
Comment 2•14 years ago
|
||
Note setting the browser.viewport.scaleRatio pref to 100 fixes this, so it's definitely an interaction with the DPI scaling we have in fennec's browser.js
Updated•14 years ago
|
Assignee: nobody → mbrubeck
tracking-fennec: ? → 15+
Comment 3•14 years ago
|
||
The problem is that window.innerWidth and .innerHeight are returning the wrong value. Interestingly, they return the correct value if I add a delay before accessing them, for example setTimeout(..., 0). See also this page, which is identical to Vlad's test case except for the two alert() calls, and produces the correct layout:
http://people.mozilla.com/~mbrubeck/test/device-width-test.html
It looks like the problem is that the <meta name="viewport"> settings are applied shortly *after* the "load" event fires.
Summary: viewport width=device-width is 2x as big on hidpi devices → window.innerWidth/innerHeight return incorrect values during "load" event on page with <meta name="viewport">
Comment 4•14 years ago
|
||
This is a regression from bug 759678, which deliberately suppresses viewport updates during page load to prevent reflowing or painting the partially-loaded document. Kats, any ideas for fixing this without regressing 759678?
Assignee: mbrubeck → nobody
Blocks: 759678
Component: Layout → Graphics, Panning and Zooming
Keywords: regression
Product: Core → Firefox for Android
Version: unspecified → Trunk
| Assignee | ||
Comment 5•14 years ago
|
||
The best idea I have for fixing this involves moving carefully-selected hunks of code from the before-first-paint event handler into the DOMContentLoaded event handler. That should avoid regressing 759678 but I'm worried that it might introduce another regression where, if you navigate to a new page, the old page will jump around while the new page loads.
| Reporter | ||
Comment 6•14 years ago
|
||
I think this needs to block WebRT on Android -- as things stand, it makes it impossible to create a web app that will fit to the device screen on high dpi devices with no scrolling. This is a pretty serious usability and quality issue for web apps.
blocking-basecamp: --- → ?
Whiteboard: [blocking-webrtandroid1?]
| Reporter | ||
Comment 7•14 years ago
|
||
Oh, I misunderstood the earlier comment -- if it has a relatively easy workaround (setTimeout 0) it may not be that big of an issue.
Comment 8•14 years ago
|
||
Kats - Do you have a plan we could start implementing?
tracking-fennec: 15+ → 16+
Updated•14 years ago
|
Priority: -- → P1
Comment 9•14 years ago
|
||
Removing basecamp nom - this sounds like an Android issue (unless I'm misreading something), which isn't tied to basecamp.
blocking-basecamp: ? → ---
Whiteboard: [blocking-webrtandroid1?]
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → bugmail.mozilla
| Assignee | ||
Comment 10•14 years ago
|
||
This seems to fix it without regressing bug 759678. However I'm worried this may have other side effects and wouldn't really recommend uplifting this.
Attachment #649729 -
Flags: review?(mbrubeck)
| Assignee | ||
Comment 11•14 years ago
|
||
Attachment #649730 -
Flags: review?(mbrubeck)
Updated•14 years ago
|
Attachment #649730 -
Flags: review?(mbrubeck) → review+
Comment 12•14 years ago
|
||
Comment on attachment 649729 [details] [diff] [review]
Allow setting browser size without triggering a reflow before first paint happens
>+ // in this case, we should do anything that forces a reflow (see bug 759678)
"we should NOT do anything that forces a reflow", right?
Attachment #649729 -
Flags: review?(mbrubeck) → review+
| Assignee | ||
Comment 13•14 years ago
|
||
(In reply to Matt Brubeck (:mbrubeck) from comment #12)
> "we should NOT do anything that forces a reflow", right?
Right, good catch. Fixed on landing.
https://hg.mozilla.org/integration/mozilla-inbound/rev/fd673fa4d1d7
https://hg.mozilla.org/integration/mozilla-inbound/rev/cb90deebb650
Comment 14•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
| Assignee | ||
Comment 15•14 years ago
|
||
Also https://hg.mozilla.org/mozilla-central/rev/fd673fa4d1d7 - I accidentally landed that patch with the wrong bug number, it should be bug 771575 (this bug) and not bug 771757.
| Reporter | ||
Comment 16•14 years ago
|
||
This isn't quite fixed; the hdpi issue still remains. I modified the testcase at http://conduit.bitops.com/~vladimir/misc/device-width-test.html to show the actual innerWidth/innerHeight that are being reported. On a Galaxy Nexus, this comes up as 360x519, which is half of what it should be (720x1038 for this page in portait mode, where native device resolution is 720x1280). Setting scaleRatio to 100 has it report 720x1038 as expected.
So, we're now correctly filling the viewport, but doing it by scaling content at 2x despite the viewport tag explicitly stating device-width/device-height. We don't seem to support target-densitydpi in the viewport tag to explicitly specify this.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Reporter | ||
Comment 17•14 years ago
|
||
Then again, this is exactly what Chrome and the stock browser do (without target-desnitydpi=device-dpi), so that bit is just bug 737090.
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 19•13 years ago
|
||
Comment on attachment 649729 [details] [diff] [review]
Allow setting browser size without triggering a reflow before first paint happens
[Approval Request Comment]
Bug caused by (feature/regressing bug #):
User impact if declined: Various layout properties may be incorrect when read from the page's onload function. Bug 789870 is an example of this being encountered in the wild.
Testing completed (on m-c, etc.): on m-c and aurora now
Risk to taking this patch (and alternatives if risky): mobile only
String or UUID changes made by this patch: none
Attachment #649729 -
Flags: approval-mozilla-beta?
Updated•13 years ago
|
Attachment #649729 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
| Assignee | ||
Comment 20•13 years ago
|
||
status-firefox17:
--- → fixed
Comment 21•13 years ago
|
||
This issue is fixed on the latest m-a and m-c builds. Closing bug as verified fixed on:
Firefox 18.0a1 (2012-09-11)
Device: Galaxy Note
OS: Android 4.0.4
Comment 22•13 years ago
|
||
The orange border doesn't exceed the viewport anymore on the latest Beta build too. Setting the firefox 16 flag as verified.
--
Firefox 16.0b5 (2012-09-26)
Device: Galaxy Note
OS: Android 4.0.4
Comment 23•10 years ago
|
||
I get a similar problem as this bug, although it says it's fix. Using setTimeout to delay my init() function is my current workaround.
Firefox 43.0
Device: Galaxy Note II
OS: Android 4.0.4
Updated•5 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
•