зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1332195 part.1 Event handlers in TabChild, TabParent and PuppetWidget should use "a" prefix for their arguments r=smaug
MozReview-Commit-ID: 2c7cbOigwfU --HG-- extra : rebase_source : 61ab34ac7c680d68edf3773905ae4bb264045916
This commit is contained in:
Родитель
36ead639f1
Коммит
4db09a4429
|
@ -1825,16 +1825,16 @@ TabChild::UpdateRepeatedKeyEventEndTime(const WidgetKeyboardEvent& aEvent)
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
|
||||
TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& aEvent,
|
||||
const MaybeNativeKeyBinding& aBindings)
|
||||
{
|
||||
if (SkipRepeatedKeyEvent(event)) {
|
||||
if (SkipRepeatedKeyEvent(aEvent)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
AutoCacheNativeKeyCommands autoCache(mPuppetWidget);
|
||||
|
||||
if (event.mMessage == eKeyPress) {
|
||||
if (aEvent.mMessage == eKeyPress) {
|
||||
// If content code called preventDefault() on a keydown event, then we don't
|
||||
// want to process any following keypress events.
|
||||
if (mIgnoreKeyPressEvent) {
|
||||
|
@ -1850,7 +1850,7 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
|
|||
}
|
||||
}
|
||||
|
||||
WidgetKeyboardEvent localEvent(event);
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
|
||||
|
@ -1858,7 +1858,7 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
|
|||
// some incoming events in case event handling took long time.
|
||||
UpdateRepeatedKeyEventEndTime(localEvent);
|
||||
|
||||
if (event.mMessage == eKeyDown) {
|
||||
if (aEvent.mMessage == eKeyDown) {
|
||||
mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
@ -1894,22 +1894,22 @@ TabChild::RecvKeyEvent(const nsString& aType,
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
|
||||
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& aEvent)
|
||||
{
|
||||
WidgetCompositionEvent localEvent(event);
|
||||
WidgetCompositionEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
Unused << SendOnEventNeedingAckHandled(event.mMessage);
|
||||
Unused << SendOnEventNeedingAckHandled(aEvent.mMessage);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
|
||||
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& aEvent)
|
||||
{
|
||||
WidgetSelectionEvent localEvent(event);
|
||||
WidgetSelectionEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
Unused << SendOnEventNeedingAckHandled(event.mMessage);
|
||||
Unused << SendOnEventNeedingAckHandled(aEvent.mMessage);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -1075,25 +1075,26 @@ TabParent::SendKeyEvent(const nsAString& aType,
|
|||
}
|
||||
}
|
||||
|
||||
bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
|
||||
bool
|
||||
TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
event.mRefPoint += GetChildProcessOffset();
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
// When we mouseenter the tab, the tab's cursor should
|
||||
// become the current cursor. When we mouseexit, we stop.
|
||||
if (eMouseEnterIntoWidget == event.mMessage) {
|
||||
if (eMouseEnterIntoWidget == aEvent.mMessage) {
|
||||
mTabSetsCursor = true;
|
||||
if (mCustomCursor) {
|
||||
widget->SetCursor(mCustomCursor, mCustomCursorHotspotX, mCustomCursorHotspotY);
|
||||
} else if (mCursor != nsCursor(-1)) {
|
||||
widget->SetCursor(mCursor);
|
||||
}
|
||||
} else if (eMouseExitFromWidget == event.mMessage) {
|
||||
} else if (eMouseExitFromWidget == aEvent.mMessage) {
|
||||
mTabSetsCursor = false;
|
||||
}
|
||||
}
|
||||
|
@ -1102,15 +1103,15 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
|
|||
uint64_t blockId;
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
|
||||
|
||||
if (eMouseMove == event.mMessage) {
|
||||
if (event.mReason == WidgetMouseEvent::eSynthesized) {
|
||||
return SendSynthMouseMoveEvent(event, guid, blockId);
|
||||
if (eMouseMove == aEvent.mMessage) {
|
||||
if (aEvent.mReason == WidgetMouseEvent::eSynthesized) {
|
||||
return SendSynthMouseMoveEvent(aEvent, guid, blockId);
|
||||
} else {
|
||||
return SendRealMouseMoveEvent(event, guid, blockId);
|
||||
return SendRealMouseMoveEvent(aEvent, guid, blockId);
|
||||
}
|
||||
}
|
||||
|
||||
return SendRealMouseButtonEvent(event, guid, blockId);
|
||||
return SendRealMouseButtonEvent(aEvent, guid, blockId);
|
||||
}
|
||||
|
||||
LayoutDeviceToCSSScale
|
||||
|
@ -1126,22 +1127,24 @@ TabParent::GetLayoutDeviceToCSSScale()
|
|||
}
|
||||
|
||||
bool
|
||||
TabParent::SendRealDragEvent(WidgetDragEvent& event, uint32_t aDragAction,
|
||||
TabParent::SendRealDragEvent(WidgetDragEvent& aEvent, uint32_t aDragAction,
|
||||
uint32_t aDropEffect)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
event.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendRealDragEvent(event, aDragAction, aDropEffect);
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendRealDragEvent(aEvent, aDragAction, aDropEffect);
|
||||
}
|
||||
|
||||
LayoutDevicePoint TabParent::AdjustTapToChildWidget(const LayoutDevicePoint& aPoint)
|
||||
LayoutDevicePoint
|
||||
TabParent::AdjustTapToChildWidget(const LayoutDevicePoint& aPoint)
|
||||
{
|
||||
return aPoint + LayoutDevicePoint(GetChildProcessOffset());
|
||||
}
|
||||
|
||||
bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
|
||||
bool
|
||||
TabParent::SendMouseWheelEvent(WidgetWheelEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
|
@ -1150,8 +1153,8 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
|
|||
ScrollableLayerGuid guid;
|
||||
uint64_t blockId;
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
|
||||
event.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendMouseWheelEvent(event, guid, blockId);
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendMouseWheelEvent(aEvent, guid, blockId);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
@ -1414,38 +1417,43 @@ TabParent::RecvClearNativeTouchSequence(const uint64_t& aObserverId)
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
|
||||
bool
|
||||
TabParent::SendRealKeyEvent(WidgetKeyboardEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
event.mRefPoint += GetChildProcessOffset();
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
|
||||
MaybeNativeKeyBinding bindings;
|
||||
bindings = void_t();
|
||||
if (event.mMessage == eKeyPress) {
|
||||
if (aEvent.mMessage == eKeyPress) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
||||
AutoTArray<mozilla::CommandInt, 4> singleLine;
|
||||
AutoTArray<mozilla::CommandInt, 4> multiLine;
|
||||
AutoTArray<mozilla::CommandInt, 4> richText;
|
||||
|
||||
widget->ExecuteNativeKeyBinding(nsIWidget::NativeKeyBindingsForSingleLineEditor,
|
||||
event, DoCommandCallback, &singleLine);
|
||||
widget->ExecuteNativeKeyBinding(nsIWidget::NativeKeyBindingsForMultiLineEditor,
|
||||
event, DoCommandCallback, &multiLine);
|
||||
widget->ExecuteNativeKeyBinding(nsIWidget::NativeKeyBindingsForRichTextEditor,
|
||||
event, DoCommandCallback, &richText);
|
||||
widget->ExecuteNativeKeyBinding(
|
||||
nsIWidget::NativeKeyBindingsForSingleLineEditor,
|
||||
aEvent, DoCommandCallback, &singleLine);
|
||||
widget->ExecuteNativeKeyBinding(
|
||||
nsIWidget::NativeKeyBindingsForMultiLineEditor,
|
||||
aEvent, DoCommandCallback, &multiLine);
|
||||
widget->ExecuteNativeKeyBinding(
|
||||
nsIWidget::NativeKeyBindingsForRichTextEditor,
|
||||
aEvent, DoCommandCallback, &richText);
|
||||
|
||||
if (!singleLine.IsEmpty() || !multiLine.IsEmpty() || !richText.IsEmpty()) {
|
||||
bindings = NativeKeyBinding(singleLine, multiLine, richText);
|
||||
}
|
||||
}
|
||||
|
||||
return PBrowserParent::SendRealKeyEvent(event, bindings);
|
||||
return PBrowserParent::SendRealKeyEvent(aEvent, bindings);
|
||||
}
|
||||
|
||||
bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
||||
bool
|
||||
TabParent::SendRealTouchEvent(WidgetTouchEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
|
@ -1455,10 +1463,10 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
|||
// confuses remote content and the panning and zooming logic into thinking
|
||||
// that the added touches are part of the touchend/cancel, when actually
|
||||
// they're not.
|
||||
if (event.mMessage == eTouchEnd || event.mMessage == eTouchCancel) {
|
||||
for (int i = event.mTouches.Length() - 1; i >= 0; i--) {
|
||||
if (!event.mTouches[i]->mChanged) {
|
||||
event.mTouches.RemoveElementAt(i);
|
||||
if (aEvent.mMessage == eTouchEnd || aEvent.mMessage == eTouchCancel) {
|
||||
for (int i = aEvent.mTouches.Length() - 1; i >= 0; i--) {
|
||||
if (!aEvent.mTouches[i]->mChanged) {
|
||||
aEvent.mTouches.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1473,13 +1481,13 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
|||
}
|
||||
|
||||
LayoutDeviceIntPoint offset = GetChildProcessOffset();
|
||||
for (uint32_t i = 0; i < event.mTouches.Length(); i++) {
|
||||
event.mTouches[i]->mRefPoint += offset;
|
||||
for (uint32_t i = 0; i < aEvent.mTouches.Length(); i++) {
|
||||
aEvent.mTouches[i]->mRefPoint += offset;
|
||||
}
|
||||
|
||||
return (event.mMessage == eTouchMove) ?
|
||||
PBrowserParent::SendRealTouchMoveEvent(event, guid, blockId, apzResponse) :
|
||||
PBrowserParent::SendRealTouchEvent(event, guid, blockId, apzResponse);
|
||||
return (aEvent.mMessage == eTouchMove) ?
|
||||
PBrowserParent::SendRealTouchMoveEvent(aEvent, guid, blockId, apzResponse) :
|
||||
PBrowserParent::SendRealTouchEvent(aEvent, guid, blockId, apzResponse);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1940,11 +1948,11 @@ TabParent::GetChildProcessOffset()
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& event)
|
||||
TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent)
|
||||
{
|
||||
NS_ENSURE_TRUE(mFrameElement, IPC_OK());
|
||||
|
||||
WidgetKeyboardEvent localEvent(event);
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
// Mark the event as not to be dispatched to remote process again.
|
||||
localEvent.StopCrossProcessForwarding();
|
||||
|
||||
|
@ -2012,20 +2020,20 @@ TabParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent)
|
|||
}
|
||||
|
||||
bool
|
||||
TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
|
||||
TabParent::SendCompositionEvent(WidgetCompositionEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mContentCache.OnCompositionEvent(event)) {
|
||||
if (!mContentCache.OnCompositionEvent(aEvent)) {
|
||||
return true;
|
||||
}
|
||||
return PBrowserParent::SendCompositionEvent(event);
|
||||
return PBrowserParent::SendCompositionEvent(aEvent);
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
|
||||
TabParent::SendSelectionEvent(WidgetSelectionEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
|
@ -2034,11 +2042,11 @@ TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
|
|||
if (!widget) {
|
||||
return true;
|
||||
}
|
||||
mContentCache.OnSelectionEvent(event);
|
||||
if (NS_WARN_IF(!PBrowserParent::SendSelectionEvent(event))) {
|
||||
mContentCache.OnSelectionEvent(aEvent);
|
||||
if (NS_WARN_IF(!PBrowserParent::SendSelectionEvent(aEvent))) {
|
||||
return false;
|
||||
}
|
||||
event.mSucceeded = true;
|
||||
aEvent.mSucceeded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -454,17 +454,17 @@ public:
|
|||
int32_t aCharCode, int32_t aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
bool SendRealMouseEvent(mozilla::WidgetMouseEvent& event);
|
||||
bool SendRealMouseEvent(mozilla::WidgetMouseEvent& aEvent);
|
||||
|
||||
bool SendRealDragEvent(mozilla::WidgetDragEvent& aEvent,
|
||||
uint32_t aDragAction,
|
||||
uint32_t aDropEffect);
|
||||
|
||||
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& event);
|
||||
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& aEvent);
|
||||
|
||||
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
|
||||
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& aEvent);
|
||||
|
||||
bool SendRealTouchEvent(WidgetTouchEvent& event);
|
||||
bool SendRealTouchEvent(WidgetTouchEvent& aEvent);
|
||||
|
||||
bool SendHandleTap(TapType aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
|
@ -512,9 +512,9 @@ public:
|
|||
|
||||
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
|
||||
|
||||
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& event);
|
||||
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& aEvent);
|
||||
|
||||
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& event);
|
||||
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& aEvent);
|
||||
|
||||
bool SendPasteTransferable(const IPCDataTransfer& aDataTransfer,
|
||||
const bool& aIsPrivateData,
|
||||
|
|
|
@ -306,40 +306,40 @@ PuppetWidget::Invalidate(const LayoutDeviceIntRect& aRect)
|
|||
}
|
||||
|
||||
void
|
||||
PuppetWidget::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint)
|
||||
PuppetWidget::InitEvent(WidgetGUIEvent& aEvent, LayoutDeviceIntPoint* aPoint)
|
||||
{
|
||||
if (nullptr == aPoint) {
|
||||
event.mRefPoint = LayoutDeviceIntPoint(0, 0);
|
||||
aEvent.mRefPoint = LayoutDeviceIntPoint(0, 0);
|
||||
} else {
|
||||
// use the point override if provided
|
||||
event.mRefPoint = *aPoint;
|
||||
aEvent.mRefPoint = *aPoint;
|
||||
}
|
||||
event.mTime = PR_Now() / 1000;
|
||||
aEvent.mTime = PR_Now() / 1000;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
|
||||
PuppetWidget::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug_DumpEvent(stdout, event->mWidget, event, "PuppetWidget", 0);
|
||||
debug_DumpEvent(stdout, aEvent->mWidget, aEvent, "PuppetWidget", 0);
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(!mChild || mChild->mWindowType == eWindowType_popup,
|
||||
"Unexpected event dispatch!");
|
||||
|
||||
AutoCacheNativeKeyCommands autoCache(this);
|
||||
if ((event->mFlags.mIsSynthesizedForTests ||
|
||||
event->mFlags.mIsSuppressedOrDelayed) && !mNativeKeyCommandsValid) {
|
||||
WidgetKeyboardEvent* keyEvent = event->AsKeyboardEvent();
|
||||
if ((aEvent->mFlags.mIsSynthesizedForTests ||
|
||||
aEvent->mFlags.mIsSuppressedOrDelayed) && !mNativeKeyCommandsValid) {
|
||||
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
|
||||
if (keyEvent) {
|
||||
mTabChild->RequestNativeKeyBindings(&autoCache, keyEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (event->mClass == eCompositionEventClass) {
|
||||
if (aEvent->mClass == eCompositionEventClass) {
|
||||
// Store the latest native IME context of parent process's widget or
|
||||
// TextEventDispatcher if it's in this process.
|
||||
WidgetCompositionEvent* compositionEvent = event->AsCompositionEvent();
|
||||
WidgetCompositionEvent* compositionEvent = aEvent->AsCompositionEvent();
|
||||
#ifdef DEBUG
|
||||
if (mNativeIMEContext.IsValid() &&
|
||||
mNativeIMEContext != compositionEvent->mNativeIMEContext) {
|
||||
|
@ -357,7 +357,8 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
|
|||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
if (GetCurrentWidgetListener()) {
|
||||
aStatus = GetCurrentWidgetListener()->HandleEvent(event, mUseAttachedEvents);
|
||||
aStatus =
|
||||
GetCurrentWidgetListener()->HandleEvent(aEvent, mUseAttachedEvents);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче