Closed
Bug 895905
Opened 11 years ago
Closed 11 years ago
Contents needs to inform APZC about scroll events on B2G
Categories
(Core :: Graphics: Layers, defect)
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: botond, Assigned: botond)
References
Details
(Whiteboard: [preview])
Attachments
(4 files, 13 obsolete files)
18.89 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
6.38 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
1.34 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
1.71 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
As a result of the fix to bug 859929, APZC needs to be informed about scroll events. This was implemented for Fenec in bug 859929, but it needs to be implemented for B2G as well.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → botond
Updated•11 years ago
|
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #781782 -
Flags: review?(bugmail.mozilla)
Comment 2•11 years ago
|
||
Comment on attachment 781782 [details] [diff] [review]
bug895905.patch
Review of attachment 781782 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good overall, just a few comments below I'd like to see addressed.
I assume you'll do the metro hookup as part of a follow-up or bump that to Brian? Either of those is fine as long as it's clear who will do that.
::: dom/ipc/TabChild.cpp
@@ +312,5 @@
> + nsCOMPtr<nsIDOMWindowUtils> utils = GetDOMWindowUtils();
> + utils->GetScrollXY(false, &scrollX, &scrollY);
> + CSSIntPoint scrollOffset(scrollX, scrollY);
> + CSSIntPoint lastScrollOffset = CSSIntPoint::FromAppUnitsRounded(
> + CSSPoint::ToAppUnits(mLastMetrics.mScrollOffset));
You can use RoundedToInt(mLastMetrics.mScrollOffset) here. RoundedToInt is defined in gfx/2d/Point.h
@@ +315,5 @@
> + CSSIntPoint lastScrollOffset = CSSIntPoint::FromAppUnitsRounded(
> + CSSPoint::ToAppUnits(mLastMetrics.mScrollOffset));
> + if (lastScrollOffset != scrollOffset) {
> + // Update mLastMetrics.mScrollOffset now, otherwise RecvUpdateDimensions()
> + // might trigger scroll to the olf offset before RecvUpdateFrame() gets a
s/olf/old/
@@ +317,5 @@
> + if (lastScrollOffset != scrollOffset) {
> + // Update mLastMetrics.mScrollOffset now, otherwise RecvUpdateDimensions()
> + // might trigger scroll to the olf offset before RecvUpdateFrame() gets a
> + // chance to update it.
> + mLastMetrics.mScrollOffset = CSSPoint(scrollX, scrollY);
you should just be able put scrollOffset on the RHS of this assignment. There's an implicit constructor that will do the conversion.
@@ +1566,5 @@
> + // in mLastMetrics is the same as the offset stored in the window,
> + // re-query the latter.
> + int32_t actualScrollX, actualScrollY;
> + window->GetScrollX(&actualScrollX);
> + window->GetScrollY(&actualScrollY);
I'd rather have this call util->GetScrollXY for consistency with the other bit of code above. That way if GetScrollX for whatever reason returns something different GetScrollXY we'll still be covered.
Attachment #781782 -
Flags: review?(bugmail.mozilla) → review-
Assignee | ||
Comment 3•11 years ago
|
||
updated patch
Attachment #781782 -
Attachment is obsolete: true
Attachment #781846 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)
> I assume you'll do the metro hookup as part of a follow-up or bump that to
> Brian? Either of those is fine as long as it's clear who will do that.
I will file a new bug for that (since the Fennec and B2G hookups had different bugs, I think it's consistent that the Metro hookup gets one too), and take it once I get my Metro device. Of course, I'm cool with Brian taking it if he'd like.
The other comments are addressed by the updated patch.
Assignee | ||
Comment 5•11 years ago
|
||
This one-line patch adds a comment to nsPoint.h documenting that nsPoint and nsIntPoint store coordinates in app units.
Attachment #781855 -
Flags: review?(tnikkel)
Assignee | ||
Updated•11 years ago
|
Attachment #781855 -
Attachment description: bug895905a.patch → small documentation improvement
Comment 6•11 years ago
|
||
Comment on attachment 781855 [details] [diff] [review]
small documentation improvement
nsPoint is app units, but nsIntPoint is (one of the types of) pixels.
Assignee | ||
Comment 7•11 years ago
|
||
Corrected documentation patch.
Attachment #781855 -
Attachment is obsolete: true
Attachment #781855 -
Flags: review?(tnikkel)
Attachment #781873 -
Flags: review?(tnikkel)
Assignee | ||
Comment 8•11 years ago
|
||
(In reply to Timothy Nikkel (:tn) from comment #6)
> Comment on attachment 781855 [details] [diff] [review]
> small documentation improvement
>
> nsPoint is app units, but nsIntPoint is (one of the types of) pixels.
Thanks for pointing that out. I had incorrectly ascribed properties of the CSSPoint/CSSIntPoint etc. pairs to nsPoint/nsIntPoint in my mind.
I updated the documentation patch accordingly.
Comment 9•11 years ago
|
||
Comment on attachment 781873 [details] [diff] [review]
Part 4 - Small documentation improvement
Thanks!
Attachment #781873 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 10•11 years ago
|
||
Note that this patch will need to be revised for multi-APZC. Here's an outline of how it can be done:
- The UpdateScrollOffset message from TabChild to TabParent can be modified to
include the view ID corresponding to the scroll frame that was scrolled.
- When sending the message, TabChild can get the correct view ID from the event
target of the scroll event it received, and the correct scroll offset by
finding the scroll frame corresponding to that view ID.
- When receiving the message, TabParent can dispatch it to the correct APZC
based on the view ID in the message.
Jeff also suggested moving the communication from TabChild->TabParent to CompositorChild->CompositorParent to reduce the amount of locking that is done in the parent process (which will become more significant when there will be a tree of APZCs rather than just one). I believe this is independent of the above.
I will wait for bug 866232 to land before making these revisions.
Depends on: 866232
Comment 11•11 years ago
|
||
Comment on attachment 781846 [details] [diff] [review]
bug895905.patch
Review of attachment 781846 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks!
::: dom/ipc/TabParent.cpp
@@ +1488,5 @@
> + }
> + return true;
> +}
> +
> +
nit: One blank line here is enough
::: layout/ipc/RenderFrameParent.cpp
@@ +1000,5 @@
> + mPanZoomController->UpdateScrollOffset(aScrollOffset);
> + }
> +}
> +
> +
ditto
Attachment #781846 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 12•11 years ago
|
||
Attachment #781846 -
Attachment is obsolete: true
Attachment #782576 -
Flags: review+
Updated•11 years ago
|
Whiteboard: [preview]
Assignee | ||
Comment 13•11 years ago
|
||
Updated patch to handle multi-APZC.
Attachment #782576 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Attachment #785045 -
Flags: review?(bugmail.mozilla)
Comment 14•11 years ago
|
||
Comment on attachment 785045 [details] [diff] [review]
bug895905-multi.patch
Review of attachment 785045 [details] [diff] [review]:
-----------------------------------------------------------------
Some minor things noted below, but otherwise looks good. I'd like to see an updated patch with the comments addressed though, so minusing for now.
::: dom/ipc/PBrowser.ipdl
@@ +284,5 @@
> UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
>
> + /**
> + * Notifies the parent about a scroll event. The pres shell ID and
> + * view ID identify which scrollable (sub-)frame was scrolled, and
nit: remove trailing whitespace
::: dom/ipc/TabChild.cpp
@@ +359,5 @@
> + } else if ((content = do_QueryInterface(target))) {
> + // Case 3: Content.
> + nsCOMPtr<nsIDOMWindowUtils> utils = ::GetDOMWindowUtils(content);
> + utils->GetPresShellId(&presShellId);
> + NS_ENSURE_STATE(nsLayoutUtils::FindIDFor(content, &viewId));
I'm not sure NS_ENSURE_STATE is appropriate here. According to the docs in nsDebug.h, it's meant to be used "for checking state and arguments upon entering interface boundaries" which is not the case here.
Also while NS_ENSURE_STATE appears to be compiled in debug mode, often macros like this are #define'd to be no-ops in debug mode so it's good practice to call the function outside of the macro and then just check the return value in the macro, otherwise the entire function call disappears.
@@ +2248,5 @@
> NS_ENSURE_TRUE(root, false);
> root->SetParentTarget(scope);
>
> chromeHandler->AddEventListener(NS_LITERAL_STRING("DOMMetaAdded"), this, false);
> + chromeHandler->AddEventListener(NS_LITERAL_STRING("scroll"), this, false);
I'm a little surprised that the listener (for DOMMetaAdded) isn't removed in RecvDestroy. I wonder if that's a bug.
::: dom/ipc/TabChild.h
@@ -426,5 @@
> // Get the DOMWindowUtils for the top-level window in this tab.
> already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils();
> - // Get the DOMWindowUtils for the window corresponding to the givent content
> - // element. This might be an iframe inside the tab, for instance.
> - already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIContent* aContent);
Why remove this from TabChild?
::: gfx/layers/ipc/AsyncPanZoomController.cpp
@@ +1475,5 @@
> }
>
> bool AsyncPanZoomController::Matches(const ScrollableLayerGuid& aGuid)
> {
> + // TODO: also check the presShellId, once that is fully propagated
nit: trailing whitespace
::: layout/base/nsLayoutUtils.h
@@ +65,5 @@
> public:
> typedef mozilla::layers::FrameMetrics::ViewID ViewID;
>
> /**
> + * Finds previously assigned ViewID for the given content element.
Update comment to indicate what the return value means (it's pretty obvious, but still good practice).
Attachment #785045 -
Flags: review?(bugmail.mozilla) → review-
Assignee | ||
Comment 15•11 years ago
|
||
Updated patch to address review comments.
Attachment #785045 -
Attachment is obsolete: true
Attachment #786342 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 16•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #14)
> Comment on attachment 785045 [details] [diff] [review]
> ::: dom/ipc/TabChild.h
> @@ -426,5 @@
> > // Get the DOMWindowUtils for the top-level window in this tab.
> > already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils();
> > - // Get the DOMWindowUtils for the window corresponding to the givent content
> > - // element. This might be an iframe inside the tab, for instance.
> > - already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIContent* aContent);
>
> Why remove this from TabChild?
Unlike the no-argument overload, this overload didn't use any state from TabChild, so it could be made a non-member and moved into the cpp file.
>
> @@ +2248,5 @@
> > NS_ENSURE_TRUE(root, false);
> > root->SetParentTarget(scope);
> >
> > chromeHandler->AddEventListener(NS_LITERAL_STRING("DOMMetaAdded"), this, false);
> > + chromeHandler->AddEventListener(NS_LITERAL_STRING("scroll"), this, false);
>
> I'm a little surprised that the listener (for DOMMetaAdded) isn't removed in
> RecvDestroy. I wonder if that's a bug.
I wonder too. Let's ask smaug.
Flags: needinfo?(bugs)
Comment 17•11 years ago
|
||
It shouldn't be a problem, since the listener is added to windowroot, and TabChild itself shouldn't
keep windowroot alive. So there isn't even a cycle to collect, as far as I see.
In fact, we should see leaks in debug builds if there was a leak.
The event listener will be removed when cycle collector runs after tab close and notices that
WindowRoot can be collected.
(WindowRoot is the "chromeEventHandler" in this case)
Flags: needinfo?(bugs)
Comment 18•11 years ago
|
||
Comment on attachment 786342 [details] [diff] [review]
Part 1 - Inform APZC about scroll events on B2G
Review of attachment 786342 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good then.
Attachment #786342 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 19•11 years ago
|
||
This patch simplifies some of the added code in TabChild by eliminating some of the special handling of ROOT_SCROLL_ID.
Attachment #786514 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 20•11 years ago
|
||
Removed some debug output that snuck into the last patch.
Attachment #786514 -
Attachment is obsolete: true
Attachment #786514 -
Flags: review?(bugmail.mozilla)
Attachment #786515 -
Flags: review?(bugmail.mozilla)
Comment 21•11 years ago
|
||
Comment on attachment 786515 [details] [diff] [review]
bug895905-multi-part2.patch
Review of attachment 786515 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsDisplayList.cpp
@@ +1158,5 @@
> +
> + // Record the mapping between the root scroll frame's content and
> + // ROOT_SCROLL_ID so that users of nsLayoutUtils::FindIDFor() and
> + // nsLayoutUtils::FindContentFor() don't have to special-case the root.
> + nsLayoutUtils::FindOrCreateIDFor(content, true);
I feel like this should be in an "if (id == FrameMetrics::ROOT_SCROLL_ID)" (or equivalently, "if (presContext->IsRootContentDocument())" guard. I think this code path can get executed for cases where we are not at the root content document and in those cases you don't want to be passing true here. Does that make sense?
Assignee | ||
Comment 22•11 years ago
|
||
Attachment #786515 -
Attachment is obsolete: true
Attachment #786515 -
Flags: review?(bugmail.mozilla)
Attachment #787008 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 23•11 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #21)
> ::: layout/base/nsDisplayList.cpp
> @@ +1158,5 @@
> > +
> > + // Record the mapping between the root scroll frame's content and
> > + // ROOT_SCROLL_ID so that users of nsLayoutUtils::FindIDFor() and
> > + // nsLayoutUtils::FindContentFor() don't have to special-case the root.
> > + nsLayoutUtils::FindOrCreateIDFor(content, true);
>
> I feel like this should be in an "if (id == FrameMetrics::ROOT_SCROLL_ID)"
> (or equivalently, "if (presContext->IsRootContentDocument())" guard. I think
> this code path can get executed for cases where we are not at the root
> content document and in those cases you don't want to be passing true here.
> Does that make sense?
Good catch, thanks! Fixed in updated patch.
Comment 24•11 years ago
|
||
Comment on attachment 787008 [details] [diff] [review]
bug895905-multi-part2.patch
Review of attachment 787008 [details] [diff] [review]:
-----------------------------------------------------------------
Looks fine to me. Also tagging :tn for review in case there's some reason this can't be done that I'm not aware of.
Attachment #787008 -
Flags: review?(tnikkel)
Attachment #787008 -
Flags: review?(bugmail.mozilla)
Attachment #787008 -
Flags: review+
Comment 25•11 years ago
|
||
Attachment #787008 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 26•11 years ago
|
||
Fixed a compiler error related to name lookup on GCC 4.7.
Attachment #787064 -
Flags: review?(bugmail.mozilla)
Updated•11 years ago
|
Attachment #787064 -
Flags: review?(bugmail.mozilla) → review?(bas)
Assignee | ||
Comment 27•11 years ago
|
||
Updated patch to fix a assertion failure.
Attachment #787008 -
Attachment is obsolete: true
Attachment #787791 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 28•11 years ago
|
||
Try results: https://tbpl.mozilla.org/?tree=Try&rev=573f63e89480
Tested this on B2G after the multi-APZC regression fixes landed, looks good.
Updated•11 years ago
|
Attachment #787791 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 29•11 years ago
|
||
Update patch to gfx/2d/Point.h: instead of #including nsMathUtils.h, don't use NS_lround() in the file.
Attachment #787064 -
Attachment is obsolete: true
Attachment #787064 -
Flags: review?(bas)
Attachment #790349 -
Flags: review?(bas)
Assignee | ||
Updated•11 years ago
|
Attachment #786342 -
Attachment description: bug895905-multi.patch → Part 1 - Inform APZC about scroll events on B2G
Assignee | ||
Updated•11 years ago
|
Attachment #787791 -
Attachment description: bug895905-multi-part2.patch → Part 2 - Eliminate some of the special handling of ROOT_SCROLL_ID
Assignee | ||
Updated•11 years ago
|
Attachment #790349 -
Attachment description: bug895905-multi-gcc47fix.patch → Part 3 - Fix a compiler error on GCC 4.7
Assignee | ||
Updated•11 years ago
|
Attachment #781873 -
Attachment description: small documentation improvement → Part 4 - Small documentation improvement
Updated•11 years ago
|
Attachment #790349 -
Flags: review?(bas) → review+
Assignee | ||
Comment 30•11 years ago
|
||
Attachment #786342 -
Attachment is obsolete: true
Attachment #790902 -
Flags: review+
Assignee | ||
Comment 31•11 years ago
|
||
Attachment #787791 -
Attachment is obsolete: true
Attachment #790905 -
Flags: review+
Assignee | ||
Comment 32•11 years ago
|
||
Attachment #790349 -
Attachment is obsolete: true
Attachment #790911 -
Flags: review+
Assignee | ||
Comment 33•11 years ago
|
||
Attachment #781873 -
Attachment is obsolete: true
Attachment #790913 -
Flags: review+
Assignee | ||
Comment 34•11 years ago
|
||
Rebased all patches to apply to latest central. Carrying r+ for them.
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 35•11 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/8be61e224a9c
https://hg.mozilla.org/integration/b2g-inbound/rev/86305651c6b8
https://hg.mozilla.org/integration/b2g-inbound/rev/4d31a403f50f
https://hg.mozilla.org/integration/b2g-inbound/rev/15405875bf62
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/8be61e224a9c
https://hg.mozilla.org/mozilla-central/rev/86305651c6b8
https://hg.mozilla.org/mozilla-central/rev/4d31a403f50f
https://hg.mozilla.org/mozilla-central/rev/15405875bf62
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Comment 37•11 years ago
|
||
Comment on attachment 790913 [details] [diff] [review]
Part 4 - Small documentation improvement
Review of attachment 790913 [details] [diff] [review]:
-----------------------------------------------------------------
> Document that ns[Int]Point stores coordinates in app units.
In the future, please be more careful with your commit messages. This is not true about nsIntPoint, and doesn't reflect the patch.
Assignee | ||
Comment 38•11 years ago
|
||
(In reply to :Ms2ger from comment #37)
> Comment on attachment 790913 [details] [diff] [review]
> Part 4 - Small documentation improvement
>
> Review of attachment 790913 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> > Document that ns[Int]Point stores coordinates in app units.
>
> In the future, please be more careful with your commit messages. This is not
> true about nsIntPoint, and doesn't reflect the patch.
Sorry about that. I initially made the mistake of thinking nsIntPoint was also in app units, then corrected the patch but forgot to also correct the commit messages. I will certainly be more careful next time.
Is there a way to correct the commit message? Some equivalent of "svn propedit --revprop svn.log"?
You need to log in
before you can comment on or make changes to this bug.
Description
•