Closed Bug 934420 Opened 11 years ago Closed 11 years ago

APZC scrolling stops working if page layout changes during a scroll

Categories

(Core :: Panning and Zooming, defect)

26 Branch
x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: jimm, Assigned: kats)

References

Details

(Whiteboard: [block28])

Attachments

(2 files, 1 obsolete file)

STR: 1) open facebook or a local search on bing.com that includes a map 2) scroll the page down until the ad panel on fb or map on bing shifts result: scrolling will stop. I'll try to work up a simplified test case for this.
On bing.com, the element that shifts is a div, id = 'wpc_ag'. You can find this through desktop dev tools.
Attached file stationarydiv.html
test case
Whiteboard: [triage] → [block28][triage]
Whiteboard: [block28][triage] → [block28]
Botond, if you have some time, can you look into what's going on here?
Flags: needinfo?(botond)
With the DEBUG_CONTROLLER #define turned on in APZController.cpp we get the log below. When scrolling breaks (see bottom of log), we're calling MetroAppShell::MarkEventQueueForPurge from MetroInput::OnPointerReleased. Not sure why we receive a PointerReleased event (yet), but this looks wrong. [...] APZController: detected subframe or content editable APZController::UpdateScrollOffset: 0 131 == 0 0 APZController::RequestContentRepaint scroll id = 1 APZController: mScrollOffset: 0.000000 224.883316 WARNING: huh? IsTab should always get a sub document for a parameter: file c:/mo zilla/mozilla-central/widget/windows/winrt/APZController.cpp, line 42 APZController: detected subframe or content editable APZController::UpdateScrollOffset: 0 225 == 0 0 APZController::RequestContentRepaint scroll id = 1 APZController: mScrollOffset: 0.000000 296.666626 WARNING: huh? IsTab should always get a sub document for a parameter: file c:/mo zilla/mozilla-central/widget/windows/winrt/APZController.cpp, line 42 APZController: detected subframe or content editable APZController::UpdateScrollOffset: 0 297 == 0 0 APZController::RequestContentRepaint scroll id = 1 APZController: mScrollOffset: 0.000000 353.616669 WARNING: huh? IsTab should always get a sub document for a parameter: file c:/mo zilla/mozilla-central/widget/windows/winrt/APZController.cpp, line 42 APZController: detected subframe or content editable APZController::UpdateScrollOffset: 0 353 == 0 0 MetroAppShell::MarkEventQueueForPurge MetroAppShell::DispatchAllGeckoEvents mozilla::widget::winrt::FrameworkView::OnWindowActivated mozilla::widget::winrt::MetroApp::OnSuspending: IsMainThread:1 ThreadId:147C
(In reply to Stephen Pohl [:spohl] from comment #4) > With the DEBUG_CONTROLLER #define turned on in APZController.cpp we get the > log below. When scrolling breaks (see bottom of log), we're calling > MetroAppShell::MarkEventQueueForPurge from MetroInput::OnPointerReleased. > Not sure why we receive a PointerReleased event (yet), but this looks wrong. My mistake, this PointerReleased event is fired when I release the screen to switch back to Desktop view, so is expected. By turning on DEBUG_INPUT in MetroInput.cpp I can now see that MetroInput::OnPointerMoved events continue to be dispatched even after the page stops scrolling, which is good. However, we no longer get calls to APZController::RequestContentRepaint, or any other APZController method.
When this breaks, the GeckoContentController is suddenly NULL here [1]. Consequently, we can no longer post the GeckoContentController::RequestContentRepaint task [2]. [1] http://mxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/AsyncPanZoomController.cpp#1136 [2] http://mxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/AsyncPanZoomController.cpp#1139
That sounds like we're using a destroyed APZC instance.
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #7) > That sounds like we're using a destroyed APZC instance. It does. We do indeed destroy the instance that we previously interacted with here [1]. [1] http://mxr.mozilla.org/mozilla-central/source/gfx/layers/composite/APZCTreeManager.cpp#95
In this bug does the scrolling start working again, or does it stay stopped completely? If it's only the one scroll/fling that aborts then this might just be expected behaviour.
It does start working again after releasing the screen and touching it again.
So then this is likely expected behaviour, although perhaps not very desirable. The reason it's happening is that the relayout changes the layer structure sufficiently that we have to throw away and re-create the APZC tree. needinfo'ing mattwoodrow because retaining the layer structure in the face of relayouts is his area of expertise. Matt, given the attached test case, is the layer retention supposed to work?
Flags: needinfo?(botond) → needinfo?(matt.woodrow)
You can also reproduce this on facebook (due to the add panel on the right), and bing local with maps.
Attached patch WIP (obsolete) — Splinter Review
This patch handles this use case on the APZ side, by re-associating the same APZC instance with the new layer even in the face of layer tree changes. However to make it work we need to check the presshell id as well which will break B2G. We need to fix B2G to propagate the presshell id everywhere before we can land this. Plus this needs more testing etc.
Flags: needinfo?(matt.woodrow)
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #13) > We need to fix B2G to propagate the presshell id everywhere > before we can land this. Do we have a bug tracking this? It might make a nice refactoring item.
Filed bug 937688 for it.
Depends on: 937688
Assignee: nobody → bugmail.mozilla
Attached patch PatchSplinter Review
This seems to fix the problem just fine on Metro and doesn't have any other adverse effects as far as I can tell. Try run at https://tbpl.mozilla.org/?tree=Try&rev=aad7e383de59
Attachment #830504 - Attachment is obsolete: true
Attachment #831976 - Flags: review?(botond)
Comment on attachment 831976 [details] [diff] [review] Patch This fixed scrolling on facebook, bing local w/maps, and the little recent news thumbnail scroller on the bing homepage. :)
Attachment #831976 - Flags: feedback+
Comment on attachment 831976 [details] [diff] [review] Patch Review of attachment 831976 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/layers/ipc/AsyncPanZoomController.cpp @@ +1540,5 @@ > bool AsyncPanZoomController::Matches(const ScrollableLayerGuid& aGuid) > { > + return aGuid.mLayersId == mLayersId > + && aGuid.mPresShellId == mFrameMetrics.mPresShellId > + && aGuid.mScrollId == mFrameMetrics.mScrollId; Can we give ScrollableLayerGuid an operator==?
Attachment #831976 - Flags: review?(botond) → review+
It has one already, but in this case I would need to create a temporary ScrollableLayerGuid for the APZC instance to do the comparison. Do you think it's worth doing that?
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #19) > It has one already, but in this case I would need to create a temporary > ScrollableLayerGuid for the APZC instance to do the comparison. Do you think > it's worth doing that? I have no strong feelings either way.
After some deep soul-searching I decided it would a better reuse of code to create the temporary instance and then == it. Hopefully the compiler will inline that anyway. https://hg.mozilla.org/integration/b2g-inbound/rev/c45a4d2d13b5
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: