void APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument, ViewID aViewId, APZStateChange aChange, int aArg) { switch (aChange) { case APZStateChange::TransformBegin: { nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId); if (sf) { sf->SetTransformingByAPZ(true); } nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf); if (scrollbarMediator) { scrollbarMediator->ScrollbarActivityStarted(); } if (aDocument && mActiveAPZTransforms == 0) { nsCOMPtr<nsIDocShell> docshell(aDocument->GetDocShell()); if (docshell && sf) { nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get()); nsdocshell->NotifyAsyncPanZoomStarted(); } } mActiveAPZTransforms++; break; } case APZStateChange::TransformEnd: { mActiveAPZTransforms--; nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId); if (sf) { sf->SetTransformingByAPZ(false); } nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf); if (scrollbarMediator) { scrollbarMediator->ScrollbarActivityStopped(); } if (aDocument && mActiveAPZTransforms == 0) { nsCOMPtr<nsIDocShell> docshell(aDocument->GetDocShell()); if (docshell && sf) { nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get()); nsdocshell->NotifyAsyncPanZoomStopped(); } } break; } case APZStateChange::StartTouch: { mActiveElementManager->HandleTouchStart(aArg); break; } case APZStateChange::StartPanning: { mActiveElementManager->HandlePanStart(); break; } case APZStateChange::EndTouch: { mEndTouchIsClick = aArg; mActiveElementManager->HandleTouchEnd(); break; } default: // APZStateChange has a 'sentinel' value, and the compiler complains // if an enumerator is not handled and there is no 'default' case. break; } }
nsIDocShell * Location::GetDocShell() { nsCOMPtr<nsIDocShell> docshell(do_QueryReferent(mDocShell)); return docshell; }
void APZEventState::ProcessAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg) { switch (aChange) { case APZStateChange::eTransformBegin: { nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId); if (sf) { sf->SetTransformingByAPZ(true); } nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf); if (scrollbarMediator) { scrollbarMediator->ScrollbarActivityStarted(); } nsIContent* content = nsLayoutUtils::FindContentFor(aViewId); nsIDocument* doc = content ? content->GetComposedDoc() : nullptr; nsCOMPtr<nsIDocShell> docshell(doc ? doc->GetDocShell() : nullptr); if (docshell && sf) { nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get()); nsdocshell->NotifyAsyncPanZoomStarted(); } break; } case APZStateChange::eTransformEnd: { nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId); if (sf) { sf->SetTransformingByAPZ(false); } nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf); if (scrollbarMediator) { scrollbarMediator->ScrollbarActivityStopped(); } nsIContent* content = nsLayoutUtils::FindContentFor(aViewId); nsIDocument* doc = content ? content->GetComposedDoc() : nullptr; nsCOMPtr<nsIDocShell> docshell(doc ? doc->GetDocShell() : nullptr); if (docshell && sf) { nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get()); nsdocshell->NotifyAsyncPanZoomStopped(); } break; } case APZStateChange::eStartTouch: { mActiveElementManager->HandleTouchStart(aArg); break; } case APZStateChange::eStartPanning: { // The user started to pan, so we don't want anything to be :active. mActiveElementManager->ClearActivation(); break; } case APZStateChange::eEndTouch: { mEndTouchIsClick = aArg; mActiveElementManager->HandleTouchEnd(); break; } case APZStateChange::eSentinel: // Should never happen, but we want this case branch to stop the compiler // whining about unhandled values. MOZ_ASSERT(false); break; } }