Closed
Bug 950180
Opened 11 years ago
Closed 11 years ago
window.innerWidth is not up-to-date in window.onresize listener
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox27 | --- | wontfix |
firefox28 | --- | fixed |
firefox29 | --- | fixed |
b2g-v1.2 | --- | unaffected |
b2g-v1.3 | --- | fixed |
People
(Reporter: kats, Assigned: kats)
References
()
Details
(Keywords: regression)
Attachments
(1 file)
4.74 KB,
patch
|
cwiiis
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #940889 +++
1. Use Firefox OS browser to open the test page (see URL field of the bug) in portrait mode.
2. Use logcat to watch console output.
3. Rotate device to landscape mode.
Actual results:
window.innerWidth is not up-to-date in window.onresize listener as indicated by the log.
Assignee | ||
Comment 1•11 years ago
|
||
This is the B2G equivalent of bug 940889 and the patch is very similar. Basically moving the GetPageSize call (which triggers the resize event) so that we set the scrollClamping size first.
Attachment #8347405 -
Flags: review?(chrislord.net)
Assignee | ||
Updated•11 years ago
|
Comment 2•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #1)
> Created attachment 8347405 [details] [diff] [review]
> Patch
>
> This is the B2G equivalent of bug 940889 and the patch is very similar.
> Basically moving the GetPageSize call (which triggers the resize event) so
> that we set the scrollClamping size first.
Don't you want to call SetCSSViewport after the call that set the scrollClamping ? My understanding was that the resize event was fired because of the call to SetCSSViewport that ends up calling presShell->ResizeReflowOverride and fire the resize event from http://mxr.mozilla.org/mozilla-central/source/layout/base/nsPresShell.cpp#1975
Did I missed something ?
Comment 3•11 years ago
|
||
Comment on attachment 8347405 [details] [diff] [review]
Patch
Review of attachment 8347405 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/ipc/TabChild.cpp
@@ +545,5 @@
> + }
> + // For non-HTML content (e.g. SVG), just assume page size == viewport size.
> + return aViewport;
> +}
> +
Would this read better if you took care of the "nothing is there" case at the top, then worry about the rest of the code?
if (!htmlDOMElement && !bodyDOMElement) {
return aViewport;
}
int32_t htmlWidth = ...
Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #2)
> Don't you want to call SetCSSViewport after the call that set the
> scrollClamping ? My understanding was that the resize event was fired
> because of the call to SetCSSViewport that ends up calling
> presShell->ResizeReflowOverride and fire the resize event from
> http://mxr.mozilla.org/mozilla-central/source/layout/base/nsPresShell.
> cpp#1975
>
> Did I missed something ?
As discussed on IRC: it's not actually the call to SetCSSViewport that triggers the resize event. The resize event is dispatched on the next reflow which happens lazily; in this case the call to GetPageSize forces a reflow because layout doesn't know what the new page size will be until it reflows. So as long as we set the scrollclamping size before doing anything that triggers a reflow we're fine, and that's what this patch does. It's not really the most intuitive thing unfortunately.
(In reply to Milan Sreckovic [:milan] from comment #3)
> Would this read better if you took care of the "nothing is there" case at
> the top, then worry about the rest of the code?
>
> if (!htmlDOMElement && !bodyDOMElement) {
> return aViewport;
> }
> int32_t htmlWidth = ...
Yup, I can do that.
Updated•11 years ago
|
Component: Gaia::Browser → DOM
Product: Firefox OS → Core
Assignee | ||
Updated•11 years ago
|
OS: Android → Gonk (Firefox OS)
Comment 5•11 years ago
|
||
Comment on attachment 8347405 [details] [diff] [review]
Patch
Review of attachment 8347405 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM.
::: dom/ipc/TabChild.cpp
@@ +543,5 @@
> + return CSSSize(std::max(htmlWidth, bodyWidth),
> + std::max(htmlHeight, bodyHeight));
> + }
> + // For non-HTML content (e.g. SVG), just assume page size == viewport size.
> + return aViewport;
I agree with Milan's comment about this, but seeing as this is just a code move, perhaps we'd want to in a separate patch. Your call.
Attachment #8347405 -
Flags: review?(chrislord.net) → review+
Assignee | ||
Comment 6•11 years ago
|
||
I rearranged the code as per Milan's comment landed on b2g-i:
https://hg.mozilla.org/integration/b2g-inbound/rev/2688c4d13b43
Assignee | ||
Comment 7•11 years ago
|
||
I think this is worth uplifting since it is a regression exposed to browser content if nothing else.
Comment 8•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Comment 9•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #7)
> I think this is worth uplifting since it is a regression exposed to browser
> content if nothing else.
WFM
blocking-b2g: 1.3? → 1.3+
Comment 10•11 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•