Bug 1290823 - Send Gesture:SingleTap even if we're in a chrome document. r=rbarker
MozReview-Commit-ID: 8fRAVdUpM9j
--- 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();