Bug 1075670 - Make PuppetWidget::WidgetToScreenOffset use proper screen position. r=josh

PuppetWidget::WidgetToScreenOffset now reports proper widget screen location. Previously, in the content process, all widgets were defined to be located at the screen origin. This also repairs mac e10s OOP plugin coordinate calculations that would be broken by this change.
This commit is contained in:
David Parks 2015-02-04 04:17:15 -08:00
Родитель 433ecb9f7d
Коммит 0bb693520e
2 изменённых файлов: 7 добавлений и 9 удалений

Просмотреть файл

@ -789,7 +789,6 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
// This is actually relative to window-chrome.
nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft());
// Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
@ -799,8 +798,8 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
nsPoint screenPoint;
switch (sourceSpace) {
case NPCoordinateSpacePlugin:
screenPoint = sourcePoint + pluginFrame->GetContentRectRelativeToSelf().TopLeft() +
chromeSize + pluginPosition + windowPosition;
screenPoint = sourcePoint + pluginPosition +
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
break;
case NPCoordinateSpaceWindow:
screenPoint = nsPoint(sourcePoint.x, windowH-sourcePoint.y) +
@ -823,8 +822,8 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
nsPoint destPoint;
switch (destSpace) {
case NPCoordinateSpacePlugin:
destPoint = screenPoint - pluginFrame->GetContentRectRelativeToSelf().TopLeft() -
chromeSize - pluginPosition - windowPosition;
destPoint = screenPoint - pluginPosition -
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
break;
case NPCoordinateSpaceWindow:
destPoint = screenPoint - windowPosition;

Просмотреть файл

@ -78,7 +78,7 @@ public:
int32_t* aY) MOZ_OVERRIDE
{ *aX = kMaxDimension; *aY = kMaxDimension; return NS_OK; }
// We're always at <0, 0>, and so ignore move requests.
// Widget position is controlled by the parent process via TabChild.
NS_IMETHOD Move(double aX, double aY) MOZ_OVERRIDE
{ return NS_OK; }
@ -90,7 +90,7 @@ public:
double aWidth,
double aHeight,
bool aRepaint) MOZ_OVERRIDE
// (we're always at <0, 0>)
// Widget position is controlled by the parent process via TabChild.
{ return Resize(aWidth, aHeight, aRepaint); }
// XXX/cjones: copying gtk behavior here; unclear what disabling a
@ -121,9 +121,8 @@ public:
NS_IMETHOD SetTitle(const nsAString& aTitle) MOZ_OVERRIDE
{ return NS_ERROR_UNEXPECTED; }
// PuppetWidgets are always at <0, 0>.
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE
{ return mozilla::LayoutDeviceIntPoint(0, 0); }
{ return LayoutDeviceIntPoint::FromUntyped(GetWindowPosition() + GetChromeDimensions()); }
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);