зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125040: Use LayoutDeviceIntPoint for GetScreenCoords r=botond
This commit is contained in:
Родитель
e63a6defd2
Коммит
8d01c7e428
|
@ -877,7 +877,7 @@ Event::Shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
LayoutDeviceIntPoint
|
||||
Event::GetScreenCoords(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
LayoutDeviceIntPoint aPoint)
|
||||
|
@ -894,18 +894,18 @@ 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),
|
||||
return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ public:
|
|||
WidgetEvent* aEvent,
|
||||
LayoutDeviceIntPoint aPoint,
|
||||
CSSIntPoint aDefaultPoint);
|
||||
static nsIntPoint GetScreenCoords(nsPresContext* aPresContext,
|
||||
static LayoutDeviceIntPoint GetScreenCoords(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
LayoutDeviceIntPoint aPoint);
|
||||
|
||||
|
|
|
@ -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,7 +39,7 @@ 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,
|
||||
static LayoutDeviceIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
if (!aEvent ||
|
||||
|
@ -49,18 +49,18 @@ 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),
|
||||
return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче