Closed Bug 1110038 Opened 10 years ago Closed 10 years ago

Don't reuse input blocks with dead APZCs

Categories

(Core :: Panning and Zooming, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: dvander, Assigned: dvander)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch fix (obsolete) — Splinter Review
If we have an active input block that's ready for handling, then open a new tab - the confirmed apzc for that input block will be destroyed, but we'll always override the target apzc with the input block's target.

I'm not sure what the intended behavior is. This patch just starts a new input block if the old target is dead.
Attachment #8534853 - Flags: review?(bugmail.mozilla)
Actually, this would never matter for ReceiveTouchInput since it gets explicit "start" messages. So I don't think there's any prior behavior here.
Comment on attachment 8534853 [details] [diff] [review]
fix

Review of attachment 8534853 [details] [diff] [review]:
-----------------------------------------------------------------

(In reply to David Anderson [:dvander] from comment #0)
> If we have an active input block that's ready for handling, then open a new
> tab - the confirmed apzc for that input block will be destroyed, but we'll
> always override the target apzc with the input block's target.
> 
> I'm not sure what the intended behavior is. This patch just starts a new
> input block if the old target is dead.

If I understand correctly the existing code will have the behavior that switching tabs while in the middle of a wheel-scroll will abort the scroll, and your patch will change it so that the scroll will carry over to the new tab. Is that correct? Currently desktop FF does the latter (even though I personally never liked that behavior) so conceptually then your patch is fine. However there are a couple of issues with the code, see below.

::: gfx/layers/apz/src/InputQueue.cpp
@@ +136,5 @@
>                                      const ScrollWheelInput& aEvent,
>                                      uint64_t* aOutInputBlockId) {
>    WheelBlockState* block = nullptr;
>    if (!mInputBlockQueue.IsEmpty()) {
>      block = mInputBlockQueue.LastElement().get()->AsWheelBlock();

You should be able to get rid of the .get() in this line.

@@ +140,5 @@
>      block = mInputBlockQueue.LastElement().get()->AsWheelBlock();
> +
> +    // If the block's APZC has been destroyed, request a new block.
> +    if (block->GetTargetApzc()->IsDestroyed())
> +      block = nullptr;

AsWheelBlock() could return nullptr above, so you should change this if condition to be "if (block && block->....)". Also, braces please.
Attachment #8534853 - Flags: review?(bugmail.mozilla) → review-
Yeah, if you initiate a new wheel event while a new tab is opening, it will carry over to the new tab. If that ends up being problematic we might have to do what the non-APZ code does and base it off a timeout/mouse position change, but for now it seems fine.
Attachment #8534853 - Attachment is obsolete: true
Attachment #8535062 - Flags: review?(bugmail.mozilla)
Attachment #8535062 - Flags: review?(bugmail.mozilla) → review+
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)
> If I understand correctly the existing code will have the behavior that
> switching tabs while in the middle of a wheel-scroll will abort the scroll,
> and your patch will change it so that the scroll will carry over to the new
> tab. Is that correct? Currently desktop FF does the latter (even though I
> personally never liked that behavior)

Interesting, I can't reproduce this behaviour with desktop Firefox.
(In reply to Botond Ballo [:botond] from comment #5)
> Interesting, I can't reproduce this behaviour with desktop Firefox.

Hm, maybe I confused it with the trackpad-based momentum scrolling. That definitely carries across tab switches.
https://hg.mozilla.org/mozilla-central/rev/9a630c125d39
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Blocks: 1110925
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: