Bug 1223310 (part 1) - Pass a LayoutDeviceIntPoint instead of an nsIntPoint to InitEvent(). r=kats.

Also use direct assignment for some LayoutDeviceIntPoint assignments, rather
than doing it field-by-field.

--HG--
extra : rebase_source : cff1ec8f1ed3ab1924a07d2227044f646019f0cf
This commit is contained in:
Nicholas Nethercote 2015-11-09 21:37:32 -08:00
Родитель 426e42e7f9
Коммит 9895f2b525
15 изменённых файлов: 35 добавлений и 43 удалений

Просмотреть файл

@ -6679,8 +6679,7 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
WidgetPointerEvent event(touchEvent->mFlags.mIsTrusted, pointerMessage, touchEvent->widget);
event.isPrimary = i == 0;
event.pointerId = touch->Identifier();
event.refPoint.x = touch->mRefPoint.x;
event.refPoint.y = touch->mRefPoint.y;
event.refPoint = touch->mRefPoint;
event.modifiers = touchEvent->modifiers;
event.width = touch->RadiusX();
event.height = touch->RadiusY();

Просмотреть файл

@ -287,16 +287,14 @@ PuppetWidget::Invalidate(const nsIntRect& aRect)
}
void
PuppetWidget::InitEvent(WidgetGUIEvent& event, nsIntPoint* aPoint)
PuppetWidget::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint)
{
if (nullptr == aPoint) {
event.refPoint.x = 0;
event.refPoint.y = 0;
}
else {
} else {
// use the point override if provided
event.refPoint.x = aPoint->x;
event.refPoint.y = aPoint->y;
event.refPoint = *aPoint;
}
event.time = PR_Now() / 1000;
}

Просмотреть файл

@ -132,7 +132,8 @@ public:
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
{ return LayoutDeviceIntPoint::FromUntyped(GetWindowPosition() + GetChromeDimensions()); }
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
void InitEvent(WidgetGUIEvent& aEvent,
mozilla::LayoutDeviceIntPoint* aPoint = nullptr);
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;

Просмотреть файл

@ -1228,11 +1228,10 @@ nsWindow::OnSizeChanged(const gfx::IntSize& aSize)
}
void
nsWindow::InitEvent(WidgetGUIEvent& event, nsIntPoint* aPoint)
nsWindow::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint)
{
if (aPoint) {
event.refPoint.x = aPoint->x;
event.refPoint.y = aPoint->y;
event.refPoint = *aPoint;
} else {
event.refPoint.x = 0;
event.refPoint.y = 0;

Просмотреть файл

@ -62,7 +62,8 @@ public:
void OnSizeChanged(const mozilla::gfx::IntSize& aSize);
void InitEvent(mozilla::WidgetGUIEvent& event, nsIntPoint* aPoint = 0);
void InitEvent(mozilla::WidgetGUIEvent& event,
mozilla::LayoutDeviceIntPoint* aPoint = 0);
//
// nsIWidget

Просмотреть файл

@ -431,8 +431,7 @@ nsBaseDragService::FireDragEventAtSource(EventMessage aEventMessage)
WidgetDragEvent event(true, aEventMessage, nullptr);
event.inputSource = mInputSource;
if (aEventMessage == eDragEnd) {
event.refPoint.x = mEndDragPoint.x;
event.refPoint.y = mEndDragPoint.y;
event.refPoint = mEndDragPoint;
event.userCancelled = mUserCancelled;
}

Просмотреть файл

@ -1251,7 +1251,7 @@ IMMHandler::HandleStartComposition(nsWindow* aWindow,
mCursorPosition = NO_IME_CARET;
WidgetCompositionEvent event(true, eCompositionStart, aWindow);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
aWindow->InitEvent(event, &point);
aWindow->DispatchWindowEvent(&event);
@ -1527,7 +1527,7 @@ IMMHandler::HandleEndComposition(nsWindow* aWindow,
EventMessage message =
aCommitString ? eCompositionCommit : eCompositionCommitAsIs;
WidgetCompositionEvent compositionCommitEvent(true, message, aWindow);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
aWindow->InitEvent(compositionCommitEvent, &point);
if (aCommitString) {
compositionCommitEvent.mData = *aCommitString;
@ -1693,7 +1693,7 @@ IMMHandler::HandleDocumentFeed(nsWindow* aWindow,
*oResult = 0;
RECONVERTSTRING* pReconv = reinterpret_cast<RECONVERTSTRING*>(lParam);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
bool hasCompositionString =
mIsComposing && ShouldDrawCompositionStringOurselves();
@ -1895,7 +1895,7 @@ IMMHandler::DispatchCompositionChangeEvent(nsWindow* aWindow,
RefPtr<nsWindow> kungFuDeathGrip(aWindow);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
WidgetCompositionEvent event(true, eCompositionChange, aWindow);
@ -2098,7 +2098,7 @@ IMMHandler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow,
nsIntRect& aCharRect,
WritingMode* aWritingMode)
{
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
Selection& selection = GetSelection();
if (!selection.EnsureValidSelection(aWindow)) {
@ -2192,7 +2192,7 @@ IMMHandler::GetCaretRect(nsWindow* aWindow,
nsIntRect& aCaretRect,
WritingMode* aWritingMode)
{
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
Selection& selection = GetSelection();
if (!selection.EnsureValidSelection(aWindow)) {
@ -2753,7 +2753,7 @@ IMMHandler::Selection::Init(nsWindow* aWindow)
Clear();
WidgetQueryContentEvent selection(true, eQuerySelectedText, aWindow);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
aWindow->InitEvent(selection, &point);
aWindow->DispatchWindowEvent(&selection);
if (NS_WARN_IF(!selection.mSucceeded)) {

Просмотреть файл

@ -1140,7 +1140,7 @@ void
NativeKey::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
const ModifierKeyState& aModKeyState) const
{
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
mWidget->InitEvent(aKeyEvent, &point);
switch (aKeyEvent.mMessage) {

Просмотреть файл

@ -3380,9 +3380,9 @@ TSFTextStore::GetACPFromPoint(TsViewCookie vcView,
return TS_E_NOLAYOUT;
}
nsIntPoint ourPt(pt->x, pt->y);
LayoutDeviceIntPoint ourPt(pt->x, pt->y);
// Convert to widget relative coordinates from screen's.
ourPt -= mWidget->WidgetToScreenOffsetUntyped();
ourPt -= mWidget->WidgetToScreenOffset();
// NOTE: Don't check if the point is in the widget since the point can be
// outside of the widget if focused editor is in a XUL <panel>.

Просмотреть файл

@ -319,10 +319,10 @@ MouseScrollHandler::SynthesizeNativeMouseScrollEvent(nsWindowBase* aWidget,
void
MouseScrollHandler::InitEvent(nsWindowBase* aWidget,
WidgetGUIEvent& aEvent,
nsIntPoint* aPoint)
LayoutDeviceIntPoint* aPoint)
{
NS_ENSURE_TRUE_VOID(aWidget);
nsIntPoint point;
LayoutDeviceIntPoint point;
if (aPoint) {
point = *aPoint;
} else {

Просмотреть файл

@ -74,7 +74,7 @@ private:
*/
static void InitEvent(nsWindowBase* aWidget,
WidgetGUIEvent& aEvent,
nsIntPoint* aPoint = nullptr);
LayoutDeviceIntPoint* aPoint = nullptr);
/**
* GetModifierKeyState() returns current modifier key state.

Просмотреть файл

@ -3798,16 +3798,15 @@ nsWindow::GetMaxTouchPoints() const
*
**************************************************************/
// Event intialization
void nsWindow::InitEvent(WidgetGUIEvent& event, nsIntPoint* aPoint)
// Event initialization
void nsWindow::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint)
{
if (nullptr == aPoint) { // use the point from the event
// get the message position in client coordinates
if (mWnd != nullptr) {
DWORD pos = ::GetMessagePos();
POINT cpos;
cpos.x = GET_X_LPARAM(pos);
cpos.y = GET_Y_LPARAM(pos);
@ -3818,11 +3817,9 @@ void nsWindow::InitEvent(WidgetGUIEvent& event, nsIntPoint* aPoint)
event.refPoint.x = 0;
event.refPoint.y = 0;
}
}
else {
} else {
// use the point override if provided
event.refPoint.x = aPoint->x;
event.refPoint.y = aPoint->y;
event.refPoint = *aPoint;
}
event.time = ::GetMessageTime();
@ -4038,15 +4035,13 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
} // switch
nsIntPoint eventPoint;
eventPoint.x = GET_X_LPARAM(lParam);
eventPoint.y = GET_Y_LPARAM(lParam);
LayoutDeviceIntPoint eventPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
WidgetMouseEvent event(true, aEventMessage, this, WidgetMouseEvent::eReal,
aIsContextMenuKey ? WidgetMouseEvent::eContextMenuKey :
WidgetMouseEvent::eNormal);
if (aEventMessage == eContextMenu && aIsContextMenuKey) {
nsIntPoint zero(0, 0);
LayoutDeviceIntPoint zero(0, 0);
InitEvent(event, &zero);
} else {
InitEvent(event, &eventPoint);
@ -4060,7 +4055,7 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
// convert it to pointer events as well
event.convertToPointer = true;
nsIntPoint mpScreen = eventPoint + WidgetToScreenOffsetUntyped();
LayoutDeviceIntPoint mpScreen = eventPoint + WidgetToScreenOffset();
// Suppress mouse moves caused by widget creation
if (aEventMessage == eMouseMove) {

Просмотреть файл

@ -81,7 +81,7 @@ public:
// nsWindowBase
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
nsIntPoint* aPoint = nullptr) override;
mozilla::LayoutDeviceIntPoint* aPoint = nullptr) override;
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override;
virtual bool DispatchKeyboardEvent(mozilla::WidgetKeyboardEvent* aEvent) override;
virtual bool DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent) override;

Просмотреть файл

@ -24,7 +24,7 @@ nsWindowBase::DispatchPluginEvent(const MSG& aMsg)
return false;
}
WidgetPluginEvent pluginEvent(true, ePluginInputEvent, this);
nsIntPoint point(0, 0);
LayoutDeviceIntPoint point(0, 0);
InitEvent(pluginEvent, &point);
NPEvent npEvent;
npEvent.event = aMsg.message;

Просмотреть файл

@ -43,7 +43,7 @@ public:
* @param aPoint message position in physical coordinates.
*/
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
nsIntPoint* aPoint = nullptr) = 0;
mozilla::LayoutDeviceIntPoint* aPoint = nullptr) = 0;
/*
* Dispatch a gecko event for this widget.