From 41393c974dc0ebfc6b850b3f0247d867554f259c Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 6 Feb 2015 09:26:44 -0500 Subject: [PATCH] Bug 1130129 - Better handle a case where the APZ hit-test disagrees with the main-thread hit-test results. r=botond --- dom/ipc/TabParent.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 218ab3e43408..021fd95475c0 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2419,6 +2419,17 @@ TabParent::MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent, // id. if (aOutTargetGuid) { *aOutTargetGuid = InputAPZContext::GetTargetLayerGuid(); + + // There may be cases where the APZ hit-testing code came to a different + // conclusion than the main-thread hit-testing code as to where the event + // is destined. In such cases the layersId of the APZ result may not match + // the layersId of this renderframe. In such cases the main-thread hit- + // testing code "wins" so we need to update the guid to reflect this. + if (RenderFrameParent* rfp = GetRenderFrame()) { + if (aOutTargetGuid->mLayersId != rfp->GetLayersId()) { + *aOutTargetGuid = ScrollableLayerGuid(rfp->GetLayersId(), 0, FrameMetrics::NULL_SCROLL_ID); + } + } } if (aOutInputBlockId) { *aOutInputBlockId = InputAPZContext::GetInputBlockId();