Bug 1125040: Use LayoutDeviceIntPoint for GetEventPoint r=botond

This commit is contained in:
David Zbarsky 2015-02-01 17:27:41 -05:00
parent 1330fc1496
commit e0f914e704
6 changed files with 22 additions and 15 deletions

View File

@ -2095,15 +2095,15 @@ nsBoxFrame::WrapListsInRedirector(nsDisplayListBuilder* aBuilder,
bool
nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, nsPoint &aPoint) {
nsIntPoint refPoint;
LayoutDeviceIntPoint refPoint;
bool res = GetEventPoint(aEvent, refPoint);
aPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aEvent, LayoutDeviceIntPoint::FromUntyped(refPoint), this);
aEvent, refPoint, this);
return res;
}
bool
nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, nsIntPoint &aPoint) {
nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, LayoutDeviceIntPoint& aPoint) {
NS_ENSURE_TRUE(aEvent, false);
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
@ -2118,9 +2118,9 @@ nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, nsIntPoint &aPoint) {
if (!touch) {
return false;
}
aPoint = LayoutDeviceIntPoint::ToUntyped(touch->mRefPoint);
aPoint = touch->mRefPoint;
} else {
aPoint = LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
aPoint = aEvent->refPoint;
}
return true;
}

View File

@ -209,7 +209,8 @@ protected:
bool GetEventPoint(mozilla::WidgetGUIEvent* aEvent, nsPoint& aPoint);
// Gets the event coordinates relative to the widget offset associated with
// this frame. Return true if a single valid point was found.
bool GetEventPoint(mozilla::WidgetGUIEvent* aEvent, nsIntPoint& aPoint);
bool GetEventPoint(mozilla::WidgetGUIEvent* aEvent,
mozilla::LayoutDeviceIntPoint& aPoint);
protected:
void RegUnregAccessKey(bool aDoReg);

View File

@ -1477,7 +1477,9 @@ nsMenuPopupFrame::GetConstraintRect(const nsRect& aAnchorRect,
return screenRect;
}
void nsMenuPopupFrame::CanAdjustEdges(int8_t aHorizontalSide, int8_t aVerticalSide, nsIntPoint& aChange)
void nsMenuPopupFrame::CanAdjustEdges(int8_t aHorizontalSide,
int8_t aVerticalSide,
LayoutDeviceIntPoint& aChange)
{
int8_t popupAlign(mPopupAlignment);
if (IsDirectionRTL()) {

View File

@ -366,7 +366,9 @@ public:
// Later, when bug 357725 is implemented, we can make this adjust aChange by
// the amount that the side can be resized, so that minimums and maximums
// can be taken into account.
void CanAdjustEdges(int8_t aHorizontalSide, int8_t aVerticalSide, nsIntPoint& aChange);
void CanAdjustEdges(int8_t aHorizontalSide,
int8_t aVerticalSide,
mozilla::LayoutDeviceIntPoint& aChange);
// Return true if the popup is positioned relative to an anchor.
bool IsAnchored() const { return mScreenXPos == -1 && mScreenYPos == -1; }

View File

@ -114,10 +114,11 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
}
// remember current mouse coordinates
nsIntPoint refPoint;
LayoutDeviceIntPoint refPoint;
if (!GetEventPoint(aEvent, refPoint))
return NS_OK;
mMouseDownPoint = refPoint + aEvent->widget->WidgetToScreenOffset();
mMouseDownPoint = refPoint +
LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
// we're tracking
mTrackingMouseMove = true;
@ -162,11 +163,12 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
// retrieve the offset of the mousemove event relative to the mousedown.
// The difference is how much the resize needs to be
nsIntPoint refPoint;
LayoutDeviceIntPoint refPoint;
if (!GetEventPoint(aEvent, refPoint))
return NS_OK;
nsIntPoint screenPoint(refPoint + aEvent->widget->WidgetToScreenOffset());
nsIntPoint mouseMove(screenPoint - mMouseDownPoint);
LayoutDeviceIntPoint screenPoint = refPoint +
LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
LayoutDeviceIntPoint mouseMove(screenPoint - mMouseDownPoint);
// Determine which direction to resize by checking the dir attribute.
// For windows and menus, ensure that it can be resized in that direction.

View File

@ -66,8 +66,8 @@ protected:
static void RestoreOriginalSize(nsIContent* aContent);
protected:
nsIntRect mMouseDownRect;
nsIntPoint mMouseDownPoint;
nsIntRect mMouseDownRect;
LayoutDeviceIntPoint mMouseDownPoint;
}; // class nsResizerFrame
#endif /* nsResizerFrame_h___ */