зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125040: Use LayoutDeviceIntPoint for synthesizing native events on widgets r=botond
This commit is contained in:
Родитель
b3049cb81b
Коммит
e63a6defd2
|
@ -1322,7 +1322,7 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
|
|||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return widget->SynthesizeNativeMouseEvent(nsIntPoint(aScreenX, aScreenY),
|
||||
return widget->SynthesizeNativeMouseEvent(LayoutDeviceIntPoint(aScreenX, aScreenY),
|
||||
aNativeMessage, aModifierFlags);
|
||||
}
|
||||
|
||||
|
@ -1345,7 +1345,7 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return widget->SynthesizeNativeMouseScrollEvent(nsIntPoint(aScreenX,
|
||||
return widget->SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint(aScreenX,
|
||||
aScreenY),
|
||||
aNativeMessage,
|
||||
aDeltaX, aDeltaY, aDeltaZ,
|
||||
|
|
|
@ -4031,8 +4031,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
|||
// in the other branch here.
|
||||
sSynthCenteringPoint = center;
|
||||
aMouseEvent->widget->SynthesizeNativeMouseMove(
|
||||
LayoutDeviceIntPoint::ToUntyped(center +
|
||||
aMouseEvent->widget->WidgetToScreenOffset()));
|
||||
center + aMouseEvent->widget->WidgetToScreenOffset());
|
||||
} else if (aMouseEvent->refPoint == sSynthCenteringPoint) {
|
||||
// This is the "synthetic native" event we dispatched to re-center the
|
||||
// pointer. Cancel it so we don't expose the centering move to content.
|
||||
|
@ -4167,8 +4166,7 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
|
|||
sLastRefPoint = GetWindowInnerRectCenter(aElement->OwnerDoc()->GetWindow(),
|
||||
aWidget,
|
||||
mPresContext);
|
||||
aWidget->SynthesizeNativeMouseMove(
|
||||
LayoutDeviceIntPoint::ToUntyped(sLastRefPoint + aWidget->WidgetToScreenOffset()));
|
||||
aWidget->SynthesizeNativeMouseMove(sLastRefPoint + aWidget->WidgetToScreenOffset());
|
||||
|
||||
// Retarget all events to this element via capture.
|
||||
nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
|
||||
|
@ -4183,8 +4181,7 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
|
|||
// pre-pointerlock position, so that the synthetic mouse event reports
|
||||
// no movement.
|
||||
sLastRefPoint = mPreLockPoint;
|
||||
aWidget->SynthesizeNativeMouseMove(
|
||||
LayoutDeviceIntPoint::ToUntyped(mPreLockPoint + aWidget->WidgetToScreenOffset()));
|
||||
aWidget->SynthesizeNativeMouseMove(mPreLockPoint + aWidget->WidgetToScreenOffset());
|
||||
|
||||
// Don't retarget events to this element any more.
|
||||
nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);
|
||||
|
|
|
@ -453,11 +453,11 @@ public:
|
|||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) MOZ_OVERRIDE
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) MOZ_OVERRIDE
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0); }
|
||||
|
||||
// Mac specific methods
|
||||
|
|
|
@ -1125,7 +1125,7 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
aUnmodifiedCharacters);
|
||||
}
|
||||
|
||||
nsresult nsChildView::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
nsresult nsChildView::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "imgIContainer.h"
|
||||
#include "npapi.h"
|
||||
#include "nsTArray.h"
|
||||
#include "Units.h"
|
||||
|
||||
// This must be the last include:
|
||||
#include "nsObjCExceptions.h"
|
||||
|
@ -174,7 +175,8 @@ public:
|
|||
}
|
||||
|
||||
static NSPoint
|
||||
DevPixelsToCocoaPoints(const nsIntPoint& aPt, CGFloat aBackingScale)
|
||||
DevPixelsToCocoaPoints(const mozilla::LayoutDeviceIntPoint& aPt,
|
||||
CGFloat aBackingScale)
|
||||
{
|
||||
return NSMakePoint((CGFloat)aPt.x / aBackingScale,
|
||||
(CGFloat)aPt.y / aBackingScale);
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) MOZ_OVERRIDE;
|
||||
virtual void SetDrawsInTitlebar(bool aState) MOZ_OVERRIDE;
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) MOZ_OVERRIDE;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -2068,7 +2068,7 @@ void nsCocoaWindow::SetDrawsInTitlebar(bool aState)
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
{
|
||||
|
|
|
@ -274,7 +274,7 @@ nsDragService::InvokeDragSession(nsIDOMNode* aDOMNode, nsISupportsArray* aTransf
|
|||
[image unlockFocus];
|
||||
}
|
||||
|
||||
nsIntPoint pt(dragRect.x, dragRect.YMost());
|
||||
LayoutDeviceIntPoint pt(dragRect.x, dragRect.YMost());
|
||||
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(gLastDragView);
|
||||
NSPoint point = nsCocoaUtils::DevPixelsToCocoaPoints(pt, scaleFactor);
|
||||
point.y = nsCocoaUtils::FlippedScreenY(point.y);
|
||||
|
|
|
@ -6566,7 +6566,7 @@ nsWindow::GdkRectToDevicePixels(GdkRectangle rect) {
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
{
|
||||
|
|
|
@ -298,11 +298,11 @@ public:
|
|||
#endif
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) MOZ_OVERRIDE
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) MOZ_OVERRIDE
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -341,15 +341,15 @@ protected:
|
|||
const nsAString& aUnmodifiedCharacters) MOZ_OVERRIDE
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) MOZ_OVERRIDE
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) MOZ_OVERRIDE
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) MOZ_OVERRIDE
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
|
@ -1863,7 +1863,7 @@ class nsIWidget : public nsISupports {
|
|||
* @param aModifierFlags *platform-specific* modifier flags (ignored
|
||||
* on Windows)
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags) = 0;
|
||||
|
||||
|
@ -1871,7 +1871,7 @@ class nsIWidget : public nsISupports {
|
|||
* A shortcut to SynthesizeNativeMouseEvent, abstracting away the native message.
|
||||
* aPoint is location in device pixels to which the mouse pointer moves to.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) = 0;
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint) = 0;
|
||||
|
||||
/**
|
||||
* Utility method intended for testing. Dispatching native mouse scroll
|
||||
|
@ -1894,7 +1894,7 @@ class nsIWidget : public nsISupports {
|
|||
* @param aAdditionalFlags See nsIDOMWidnowUtils' consts and their
|
||||
* document.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
|
@ -249,7 +249,7 @@ MouseScrollHandler::ProcessMessage(nsWindowBase* aWidget, UINT msg,
|
|||
/* static */
|
||||
nsresult
|
||||
MouseScrollHandler::SynthesizeNativeMouseScrollEvent(nsWindowBase* aWidget,
|
||||
const nsIntPoint& aPoint,
|
||||
const LayoutDeviceIntPoint& aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
int32_t aDelta,
|
||||
uint32_t aModifierFlags,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "Units.h"
|
||||
#include <windows.h>
|
||||
|
||||
class nsWindowBase;
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
* this method.
|
||||
*/
|
||||
static nsresult SynthesizeNativeMouseScrollEvent(nsWindowBase* aWidget,
|
||||
const nsIntPoint& aPoint,
|
||||
const LayoutDeviceIntPoint& aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
int32_t aDelta,
|
||||
uint32_t aModifierFlags,
|
||||
|
|
|
@ -5818,7 +5818,7 @@ nsWindow::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
nsWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
{
|
||||
|
@ -5835,7 +5835,7 @@ nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
nsWindow::SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
|
@ -160,14 +160,14 @@ public:
|
|||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters);
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags);
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint)
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
|
@ -592,7 +592,7 @@ MetroWidget::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
}
|
||||
|
||||
nsresult
|
||||
MetroWidget::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
MetroWidget::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags)
|
||||
{
|
||||
|
@ -616,7 +616,7 @@ MetroWidget::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
|||
}
|
||||
|
||||
nsresult
|
||||
MetroWidget::SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
MetroWidget::SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
|
@ -127,10 +127,10 @@ public:
|
|||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters);
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags);
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
|
|
Загрузка…
Ссылка в новой задаче