From 98c8fdcd381e8166724abe3e492bc32012c1bffe Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Tue, 5 May 2020 17:22:01 +0000 Subject: [PATCH] Bug 1634206 - Change the default value of InputAPZContext::sApzResponse to nsEventStatus_eSentinel. r=kats Differential Revision: https://phabricator.services.mozilla.com/D70084 --- dom/ipc/BrowserParent.cpp | 14 ++++++++++++++ gfx/layers/apz/util/InputAPZContext.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp index f9077eeedae3..ce52d5abe278 100644 --- a/dom/ipc/BrowserParent.cpp +++ b/dom/ipc/BrowserParent.cpp @@ -3394,6 +3394,20 @@ void BrowserParent::ApzAwareEventRoutingToChild( } if (aOutApzResponse) { *aOutApzResponse = InputAPZContext::GetApzResponse(); + + // We can get here without there being an InputAPZContext on the stack + // if a non-native event synthesization function (such as + // nsIDOMWindowUtils.sendTouchEvent()) was used in the parent process to + // synthesize an event that's targeting a content process. Such events do + // not go through APZ. Without an InputAPZContext on the stack we pick up + // the default value "eSentinel" which cannot be sent over IPC, so replace + // it with "eIgnore" instead, which what APZ uses when it ignores an + // event. If a caller needs the ability to synthesize a event with a + // different APZ response, a native event synthesization function (such as + // sendNativeTouchPoint()) can be used. + if (*aOutApzResponse == nsEventStatus_eSentinel) { + *aOutApzResponse = nsEventStatus_eIgnore; + } } } else { if (aOutInputBlockId) { diff --git a/gfx/layers/apz/util/InputAPZContext.cpp b/gfx/layers/apz/util/InputAPZContext.cpp index 5085d3fcc1c0..77573221ff38 100644 --- a/gfx/layers/apz/util/InputAPZContext.cpp +++ b/gfx/layers/apz/util/InputAPZContext.cpp @@ -11,7 +11,7 @@ namespace layers { ScrollableLayerGuid InputAPZContext::sGuid; uint64_t InputAPZContext::sBlockId = 0; -nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore; +nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eSentinel; bool InputAPZContext::sPendingLayerization = false; bool InputAPZContext::sRoutedToChildProcess = false;