Closed
Bug 375519
Opened 17 years ago
Closed 17 years ago
window.innerWidth/Height units
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mpgritti, Assigned: sharparrow1)
References
Details
Attachments
(1 file, 1 obsolete file)
4.03 KB,
patch
|
sharparrow1
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
window.innerWidth/Height are currently returned in device pixels rather than in CSS pixels. On high DPI screens this breaks sites like google maps or gtalk which use window.innerWidth/Height to adapt divs position/size to the browser window. Is there a reason for this behavior or is it just a bug? (screen.width and screen.height are returned in CSS pixels)
Just a bug I presume.
Assignee | ||
Comment 2•17 years ago
|
||
Just a bug; high DPI hasn't been getting much testing. Probably just need to add a bit of code to nsGlobalWindow::Get/SetInnerWidth/Height to grab a prescontext and do something like presContext::AppUnitsToIntCSSPixels(presContext->DevPixelsToAppUnits(width)); it's a bit messy, but pretty straightforward. The prescontext can be obtained from nsIDocShell. I'll put together a patch soon.
Assignee: general → sharparrow1
Reporter | ||
Updated•17 years ago
|
Attachment #259996 -
Flags: review? → review?(sharparrow1)
Assignee | ||
Comment 4•17 years ago
|
||
(In reply to comment #3) > Created an attachment (id=259996) [details] > Convert between device and css pixels for window.InnerWidth/Height > > Something like this? Looks good. Just to be on the safe side, though, I'd null-check mDocShell. I'm not quite sure when it can be null.
Reporter | ||
Updated•17 years ago
|
Attachment #259996 -
Attachment is obsolete: true
Attachment #259996 -
Flags: review?(sharparrow1)
Reporter | ||
Comment 5•17 years ago
|
||
I used NS_ENSURE_STATE(mDocShell)... From what I can tell looking at nsDocShell.cpp this is an unexpected state. Also we are doing the same in GlobalWindow::Prompt. Make sense?
Attachment #260139 -
Flags: review?(sharparrow1)
Assignee | ||
Comment 6•17 years ago
|
||
Comment on attachment 260139 [details] [diff] [review] Checks for mDocShell NS_ENSURE_STATE is fine.
Attachment #260139 -
Flags: superreview?(roc)
Attachment #260139 -
Flags: review?(sharparrow1)
Attachment #260139 -
Flags: review+
Attachment #260139 -
Flags: superreview?(roc) → superreview+
Reporter | ||
Comment 7•17 years ago
|
||
[marco@localhost mozilla]$ cvs commit dom/src/base/nsGlobalWindow.cpp Checking in dom/src/base/nsGlobalWindow.cpp; /cvsroot/mozilla/dom/src/base/nsGlobalWindow.cpp,v <-- nsGlobalWindow.cpp new revision: 1.919; previous revision: 1.918 done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 8•17 years ago
|
||
For the record, this caused bug 400204.
You need to log in
before you can comment on or make changes to this bug.
Description
•