mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1152479 - In C++ APZ code, use nsContentUtils rather than nsIDOMWindowUtils to send key and mouse events. r=kats
--HG-- extra : source : c989db3f7a0a41682429a0febfa8c51f2bb99e7f
This commit is contained in:
parent
daec5fa621
commit
899a1634f6
@ -2114,7 +2114,7 @@ bool
|
||||
TabChild::RecvHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId)
|
||||
{
|
||||
if (mGlobal && mTabChildGlobal) {
|
||||
mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aModifiers, aGuid,
|
||||
mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, GetPresShellResolution());
|
||||
}
|
||||
return true;
|
||||
@ -2165,7 +2165,7 @@ TabChild::RecvMouseEvent(const nsString& aType,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aIgnoreRootScrollFrame)
|
||||
{
|
||||
APZCCallbackHelper::DispatchMouseEvent(GetDOMWindowUtils(), aType, CSSPoint(aX, aY),
|
||||
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType, CSSPoint(aX, aY),
|
||||
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
|
||||
return true;
|
||||
}
|
||||
@ -2328,7 +2328,7 @@ TabChild::FireContextMenuEvent()
|
||||
|
||||
MOZ_ASSERT(mTapHoldTimer && mActivePointerId >= 0);
|
||||
bool defaultPrevented = APZCCallbackHelper::DispatchMouseEvent(
|
||||
GetDOMWindowUtils(),
|
||||
GetPresShell(),
|
||||
NS_LITERAL_STRING("contextmenu"),
|
||||
mGestureDownPoint / CSSToLayoutDeviceScale(scale),
|
||||
2 /* Right button */,
|
||||
@ -2526,11 +2526,9 @@ TabChild::RecvKeyEvent(const nsString& aType,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aPreventDefault)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
NS_ENSURE_TRUE(utils, true);
|
||||
bool ignored = false;
|
||||
utils->SendKeyEvent(aType, aKeyCode, aCharCode,
|
||||
aModifiers, aPreventDefault, &ignored);
|
||||
nsContentUtils::SendKeyEvent(mWidget, aType, aKeyCode, aCharCode,
|
||||
aModifiers, aPreventDefault, &ignored);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ APZCCallbackHelper::DispatchSynthesizedMouseEvent(uint32_t aMsg,
|
||||
}
|
||||
|
||||
bool
|
||||
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const nsString& aType,
|
||||
const CSSPoint& aPoint,
|
||||
int32_t aButton,
|
||||
@ -442,11 +442,12 @@ APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils
|
||||
bool aIgnoreRootScrollFrame,
|
||||
unsigned short aInputSourceArg)
|
||||
{
|
||||
NS_ENSURE_TRUE(aUtils, true);
|
||||
NS_ENSURE_TRUE(aPresShell, true);
|
||||
|
||||
bool defaultPrevented = false;
|
||||
aUtils->SendMouseEvent(aType, aPoint.x, aPoint.y, aButton, aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame, 0, aInputSourceArg, false, 4, &defaultPrevented);
|
||||
nsContentUtils::SendMouseEvent(aPresShell, aType, aPoint.x, aPoint.y,
|
||||
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, 0,
|
||||
aInputSourceArg, false, &defaultPrevented, false);
|
||||
return defaultPrevented;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
|
||||
/* Dispatch a mouse event with the given parameters.
|
||||
* Return whether or not any listeners have called preventDefault on the event. */
|
||||
static bool DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
static bool DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const nsString& aType,
|
||||
const CSSPoint& aPoint,
|
||||
int32_t aButton,
|
||||
|
@ -190,7 +190,7 @@ APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
|
||||
}
|
||||
|
||||
void
|
||||
APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
APZEventState::ProcessLongTap(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const CSSPoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
@ -211,7 +211,7 @@ APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
// just converts them back to widget format, but that API has many callers,
|
||||
// including in JS code, so it's not trivial to change.
|
||||
bool eventHandled =
|
||||
APZCCallbackHelper::DispatchMouseEvent(aUtils, NS_LITERAL_STRING("contextmenu"),
|
||||
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
|
||||
APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid, aPresShellResolution),
|
||||
2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "nsRefPtr.h"
|
||||
|
||||
template <class> class nsCOMPtr;
|
||||
class nsIDOMWindowUtils;
|
||||
class nsIPresShell;
|
||||
class nsIWidget;
|
||||
|
||||
namespace mozilla {
|
||||
@ -53,7 +53,7 @@ public:
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
float aPresShellResolution);
|
||||
void ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
void ProcessLongTap(const nsCOMPtr<nsIPresShell>& aUtils,
|
||||
const CSSPoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
@ -179,7 +179,7 @@ ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, Modifier
|
||||
return;
|
||||
}
|
||||
|
||||
mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aModifiers, aGuid,
|
||||
mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, GetPresShellResolution());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user