From 77a19465e357c42940d6266403f1e5f93555f814 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Mon, 8 Aug 2016 15:24:11 -0400 Subject: [PATCH] Bug 1290823 - Send Gesture:SingleTap even if we're in a chrome document. r=rbarker MozReview-Commit-ID: 8fRAVdUpM9j --HG-- extra : rebase_source : 1e29b96467390b2d11b4b1f8976eda1e4fe9aca0 --- widget/android/AndroidContentController.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/widget/android/AndroidContentController.cpp b/widget/android/AndroidContentController.cpp index f6cfeb4f6d46..5198ffb2c0b5 100644 --- a/widget/android/AndroidContentController.cpp +++ b/widget/android/AndroidContentController.cpp @@ -48,21 +48,22 @@ AndroidContentController::DispatchSingleTapToObservers(const LayoutDevicePoint& const ScrollableLayerGuid& aGuid) const { nsIContent* content = nsLayoutUtils::FindContentFor(aGuid.mScrollId); - nsIPresShell* shell = content - ? mozilla::layers::APZCCallbackHelper::GetRootContentDocumentPresShellForContent(content) + nsPresContext* context = content + ? mozilla::layers::APZCCallbackHelper::GetPresContextForContent(content) : nullptr; - if (!shell || !shell->GetPresContext()) { - return; + if (!context) { + return; } CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform( - aPoint / shell->GetPresContext()->CSSToDevPixelScale(), aGuid); + aPoint / context->CSSToDevPixelScale(), aGuid); - if (shell->ScaleToResolution()) { + nsPresContext* rcdContext = context->GetToplevelContentDocumentPresContext(); + if (rcdContext && rcdContext->PresShell()->ScaleToResolution()) { // We need to convert from the root document to the root content document, // by unapplying the resolution that's on the content document. - const float resolution = shell->GetResolution(); + const float resolution = rcdContext->PresShell()->GetResolution(); point.x /= resolution; point.y /= resolution; }