mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 891468 - Convert nsEventStateManager::GetChildProcessOffset to return a LayoutDeviceIntPoint instead of an nsIntPoint. r=smaug
This commit is contained in:
parent
2b006a3d48
commit
3d283a5a5d
@ -96,6 +96,7 @@
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#include "nsIDOMClientRect.h"
|
||||
#include "Units.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
@ -1524,7 +1525,7 @@ nsEventStateManager::IsRemoteTarget(nsIContent* target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*static*/ nsIntPoint
|
||||
/*static*/ LayoutDeviceIntPoint
|
||||
nsEventStateManager::GetChildProcessOffset(nsFrameLoader* aFrameLoader,
|
||||
const nsEvent& aEvent)
|
||||
{
|
||||
@ -1532,22 +1533,23 @@ nsEventStateManager::GetChildProcessOffset(nsFrameLoader* aFrameLoader,
|
||||
// 0,0. Map the event coordinates to match that.
|
||||
nsIFrame* targetFrame = aFrameLoader->GetPrimaryFrameOfOwningContent();
|
||||
if (!targetFrame) {
|
||||
return nsIntPoint();
|
||||
return LayoutDeviceIntPoint();
|
||||
}
|
||||
nsPresContext* presContext = targetFrame->PresContext();
|
||||
|
||||
// Find out how far we're offset from the nearest widget.
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(&aEvent,
|
||||
targetFrame);
|
||||
return pt.ToNearestPixels(presContext->AppUnitsPerDevPixel());
|
||||
return LayoutDeviceIntPoint::FromAppUnitsToNearest(pt, presContext->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
nsEventStateManager::MapEventCoordinatesForChildProcess(
|
||||
const nsIntPoint& aOffset, nsEvent* aEvent)
|
||||
const LayoutDeviceIntPoint& aOffset, nsEvent* aEvent)
|
||||
{
|
||||
nsIntPoint aOffsetIntPoint(aOffset.x, aOffset.y);
|
||||
if (aEvent->eventStructType != NS_TOUCH_EVENT) {
|
||||
aEvent->refPoint = aOffset;
|
||||
aEvent->refPoint = aOffsetIntPoint;
|
||||
} else {
|
||||
aEvent->refPoint = nsIntPoint();
|
||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
|
||||
@ -1557,7 +1559,7 @@ nsEventStateManager::MapEventCoordinatesForChildProcess(
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
nsIDOMTouch* touch = touches[i];
|
||||
if (touch) {
|
||||
touch->mRefPoint += aOffset;
|
||||
touch->mRefPoint += aOffsetIntPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1567,7 +1569,7 @@ nsEventStateManager::MapEventCoordinatesForChildProcess(
|
||||
nsEventStateManager::MapEventCoordinatesForChildProcess(nsFrameLoader* aFrameLoader,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsIntPoint offset = GetChildProcessOffset(aFrameLoader, *aEvent);
|
||||
LayoutDeviceIntPoint offset = GetChildProcessOffset(aFrameLoader, *aEvent);
|
||||
MapEventCoordinatesForChildProcess(offset, aEvent);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
|
||||
typedef mozilla::TimeStamp TimeStamp;
|
||||
typedef mozilla::TimeDuration TimeDuration;
|
||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
||||
|
||||
nsEventStateManager();
|
||||
virtual ~nsEventStateManager();
|
||||
@ -193,13 +194,13 @@ public:
|
||||
static void SetFullScreenState(mozilla::dom::Element* aElement, bool aIsFullScreen);
|
||||
|
||||
static bool IsRemoteTarget(nsIContent* aTarget);
|
||||
static nsIntPoint GetChildProcessOffset(nsFrameLoader* aFrameLoader,
|
||||
const nsEvent& aEvent);
|
||||
static LayoutDeviceIntPoint GetChildProcessOffset(nsFrameLoader* aFrameLoader,
|
||||
const nsEvent& aEvent);
|
||||
|
||||
static void MapEventCoordinatesForChildProcess(nsFrameLoader* aFrameLoader,
|
||||
nsEvent* aEvent);
|
||||
|
||||
static void MapEventCoordinatesForChildProcess(const nsIntPoint& aOffset,
|
||||
static void MapEventCoordinatesForChildProcess(const LayoutDeviceIntPoint& aOffset,
|
||||
nsEvent* aEvent);
|
||||
|
||||
// Holds the point in screen coords that a mouse event was dispatched to,
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsITabParent.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "Units.h"
|
||||
|
||||
struct gfxMatrix;
|
||||
struct JSContext;
|
||||
@ -321,7 +322,7 @@ private:
|
||||
// means that the touch events are relative to where the frame was at the
|
||||
// start of the touch. We need to look for a better solution to this
|
||||
// problem see bug 872911.
|
||||
nsIntPoint mChildProcessOffsetAtTouchStart;
|
||||
LayoutDeviceIntPoint mChildProcessOffsetAtTouchStart;
|
||||
// When true, we've initiated normal shutdown and notified our
|
||||
// managing PContent.
|
||||
bool mMarkedDestroying;
|
||||
|
@ -127,6 +127,10 @@ struct CSSPixel {
|
||||
* 2) the "widget scale" (see nsIWidget::GetDefaultScale)
|
||||
*/
|
||||
struct LayoutDevicePixel {
|
||||
static LayoutDeviceIntPoint FromAppUnitsToNearest(const nsPoint& aPoint, nscoord appUnitsPerDevPixel) {
|
||||
nsIntPoint result = aPoint.ToNearestPixels(appUnitsPerDevPixel);
|
||||
return LayoutDeviceIntPoint(result.x, result.y);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user