Bug 1075670 - [e10s] event.screenX and event.screenY is wrong

Change the PuppetWidget from defining screen coordinates from
tab-content-relative to being based on actual screen geometry.
PuppetWidgets can have position.  In the parent process, the
widget has a position and a separate client position (that
includes OS window chrome... on Linux and Windows as others have no
chrome).  In the child process, the widget (non-origin) position,
whose calculation compensates for the OS window decoration.
This commit is contained in:
David Parks 2015-02-04 04:00:28 -08:00
parent c75eab55ac
commit 75b7fa4b98
4 changed files with 26 additions and 4 deletions

View File

@ -2051,7 +2051,7 @@ TabChild::RecvUpdateDimensions(const nsIntRect& rect, const nsIntSize& size,
ScreenIntSize oldScreenSize = mInnerSize;
mInnerSize = ScreenIntSize::FromUnknownSize(
gfx::IntSize(size.width, size.height));
mWidget->Resize(0, 0, size.width, size.height,
mWidget->Resize(rect.x + chromeDisp.x, rect.y + chromeDisp.y, size.width, size.height,
true);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());

View File

@ -896,8 +896,15 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size)
if (!mUpdatedDimensions || mOrientation != orientation ||
mDimensions != size || !mRect.IsEqualEdges(rect)) {
nsCOMPtr<nsIWidget> widget = GetWidget();
nsIntRect contentRect = rect;
if (widget) {
contentRect.x += widget->GetClientOffset().x;
contentRect.y += widget->GetClientOffset().y;
}
mUpdatedDimensions = true;
mRect = rect;
mRect = contentRect;
mDimensions = size;
mOrientation = orientation;

View File

@ -960,6 +960,13 @@ PuppetWidget::GetWindowPosition()
return nsIntPoint(winX, winY);
}
NS_METHOD
PuppetWidget::GetScreenBounds(nsIntRect &aRect) {
aRect.MoveTo(WidgetToScreenOffset());
aRect.SizeTo(mBounds.Size());
return NS_OK;
}
PuppetScreen::PuppetScreen(void *nativeScreen)
{
}

View File

@ -92,8 +92,14 @@ public:
double aWidth,
double aHeight,
bool aRepaint) MOZ_OVERRIDE
// Widget position is controlled by the parent process via TabChild.
{ return Resize(aWidth, aHeight, aRepaint); }
{
if (mBounds.x != aX || mBounds.y != aY) {
NotifyWindowMoved(aX, aY);
}
mBounds.x = aX;
mBounds.y = aY;
return Resize(aWidth, aHeight, aRepaint);
}
// XXX/cjones: copying gtk behavior here; unclear what disabling a
// widget is supposed to entail
@ -197,6 +203,8 @@ public:
// Get the screen position of the application window.
nsIntPoint GetWindowPosition();
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) MOZ_OVERRIDE;
protected:
bool mEnabled;
bool mVisible;