mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920425 part.29 Use mozilla::WidgetEvent::AsGUIEvent() r=smaug
This commit is contained in:
parent
40483897f3
commit
c0d498bd0f
@ -517,7 +517,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_GUI_EVENT:
|
||||
{
|
||||
WidgetGUIEvent* oldGUIEvent = static_cast<WidgetGUIEvent*>(mEvent);
|
||||
WidgetGUIEvent* oldGUIEvent = mEvent->AsGUIEvent();
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetGUIEvent* guiEvent = new WidgetGUIEvent(false, msg, nullptr);
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
@ -677,7 +677,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_SVGZOOM_EVENT:
|
||||
{
|
||||
WidgetGUIEvent* oldGUIEvent = static_cast<WidgetGUIEvent*>(mEvent);
|
||||
WidgetGUIEvent* oldGUIEvent = mEvent->AsGUIEvent();
|
||||
WidgetGUIEvent* guiEvent = new WidgetGUIEvent(false, msg, nullptr);
|
||||
guiEvent->eventStructType = NS_SVGZOOM_EVENT;
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
@ -1026,7 +1026,7 @@ nsDOMEvent::GetScreenCoords(nsPresContext* aPresContext,
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
WidgetGUIEvent* guiEvent = static_cast<WidgetGUIEvent*>(aEvent);
|
||||
WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
|
||||
if (!guiEvent->widget) {
|
||||
return LayoutDeviceIntPoint::ToUntyped(aPoint);
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!aPresContext ||
|
||||
!static_cast<WidgetGUIEvent*>(aEvent)->widget) {
|
||||
!aEvent->AsGUIEvent()->widget) {
|
||||
return aDefaultPoint;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!(static_cast<WidgetGUIEvent*>(mEvent)->widget)) {
|
||||
!mEvent->AsGUIEvent()->widget) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,7 @@ public:
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
mozilla::WidgetGUIEvent* event =
|
||||
static_cast<mozilla::WidgetGUIEvent*>(aEvent);
|
||||
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
if (!event->widget) {
|
||||
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
}
|
||||
@ -74,7 +73,7 @@ public:
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!aPresContext ||
|
||||
!static_cast<mozilla::WidgetGUIEvent*>(aEvent)->widget) {
|
||||
!aEvent->AsGUIEvent()->widget) {
|
||||
return aDefaultClientPoint
|
||||
? *aDefaultClientPoint
|
||||
: CSSIntPoint(0, 0);
|
||||
|
@ -697,7 +697,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
case NS_UI_EVENT:
|
||||
return NS_NewDOMUIEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
aEvent->AsGUIEvent());
|
||||
case NS_SCROLLAREA_EVENT:
|
||||
return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsScrollAreaEvent());
|
||||
@ -730,7 +730,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
aEvent->AsClipboardEvent());
|
||||
case NS_SVGZOOM_EVENT:
|
||||
return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
aEvent->AsGUIEvent());
|
||||
case NS_SMIL_TIME_EVENT:
|
||||
return NS_NewDOMTimeEvent(aDOMEvent, aOwner, aPresContext, aEvent);
|
||||
|
||||
|
@ -501,7 +501,7 @@ nsMouseWheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||
if (IsMouseEventReal(aEvent)) {
|
||||
// If the cursor is moving to be outside the frame,
|
||||
// terminate the scrollwheel transaction.
|
||||
nsIntPoint pt = GetScreenPoint(static_cast<WidgetGUIEvent*>(aEvent));
|
||||
nsIntPoint pt = GetScreenPoint(aEvent->AsGUIEvent());
|
||||
nsIntRect r = sTargetFrame->GetScreenRectExternal();
|
||||
if (!r.Contains(pt)) {
|
||||
EndTransaction();
|
||||
@ -3997,7 +3997,7 @@ public:
|
||||
nsIFrame* frame = aVisitor.mPresContext->GetPrimaryFrameFor(mTarget);
|
||||
if (frame) {
|
||||
frame->HandleEvent(aVisitor.mPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aVisitor.mEvent),
|
||||
aVisitor.mEvent->AsGUIEvent(),
|
||||
&aVisitor.mEventStatus);
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
|
||||
EnsureTextCompositionArray();
|
||||
|
||||
WidgetGUIEvent* GUIEvent = static_cast<WidgetGUIEvent*>(aEvent);
|
||||
WidgetGUIEvent* GUIEvent = aEvent->AsGUIEvent();
|
||||
|
||||
TextComposition* composition =
|
||||
sTextCompositions->GetCompositionFor(GUIEvent->widget);
|
||||
|
@ -1830,9 +1830,10 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
#endif
|
||||
|
||||
if (mInstance) {
|
||||
WidgetEvent* event = aKeyEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_KEY_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
|
||||
WidgetKeyboardEvent* keyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (keyEvent && keyEvent->eventStructType == NS_KEY_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*keyEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->StopPropagation();
|
||||
@ -1888,14 +1889,15 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
if (!mWidgetVisible)
|
||||
return NS_OK;
|
||||
|
||||
WidgetEvent* event = aMouseEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->StopPropagation();
|
||||
}
|
||||
if (event->message == NS_MOUSE_BUTTON_UP) {
|
||||
if (mouseEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
mLastMouseDownButtonType = -1;
|
||||
}
|
||||
}
|
||||
|
@ -1323,10 +1323,9 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const WidgetEvent* aEvent,
|
||||
aEvent->eventStructType != NS_QUERY_CONTENT_EVENT))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
const WidgetGUIEvent* GUIEvent = static_cast<const WidgetGUIEvent*>(aEvent);
|
||||
return GetEventCoordinatesRelativeTo(aEvent,
|
||||
LayoutDeviceIntPoint::ToUntyped(GUIEvent->refPoint),
|
||||
aFrame);
|
||||
LayoutDeviceIntPoint::ToUntyped(aEvent->AsGUIEvent()->refPoint),
|
||||
aFrame);
|
||||
}
|
||||
|
||||
nsPoint
|
||||
@ -1338,8 +1337,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const WidgetEvent* aEvent,
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
}
|
||||
|
||||
const WidgetGUIEvent* GUIEvent = static_cast<const WidgetGUIEvent*>(aEvent);
|
||||
nsIWidget* widget = GUIEvent->widget;
|
||||
nsIWidget* widget = aEvent->AsGUIEvent()->widget;
|
||||
if (!widget) {
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ public:
|
||||
}
|
||||
if (frame) {
|
||||
frame->HandleEvent(aVisitor.mPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aVisitor.mEvent),
|
||||
aVisitor.mEvent->AsGUIEvent(),
|
||||
&aVisitor.mEventStatus);
|
||||
}
|
||||
}
|
||||
|
@ -823,8 +823,7 @@ nsSliderFrame::StartDrag(nsIDOMEvent* aEvent)
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
return NS_OK;
|
||||
|
||||
WidgetGUIEvent *event =
|
||||
static_cast<WidgetGUIEvent*>(aEvent->GetInternalNSEvent());
|
||||
WidgetGUIEvent* event = aEvent->GetInternalNSEvent()->AsGUIEvent();
|
||||
|
||||
if (!ShouldScrollForEvent(event)) {
|
||||
return NS_OK;
|
||||
|
@ -498,7 +498,7 @@ nsXULPopupManager::InitTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup,
|
||||
if ((event->eventStructType == NS_MOUSE_EVENT ||
|
||||
event->eventStructType == NS_MOUSE_SCROLL_EVENT ||
|
||||
event->eventStructType == NS_WHEEL_EVENT) &&
|
||||
!(static_cast<WidgetGUIEvent*>(event))->widget) {
|
||||
!event->AsGUIEvent()->widget) {
|
||||
// no widget, so just use the client point if available
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
|
||||
nsIntPoint clientPt;
|
||||
@ -1769,14 +1769,6 @@ nsXULPopupManager::CancelMenuTimer(nsMenuParent* aMenuParent)
|
||||
}
|
||||
}
|
||||
|
||||
static WidgetGUIEvent*
|
||||
DOMKeyEventToGUIEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
WidgetEvent* evt = aEvent ? aEvent->GetInternalNSEvent() : nullptr;
|
||||
return evt && evt->eventStructType == NS_KEY_EVENT ?
|
||||
static_cast<WidgetGUIEvent*>(evt) : nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULPopupManager::HandleShortcutNavigation(nsIDOMKeyEvent* aKeyEvent,
|
||||
nsMenuPopupFrame* aFrame)
|
||||
@ -1791,7 +1783,7 @@ nsXULPopupManager::HandleShortcutNavigation(nsIDOMKeyEvent* aKeyEvent,
|
||||
if (result) {
|
||||
aFrame->ChangeMenuItem(result, false);
|
||||
if (action) {
|
||||
WidgetGUIEvent* evt = DOMKeyEventToGUIEvent(aKeyEvent);
|
||||
WidgetGUIEvent* evt = aKeyEvent->GetInternalNSEvent()->AsGUIEvent();
|
||||
nsMenuFrame* menuToOpen = result->Enter(evt);
|
||||
if (menuToOpen) {
|
||||
nsCOMPtr<nsIContent> content = menuToOpen->GetContent();
|
||||
@ -2024,7 +2016,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
||||
// Otherwise, tell the active menubar, if any, to activate the menu. The
|
||||
// Enter method will return a menu if one needs to be opened as a result.
|
||||
nsMenuFrame* menuToOpen = nullptr;
|
||||
WidgetGUIEvent* GUIEvent = DOMKeyEventToGUIEvent(aKeyEvent);
|
||||
WidgetGUIEvent* GUIEvent = aKeyEvent->GetInternalNSEvent()->AsGUIEvent();
|
||||
if (aTopVisibleMenuItem) {
|
||||
menuToOpen = aTopVisibleMenuItem->Frame()->Enter(GUIEvent);
|
||||
} else if (mActiveMenuBar) {
|
||||
|
Loading…
Reference in New Issue
Block a user