Bug 1290823 - Send Gesture:SingleTap even if we're in a chrome document. r=rbarker a=ritu
authorBotond Ballo <botond@mozilla.com>
Mon, 08 Aug 2016 15:24:11 -0400
changeset 347635 3237f302d6788b819e78a540a8a6165e48dbfd1f
parent 347634 285042c2d340a0f8d0314793ebfc24e040441883
child 347636 fd3bb47e076f05259436a1f7af5985d7d399ff80
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrbarker, ritu
bugs1290823
milestone50.0a2
Bug 1290823 - Send Gesture:SingleTap even if we're in a chrome document. r=rbarker a=ritu MozReview-Commit-ID: 8fRAVdUpM9j
widget/android/AndroidContentController.cpp
--- a/widget/android/AndroidContentController.cpp
+++ b/widget/android/AndroidContentController.cpp
@@ -43,31 +43,32 @@ AndroidContentController::NotifyDefaultP
     aManager->ContentReceivedInputBlock(aInputBlockId, aDefaultPrevented);
 }
 
 void
 AndroidContentController::DispatchSingleTapToObservers(const LayoutDevicePoint& aPoint,
                                                        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;
     }
 
     CSSIntPoint rounded = RoundedToInt(point);
     nsAppShell::PostEvent([rounded] {
         nsCOMPtr<nsIObserverService> obsServ =
             mozilla::services::GetObserverService();