Closed Bug 1120452 Opened 10 years ago Closed 5 years ago

Firefox Android: javascript screen.width/.height incorrect on some platforms

Categories

(Firefox for Android Graveyard :: Toolbar, defect, P5)

34 Branch
Unspecified
Android
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1594980

People

(Reporter: waldbaerjkoch, Unassigned)

References

Details

(Keywords: mobile)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 Build ID: 20141125180439 Steps to reproduce: 1. Hold Android device in portrait orientation. 2. Load http://waldbaer.leute.server.de/display/ with Firefox 34.0 3. Read values for width/height in table screen. 4. Rotate device into landscape orientation. 5. Read values for width/height in table screen. Actual results: The screen values are incorrect on the follwing platforms: Android 4.2.1; Galaxy Nexus: 360x592, 598x360 Android 4.2.2; LG G2: 360x592, 598x360 Android 4.3; Galaxy Nexus: 360x592, 598x360 Android 4.4.2; Nexus 7: 600x904, 960x552 Android 5.0.1; HTC Nexus 9: 768x976, 1024x720 The screen values are correct on the following platforms: Android 4.4.2; HTC One: 360x640, 640x360 Android 4.4.4; YotaPhone 1: 360x640, 640x360 Expected results: I would expect the follwing values: Android 4.2.1; Galaxy Nexus: 360x640, 640x360 Android 4.2.2; LG G2: 360x640, 640x360 Android 4.3; Galaxy Nexus: 360x640, 640x360 Android 4.4.2; Nexus 7: 600x960, 960x600 Android 5.0.1; HTC Nexus 9: 768x1024, 1024x768
I have the same bug on ZTE Open C (Firefox OS 2.1), screen.width|height return 320/533, but real size is 480/800
(In reply to joda17 from comment #1) > I have the same bug on ZTE Open C (Firefox OS 2.1), screen.width|height > return 320/533, but real size is 480/800 I don't think so. What you get with screen.width/.height is measured in viewport pixels. The deviePixelRatio seems to be 1.5.
I didn't look into the Firefox code, but guess that this issue might be related to using Display.getRealSize() (http://developer.android.com/reference/android/view/Display.html#getRealSize%28android.graphics.Point%29) vs. Display.getSize() (http://developer.android.com/reference/android/view/Display.html#getSize%28android.graphics.Point%29).
Firefox 47.0, Android 6.0.1, Sony Xperia Z5 Compact portrait: screen.width: 360; screen.height: 592 landscape: screen.width: 592; screen.height: 360 Chrome 51.0.2704.81, Android 6.0.1, Sony Xperia Z5 Compact portrait: screen.width: 360; screen.height: 640 landscape: screen.width: 640; screen.height: 360 Both browsers show the same OS chrome (portrait: bars at the top and bottom; landscape: bars at the top and right).
Keywords: mobile
OS: Windows 7 → Android
Product: Core → Firefox for Android
Hardware: x86_64 → Unspecified
Component: General → Graphics, Panning and Zooming
This seems to result because Chrome reports the full screen size where as Firefox reports the screen size - the Android navigation bar. On devices where there is a software navigation bar Chrome and Firefox disagree on the size. Without going full screen the Firefox numbers are representative of what the browser actually has to work with as Android reserves the navigation space. Thoughts Kats?
Flags: needinfo?(bugmail)
https://drafts.csswg.org/cssom-view/#the-screen-interface: The width attribute must return the width of the Web-exposed screen area. with https://drafts.csswg.org/cssom-view/#web-exposed-screen-area: The Web-exposed screen area is one of the following: The area of the output device, in CSS pixels. The area of the viewport, in CSS pixels. So the spec seams to be intentionally vage :-|
I think it could be argued that we should change our implementation to match Chrome. That way window.outerWidth/outerHeight would be more meaningful and different from screen.width/height.
Flags: needinfo?(bugmail)
See Also: → 1126346
Yes now that I had a weekend to think about it I realized it was no different than the Windows taskbar or the OS X system menu.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195 Needinfo :susheel if you think this bug should be re-triaged.
Priority: P3 → P5

I believe that this is fixed by bug 1594980. If not fixed on Firefox Preview, let me know.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.