Bug 1358758 - Use CSSIntRect for nsIFrame::GetScreenRect. r=kats
MozReview-Commit-ID: KXPL1ERbFDa
This commit is contained in:
@@ -191,7 +191,7 @@ XULTreeAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||||||
nsIFrame *rootFrame = presShell->GetRootFrame();
|
nsIFrame *rootFrame = presShell->GetRootFrame();
|
||||||
NS_ENSURE_TRUE(rootFrame, nullptr);
|
NS_ENSURE_TRUE(rootFrame, nullptr);
|
||||||
|
|
||||||
nsIntRect rootRect = rootFrame->GetScreenRect();
|
CSSIntRect rootRect = rootFrame->GetScreenRect();
|
||||||
|
|
||||||
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
|
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
|
||||||
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
|
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ XULTreeGridRowAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||||||
nsIFrame *rootFrame = presShell->GetRootFrame();
|
nsIFrame *rootFrame = presShell->GetRootFrame();
|
||||||
NS_ENSURE_TRUE(rootFrame, nullptr);
|
NS_ENSURE_TRUE(rootFrame, nullptr);
|
||||||
|
|
||||||
nsIntRect rootRect = rootFrame->GetScreenRect();
|
CSSIntRect rootRect = rootFrame->GetScreenRect();
|
||||||
|
|
||||||
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
|
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
|
||||||
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
|
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
|
||||||
|
|||||||
@@ -2654,7 +2654,7 @@ ContentEventHandler::OnQueryDOMWidgetHittest(WidgetQueryContentEvent* aEvent)
|
|||||||
|
|
||||||
LayoutDeviceIntPoint eventLoc =
|
LayoutDeviceIntPoint eventLoc =
|
||||||
aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
|
aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
|
||||||
nsIntRect docFrameRect = docFrame->GetScreenRect(); // Returns CSS pixels
|
CSSIntRect docFrameRect = docFrame->GetScreenRect();
|
||||||
CSSIntPoint eventLocCSS(
|
CSSIntPoint eventLocCSS(
|
||||||
mPresContext->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.x,
|
mPresContext->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.x,
|
||||||
mPresContext->DevPixelsToIntCSSPixels(eventLoc.y) - docFrameRect.y);
|
mPresContext->DevPixelsToIntCSSPixels(eventLoc.y) - docFrameRect.y);
|
||||||
|
|||||||
@@ -234,8 +234,10 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
|||||||
if (mouseEvent->IsReal()) {
|
if (mouseEvent->IsReal()) {
|
||||||
// If the cursor is moving to be outside the frame,
|
// If the cursor is moving to be outside the frame,
|
||||||
// terminate the scrollwheel transaction.
|
// terminate the scrollwheel transaction.
|
||||||
nsIntPoint pt = GetScreenPoint(mouseEvent);
|
LayoutDeviceIntPoint pt = GetScreenPoint(mouseEvent);
|
||||||
nsIntRect r = sTargetFrame->GetScreenRect();
|
auto r = LayoutDeviceIntRect::FromAppUnitsToNearest(
|
||||||
|
sTargetFrame->GetScreenRectInAppUnits(),
|
||||||
|
sTargetFrame->PresContext()->AppUnitsPerDevPixel());
|
||||||
if (!r.Contains(pt)) {
|
if (!r.Contains(pt)) {
|
||||||
EndTransaction();
|
EndTransaction();
|
||||||
return;
|
return;
|
||||||
@@ -336,13 +338,12 @@ WheelTransaction::SetTimeout()
|
|||||||
"nsITimer::InitWithFuncCallback failed");
|
"nsITimer::InitWithFuncCallback failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ nsIntPoint
|
/* static */ LayoutDeviceIntPoint
|
||||||
WheelTransaction::GetScreenPoint(WidgetGUIEvent* aEvent)
|
WheelTransaction::GetScreenPoint(WidgetGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aEvent, "aEvent is null");
|
NS_ASSERTION(aEvent, "aEvent is null");
|
||||||
NS_ASSERTION(aEvent->mWidget, "aEvent-mWidget is null");
|
NS_ASSERTION(aEvent->mWidget, "aEvent-mWidget is null");
|
||||||
return (aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset())
|
return aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
|
||||||
.ToUnknownPoint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ uint32_t
|
/* static */ uint32_t
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ protected:
|
|||||||
static bool UpdateTransaction(WidgetWheelEvent* aEvent);
|
static bool UpdateTransaction(WidgetWheelEvent* aEvent);
|
||||||
static void MayEndTransaction();
|
static void MayEndTransaction();
|
||||||
|
|
||||||
static nsIntPoint GetScreenPoint(WidgetGUIEvent* aEvent);
|
static LayoutDeviceIntPoint GetScreenPoint(WidgetGUIEvent* aEvent);
|
||||||
static void OnFailToScrollTarget();
|
static void OnFailToScrollTarget();
|
||||||
static void OnTimeout(nsITimer* aTimer, void* aClosure);
|
static void OnTimeout(nsITimer* aTimer, void* aClosure);
|
||||||
static void SetTimeout();
|
static void SetTimeout();
|
||||||
|
|||||||
@@ -105,10 +105,6 @@ using namespace mozilla;
|
|||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
|
|
||||||
static inline nsPoint AsNsPoint(const nsIntPoint &p) {
|
|
||||||
return nsPoint(p.x, p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// special class for handeling DOM context menu events because for
|
// special class for handeling DOM context menu events because for
|
||||||
// some reason it starves other mouse events if implemented on the
|
// some reason it starves other mouse events if implemented on the
|
||||||
// same class
|
// same class
|
||||||
@@ -1066,47 +1062,53 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsPresContext* presContext = pluginFrame->PresContext();
|
nsPresContext* presContext = pluginFrame->PresContext();
|
||||||
double scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
|
CSSToLayoutDeviceScale scaleFactor(
|
||||||
presContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
|
double(nsPresContext::AppUnitsPerCSSPixel()) /
|
||||||
|
presContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
|
||||||
|
|
||||||
PuppetWidget *puppetWidget = static_cast<PuppetWidget*>(widget);
|
PuppetWidget *puppetWidget = static_cast<PuppetWidget*>(widget);
|
||||||
PuppetWidget *rootWidget = static_cast<PuppetWidget*>(widget->GetTopLevelWidget());
|
PuppetWidget *rootWidget = static_cast<PuppetWidget*>(widget->GetTopLevelWidget());
|
||||||
if (!rootWidget) {
|
if (!rootWidget) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nsPoint chromeSize = AsNsPoint(rootWidget->GetChromeDimensions()) / scaleFactor;
|
CSSIntPoint chromeSize = CSSIntPoint::Truncate(
|
||||||
|
LayoutDeviceIntPoint::FromUnknownPoint(rootWidget->GetChromeDimensions()) /
|
||||||
|
scaleFactor);
|
||||||
nsIntSize intScreenDims = rootWidget->GetScreenDimensions();
|
nsIntSize intScreenDims = rootWidget->GetScreenDimensions();
|
||||||
nsSize screenDims = nsSize(intScreenDims.width / scaleFactor,
|
CSSIntSize screenDims = CSSIntSize::Truncate(
|
||||||
intScreenDims.height / scaleFactor);
|
LayoutDeviceIntSize::FromUnknownSize(intScreenDims) / scaleFactor);
|
||||||
int32_t screenH = screenDims.height;
|
int32_t screenH = screenDims.height;
|
||||||
nsPoint windowPosition = AsNsPoint(rootWidget->GetWindowPosition()) / scaleFactor;
|
CSSIntPoint windowPosition = CSSIntPoint::Truncate(
|
||||||
|
LayoutDeviceIntPoint::FromUnknownPoint(rootWidget->GetWindowPosition()) /
|
||||||
|
scaleFactor);
|
||||||
|
|
||||||
// Window size is tab size + chrome size.
|
// Window size is tab size + chrome size.
|
||||||
LayoutDeviceIntRect tabContentBounds = puppetWidget->GetBounds();
|
LayoutDeviceIntRect tabContentBounds = puppetWidget->GetBounds();
|
||||||
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
|
tabContentBounds.ScaleInverseRoundOut(scaleFactor.scale);
|
||||||
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
|
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
|
||||||
|
|
||||||
nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft());
|
CSSIntPoint pluginPosition = pluginFrame->GetScreenRect().TopLeft();
|
||||||
|
|
||||||
// Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
|
// Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
|
||||||
// In OSX, the Y-axis increases upward, which is the reverse of ours.
|
// In OSX, the Y-axis increases upward, which is the reverse of ours.
|
||||||
// We want OSX coordinates for window and screen so those equations are swapped.
|
// We want OSX coordinates for window and screen so those equations are swapped.
|
||||||
nsPoint sourcePoint(sourceX, sourceY);
|
CSSIntPoint sourcePoint = CSSIntPoint::Truncate(sourceX, sourceY);
|
||||||
nsPoint screenPoint;
|
CSSIntPoint screenPoint;
|
||||||
switch (sourceSpace) {
|
switch (sourceSpace) {
|
||||||
case NPCoordinateSpacePlugin:
|
case NPCoordinateSpacePlugin:
|
||||||
screenPoint = sourcePoint + pluginPosition +
|
screenPoint = sourcePoint + pluginPosition +
|
||||||
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
|
CSSIntPoint::Truncate(CSSPoint::FromAppUnits(
|
||||||
|
pluginFrame->GetContentRectRelativeToSelf().TopLeft()));
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceWindow:
|
case NPCoordinateSpaceWindow:
|
||||||
screenPoint = nsPoint(sourcePoint.x, windowH-sourcePoint.y) +
|
screenPoint = CSSIntPoint(sourcePoint.x, windowH-sourcePoint.y) +
|
||||||
windowPosition;
|
windowPosition;
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceFlippedWindow:
|
case NPCoordinateSpaceFlippedWindow:
|
||||||
screenPoint = sourcePoint + windowPosition;
|
screenPoint = sourcePoint + windowPosition;
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceScreen:
|
case NPCoordinateSpaceScreen:
|
||||||
screenPoint = nsPoint(sourcePoint.x, screenH-sourcePoint.y);
|
screenPoint = CSSIntPoint(sourcePoint.x, screenH-sourcePoint.y);
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceFlippedScreen:
|
case NPCoordinateSpaceFlippedScreen:
|
||||||
screenPoint = sourcePoint;
|
screenPoint = sourcePoint;
|
||||||
@@ -1116,11 +1118,12 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert from screen to dest space.
|
// Convert from screen to dest space.
|
||||||
nsPoint destPoint;
|
CSSIntPoint destPoint;
|
||||||
switch (destSpace) {
|
switch (destSpace) {
|
||||||
case NPCoordinateSpacePlugin:
|
case NPCoordinateSpacePlugin:
|
||||||
destPoint = screenPoint - pluginPosition -
|
destPoint = screenPoint - pluginPosition -
|
||||||
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
|
CSSIntPoint::Truncate(CSSPoint::FromAppUnits(
|
||||||
|
pluginFrame->GetContentRectRelativeToSelf().TopLeft()));
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceWindow:
|
case NPCoordinateSpaceWindow:
|
||||||
destPoint = screenPoint - windowPosition;
|
destPoint = screenPoint - windowPosition;
|
||||||
@@ -1130,7 +1133,7 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
destPoint = screenPoint - windowPosition;
|
destPoint = screenPoint - windowPosition;
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceScreen:
|
case NPCoordinateSpaceScreen:
|
||||||
destPoint = nsPoint(screenPoint.x, screenH-screenPoint.y);
|
destPoint = CSSIntPoint(screenPoint.x, screenH-screenPoint.y);
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceFlippedScreen:
|
case NPCoordinateSpaceFlippedScreen:
|
||||||
destPoint = screenPoint;
|
destPoint = screenPoint;
|
||||||
@@ -1189,7 +1192,7 @@ NPBool nsPluginInstanceOwner::ConvertPointNoPuppet(nsIWidget *widget,
|
|||||||
int32_t windowY = windowScreenBounds.y;
|
int32_t windowY = windowScreenBounds.y;
|
||||||
int32_t windowHeight = windowScreenBounds.height;
|
int32_t windowHeight = windowScreenBounds.height;
|
||||||
|
|
||||||
nsIntRect pluginScreenRect = pluginFrame->GetScreenRect();
|
CSSIntRect pluginScreenRect = pluginFrame->GetScreenRect();
|
||||||
|
|
||||||
double screenXGecko, screenYGecko;
|
double screenXGecko, screenYGecko;
|
||||||
switch (sourceSpace) {
|
switch (sourceSpace) {
|
||||||
|
|||||||
@@ -8441,8 +8441,9 @@ PresShell::AdjustContextMenuKeyEvent(WidgetMouseEvent* aEvent)
|
|||||||
nsCOMPtr<nsIWidget> widget = popupFrame->GetNearestWidget();
|
nsCOMPtr<nsIWidget> widget = popupFrame->GetNearestWidget();
|
||||||
aEvent->mWidget = widget;
|
aEvent->mWidget = widget;
|
||||||
LayoutDeviceIntPoint widgetPoint = widget->WidgetToScreenOffset();
|
LayoutDeviceIntPoint widgetPoint = widget->WidgetToScreenOffset();
|
||||||
aEvent->mRefPoint = LayoutDeviceIntPoint::FromUnknownPoint(
|
aEvent->mRefPoint = LayoutDeviceIntPoint::FromAppUnitsToNearest(
|
||||||
itemFrame->GetScreenRect().BottomLeft()) - widgetPoint;
|
itemFrame->GetScreenRectInAppUnits().BottomLeft(),
|
||||||
|
itemFrame->PresContext()->AppUnitsPerDevPixel()) - widgetPoint;
|
||||||
|
|
||||||
mCurrentEventContent = itemFrame->GetContent();
|
mCurrentEventContent = itemFrame->GetContent();
|
||||||
mCurrentEventFrame = itemFrame;
|
mCurrentEventFrame = itemFrame;
|
||||||
|
|||||||
@@ -240,6 +240,10 @@ struct CSSPixel {
|
|||||||
NSAppUnitsToIntPixels(aRect.height, float(AppUnitsPerCSSPixel())));
|
NSAppUnitsToIntPixels(aRect.height, float(AppUnitsPerCSSPixel())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CSSIntRect FromAppUnitsToNearest(const nsRect& aRect) {
|
||||||
|
return CSSIntRect::FromUnknownRect(aRect.ToNearestPixels(AppUnitsPerCSSPixel()));
|
||||||
|
}
|
||||||
|
|
||||||
// Conversions to app units
|
// Conversions to app units
|
||||||
|
|
||||||
static nscoord ToAppUnits(CSSCoord aCoord) {
|
static nscoord ToAppUnits(CSSCoord aCoord) {
|
||||||
|
|||||||
@@ -6098,9 +6098,9 @@ nsIFrame::GetOffsetToCrossDoc(const nsIFrame* aOther, const int32_t aAPD) const
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect nsIFrame::GetScreenRect() const
|
CSSIntRect nsIFrame::GetScreenRect() const
|
||||||
{
|
{
|
||||||
return GetScreenRectInAppUnits().ToNearestPixels(PresContext()->AppUnitsPerCSSPixel());
|
return CSSIntRect::FromAppUnitsToNearest(GetScreenRectInAppUnits());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect nsIFrame::GetScreenRectInAppUnits() const
|
nsRect nsIFrame::GetScreenRectInAppUnits() const
|
||||||
|
|||||||
@@ -2582,10 +2582,12 @@ public:
|
|||||||
nsPoint GetOffsetToCrossDoc(const nsIFrame* aOther, const int32_t aAPD) const;
|
nsPoint GetOffsetToCrossDoc(const nsIFrame* aOther, const int32_t aAPD) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the screen rect of the frame in pixels.
|
* Get the rect of the frame relative to the top-left corner of the
|
||||||
* @return the pixel rect of the frame in screen coordinates.
|
* screen in CSS pixels.
|
||||||
|
* @return the CSS pixel rect of the frame relative to the top-left
|
||||||
|
* corner of the screen.
|
||||||
*/
|
*/
|
||||||
nsIntRect GetScreenRect() const;
|
mozilla::CSSIntRect GetScreenRect() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the screen rect of the frame in app units.
|
* Get the screen rect of the frame in app units.
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ BoxObject::GetScreenPosition(nsIntPoint& aPoint)
|
|||||||
|
|
||||||
nsIFrame* frame = GetFrame(true);
|
nsIFrame* frame = GetFrame(true);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
nsIntRect rect = frame->GetScreenRect();
|
CSSIntRect rect = frame->GetScreenRect();
|
||||||
aPoint.x = rect.x;
|
aPoint.x = rect.x;
|
||||||
aPoint.y = rect.y;
|
aPoint.y = rect.y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
|||||||
nsCOMPtr<nsIScreen> screen;
|
nsCOMPtr<nsIScreen> screen;
|
||||||
nsCOMPtr<nsIScreenManager> sm(do_GetService("@mozilla.org/gfx/screenmanager;1"));
|
nsCOMPtr<nsIScreenManager> sm(do_GetService("@mozilla.org/gfx/screenmanager;1"));
|
||||||
if (sm) {
|
if (sm) {
|
||||||
nsIntRect frameRect = GetScreenRect();
|
CSSIntRect frameRect = GetScreenRect();
|
||||||
// ScreenForRect requires display pixels, so scale from device pix
|
// ScreenForRect requires display pixels, so scale from device pix
|
||||||
double scale;
|
double scale;
|
||||||
window->GetUnscaledDevicePixelsPerCSSPixel(&scale);
|
window->GetUnscaledDevicePixelsPerCSSPixel(&scale);
|
||||||
|
|||||||
@@ -262,11 +262,11 @@ nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
|
|||||||
// reopen the menu.
|
// reopen the menu.
|
||||||
if ((consumeResult == ConsumeOutsideClicks_ParentOnly || noRollupOnAnchor) && pos) {
|
if ((consumeResult == ConsumeOutsideClicks_ParentOnly || noRollupOnAnchor) && pos) {
|
||||||
nsMenuPopupFrame* popupFrame = item->Frame();
|
nsMenuPopupFrame* popupFrame = item->Frame();
|
||||||
nsIntRect anchorRect;
|
CSSIntRect anchorRect;
|
||||||
if (popupFrame->IsAnchored()) {
|
if (popupFrame->IsAnchored()) {
|
||||||
// Check if the popup has a screen anchor rectangle. If not, get the rectangle
|
// Check if the popup has a screen anchor rectangle. If not, get the rectangle
|
||||||
// from the anchor element.
|
// from the anchor element.
|
||||||
anchorRect = popupFrame->GetScreenAnchorRect();
|
anchorRect = CSSIntRect::FromUnknownRect(popupFrame->GetScreenAnchorRect());
|
||||||
if (anchorRect.x == -1 || anchorRect.y == -1) {
|
if (anchorRect.x == -1 || anchorRect.y == -1) {
|
||||||
nsCOMPtr<nsIContent> anchor = popupFrame->GetAnchor();
|
nsCOMPtr<nsIContent> anchor = popupFrame->GetAnchor();
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ nsXULPopupManager::Rollup(uint32_t aCount, bool aFlush,
|
|||||||
// event will get consumed, so here only a quick coordinates check is
|
// event will get consumed, so here only a quick coordinates check is
|
||||||
// done rather than a slower complete check of what is at that location.
|
// done rather than a slower complete check of what is at that location.
|
||||||
nsPresContext* presContext = item->Frame()->PresContext();
|
nsPresContext* presContext = item->Frame()->PresContext();
|
||||||
nsIntPoint posCSSPixels(presContext->DevPixelsToIntCSSPixels(pos->x),
|
CSSIntPoint posCSSPixels(presContext->DevPixelsToIntCSSPixels(pos->x),
|
||||||
presContext->DevPixelsToIntCSSPixels(pos->y));
|
presContext->DevPixelsToIntCSSPixels(pos->y));
|
||||||
if (anchorRect.Contains(posCSSPixels)) {
|
if (anchorRect.Contains(posCSSPixels)) {
|
||||||
if (consumeResult == ConsumeOutsideClicks_ParentOnly) {
|
if (consumeResult == ConsumeOutsideClicks_ParentOnly) {
|
||||||
|
|||||||
@@ -588,13 +588,13 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
|
|||||||
if (!enableDragImages || !mHasImage) {
|
if (!enableDragImages || !mHasImage) {
|
||||||
// if a region was specified, set the screen rectangle to the area that
|
// if a region was specified, set the screen rectangle to the area that
|
||||||
// the region occupies
|
// the region occupies
|
||||||
nsIntRect dragRect;
|
CSSIntRect dragRect;
|
||||||
if (aRegion) {
|
if (aRegion) {
|
||||||
// the region's coordinates are relative to the root frame
|
// the region's coordinates are relative to the root frame
|
||||||
aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height);
|
aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height);
|
||||||
|
|
||||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||||
nsIntRect screenRect = rootFrame->GetScreenRect();
|
CSSIntRect screenRect = rootFrame->GetScreenRect();
|
||||||
dragRect.MoveBy(screenRect.TopLeft());
|
dragRect.MoveBy(screenRect.TopLeft());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -607,9 +607,10 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dragRect = ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()).
|
nsIntRect dragRectDev =
|
||||||
|
ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()).
|
||||||
ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel());
|
ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel());
|
||||||
aScreenDragRect->SizeTo(dragRect.width, dragRect.height);
|
aScreenDragRect->SizeTo(dragRectDev.width, dragRectDev.height);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user