Bug 1125040: Use LayoutDeviceIntPoint for GetScreenCoords r=botond

This commit is contained in:
David Zbarsky 2015-02-15 13:52:28 -05:00
Родитель e63a6defd2
Коммит 8d01c7e428
8 изменённых файлов: 22 добавлений и 22 удалений

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

@ -877,7 +877,7 @@ Event::Shutdown()
}
}
nsIntPoint
LayoutDeviceIntPoint
Event::GetScreenCoords(nsPresContext* aPresContext,
WidgetEvent* aEvent,
LayoutDeviceIntPoint aPoint)
@ -886,7 +886,7 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
return EventStateManager::sLastScreenPoint;
}
if (!aEvent ||
if (!aEvent ||
(aEvent->mClass != eMouseEventClass &&
aEvent->mClass != eMouseScrollEventClass &&
aEvent->mClass != eWheelEventClass &&
@ -894,19 +894,19 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
aEvent->mClass != eTouchEventClass &&
aEvent->mClass != eDragEventClass &&
aEvent->mClass != eSimpleGestureEventClass)) {
return nsIntPoint(0, 0);
return LayoutDeviceIntPoint(0, 0);
}
WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
if (!guiEvent->widget) {
return LayoutDeviceIntPoint::ToUntyped(aPoint);
return aPoint;
}
LayoutDeviceIntPoint offset = aPoint + guiEvent->widget->WidgetToScreenOffset();
nscoord factor =
aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
}
// static

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

@ -146,9 +146,9 @@ public:
WidgetEvent* aEvent,
LayoutDeviceIntPoint aPoint,
CSSIntPoint aDefaultPoint);
static nsIntPoint GetScreenCoords(nsPresContext* aPresContext,
WidgetEvent* aEvent,
LayoutDeviceIntPoint aPoint);
static LayoutDeviceIntPoint GetScreenCoords(nsPresContext* aPresContext,
WidgetEvent* aEvent,
LayoutDeviceIntPoint aPoint);
static already_AddRefed<Event> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,

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

@ -265,7 +265,7 @@ EventStateManager* EventStateManager::sActiveESM = nullptr;
nsIDocument* EventStateManager::sMouseOverDocument = nullptr;
nsWeakFrame EventStateManager::sLastDragOverFrame = nullptr;
LayoutDeviceIntPoint EventStateManager::sLastRefPoint = kInvalidRefPoint;
nsIntPoint EventStateManager::sLastScreenPoint = nsIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sLastScreenPoint = LayoutDeviceIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sSynthCenteringPoint = kInvalidRefPoint;
CSSIntPoint EventStateManager::sLastClientPoint = CSSIntPoint(0, 0);
bool EventStateManager::sIsPointerLocked = false;

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

@ -233,7 +233,7 @@ public:
// locked. This is used by dom::Event::GetScreenCoords() to make mouse
// events' screen coord appear frozen at the last mouse position while
// the pointer is locked.
static nsIntPoint sLastScreenPoint;
static LayoutDeviceIntPoint sLastScreenPoint;
// Holds the point in client coords of the last mouse event. Used by
// dom::Event::GetClientCoords() to make mouse events' client coords appear

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

@ -31,7 +31,7 @@ Touch::Touch(EventTarget* aTarget,
mTarget = aTarget;
mIdentifier = aIdentifier;
mPagePoint = CSSIntPoint(aPageX, aPageY);
mScreenPoint = nsIntPoint(aScreenX, aScreenY);
mScreenPoint = LayoutDeviceIntPoint(aScreenX, aScreenY);
mClientPoint = CSSIntPoint(aClientX, aClientY);
mRefPoint = LayoutDeviceIntPoint(0, 0);
mPointsInitialized = true;
@ -53,7 +53,7 @@ Touch::Touch(int32_t aIdentifier,
{
mIdentifier = aIdentifier;
mPagePoint = CSSIntPoint(0, 0);
mScreenPoint = nsIntPoint(0, 0);
mScreenPoint = LayoutDeviceIntPoint(0, 0);
mClientPoint = CSSIntPoint(0, 0);
mRefPoint = aPoint;
mPointsInitialized = false;

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

@ -79,7 +79,7 @@ public:
int32_t mIdentifier;
CSSIntPoint mPagePoint;
CSSIntPoint mClientPoint;
nsIntPoint mScreenPoint;
LayoutDeviceIntPoint mScreenPoint;
nsIntPoint mRadius;
float mRotationAngle;
float mForce;

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

@ -358,11 +358,11 @@ UIEvent::DuplicatePrivateData()
mPagePoint =
Event::GetPageCoords(mPresContext, mEvent, mEvent->refPoint, mClientPoint);
// GetScreenPoint converts mEvent->refPoint to right coordinates.
nsIntPoint screenPoint =
LayoutDeviceIntPoint screenPoint =
Event::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint);
nsresult rv = Event::DuplicatePrivateData();
if (NS_SUCCEEDED(rv)) {
mEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(screenPoint);
mEvent->refPoint = screenPoint;
}
return rv;
}

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

@ -39,8 +39,8 @@ public:
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
WidgetEvent* aEvent)
static LayoutDeviceIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
WidgetEvent* aEvent)
{
if (!aEvent ||
(aEvent->mClass != eMouseEventClass &&
@ -49,19 +49,19 @@ public:
aEvent->mClass != eDragEventClass &&
aEvent->mClass != ePointerEventClass &&
aEvent->mClass != eSimpleGestureEventClass)) {
return nsIntPoint(0, 0);
return LayoutDeviceIntPoint(0, 0);
}
WidgetGUIEvent* event = aEvent->AsGUIEvent();
if (!event->widget) {
return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
return aEvent->refPoint;
}
LayoutDeviceIntPoint offset = aEvent->refPoint + event->widget->WidgetToScreenOffset();
nscoord factor =
aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
}
static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,