Loading dom/base/nsDOMWindowUtils.cpp +14 −29 Original line number Diff line number Diff line Loading @@ -524,6 +524,16 @@ nsDOMWindowUtils::SendMouseEventToWindow(const nsAString& aType, aIgnoreRootScrollFrame, true); } static nsIntPoint ToWidgetPoint(float aX, float aY, const nsPoint& aOffset, nsPresContext* aPresContext) { double appPerDev = aPresContext->AppUnitsPerDevPixel(); nscoord appPerCSS = nsPresContext::AppUnitsPerCSSPixel(); return nsIntPoint(NSToIntRound((aX*appPerCSS + aOffset.x)/appPerDev), NSToIntRound((aY*appPerCSS + aOffset.y)/appPerDev)); } NS_IMETHODIMP nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, float aX, Loading Loading @@ -577,13 +587,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); event.ignoreRootScrollFrame = aIgnoreRootScrollFrame; nsEventStatus status; Loading Loading @@ -644,13 +648,7 @@ nsDOMWindowUtils::SendMouseScrollEvent(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); nsEventStatus status; return widget->DispatchEvent(&event, status); Loading Loading @@ -703,15 +701,8 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType, return NS_ERROR_FAILURE; } event.touches.SetCapacity(aCount); PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); for (PRUint32 i = 0; i < aCount; ++i) { nsIntPoint pt(0, 0); pt.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aXs[i]) + offset.x, appPerDev); pt.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aYs[i]) + offset.y, appPerDev); nsIntPoint pt = ToWidgetPoint(aXs[i], aYs[i], offset, presContext); nsCOMPtr<nsIDOMTouch> t(new nsDOMTouch(aIdentifiers[i], pt, nsIntPoint(aRxs[i], aRys[i]), Loading Loading @@ -1081,13 +1072,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); nsEventStatus status; return widget->DispatchEvent(&event, status); Loading Loading
dom/base/nsDOMWindowUtils.cpp +14 −29 Original line number Diff line number Diff line Loading @@ -524,6 +524,16 @@ nsDOMWindowUtils::SendMouseEventToWindow(const nsAString& aType, aIgnoreRootScrollFrame, true); } static nsIntPoint ToWidgetPoint(float aX, float aY, const nsPoint& aOffset, nsPresContext* aPresContext) { double appPerDev = aPresContext->AppUnitsPerDevPixel(); nscoord appPerCSS = nsPresContext::AppUnitsPerCSSPixel(); return nsIntPoint(NSToIntRound((aX*appPerCSS + aOffset.x)/appPerDev), NSToIntRound((aY*appPerCSS + aOffset.y)/appPerDev)); } NS_IMETHODIMP nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, float aX, Loading Loading @@ -577,13 +587,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); event.ignoreRootScrollFrame = aIgnoreRootScrollFrame; nsEventStatus status; Loading Loading @@ -644,13 +648,7 @@ nsDOMWindowUtils::SendMouseScrollEvent(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); nsEventStatus status; return widget->DispatchEvent(&event, status); Loading Loading @@ -703,15 +701,8 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType, return NS_ERROR_FAILURE; } event.touches.SetCapacity(aCount); PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); for (PRUint32 i = 0; i < aCount; ++i) { nsIntPoint pt(0, 0); pt.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aXs[i]) + offset.x, appPerDev); pt.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aYs[i]) + offset.y, appPerDev); nsIntPoint pt = ToWidgetPoint(aXs[i], aYs[i], offset, presContext); nsCOMPtr<nsIDOMTouch> t(new nsDOMTouch(aIdentifiers[i], pt, nsIntPoint(aRxs[i], aRys[i]), Loading Loading @@ -1081,13 +1072,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType, if (!presContext) return NS_ERROR_FAILURE; PRInt32 appPerDev = presContext->AppUnitsPerDevPixel(); event.refPoint.x = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x, appPerDev); event.refPoint.y = NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aY) + offset.y, appPerDev); event.refPoint = ToWidgetPoint(aX, aY, offset, presContext); nsEventStatus status; return widget->DispatchEvent(&event, status); Loading