Bug 1252262 - Don't combine the client offset into the outer rect for the child process. r=jimm

MozReview-Commit-ID: BslkWk7ndkx
This commit is contained in:
Kartikaya Gupta 2016-03-08 14:14:43 -05:00
parent 89e67972f0
commit 0f4af98816
6 changed files with 24 additions and 16 deletions

View File

@ -531,6 +531,7 @@ child:
async UpdateDimensions(CSSRect rect, CSSSize size, async UpdateDimensions(CSSRect rect, CSSSize size,
ScreenOrientationInternal orientation, ScreenOrientationInternal orientation,
LayoutDeviceIntPoint clientOffset,
LayoutDeviceIntPoint chromeDisp) compressall; LayoutDeviceIntPoint chromeDisp) compressall;
async SizeModeChanged(nsSizeMode sizeMode); async SizeModeChanged(nsSizeMode sizeMode);

View File

@ -1637,6 +1637,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool bool
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size, TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
const ScreenOrientationInternal& orientation, const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& clientOffset,
const LayoutDeviceIntPoint& chromeDisp) const LayoutDeviceIntPoint& chromeDisp)
{ {
if (!mRemoteFrame) { if (!mRemoteFrame) {
@ -1644,6 +1645,7 @@ TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
} }
mUnscaledOuterRect = rect; mUnscaledOuterRect = rect;
mClientOffset = clientOffset;
mChromeDisp = chromeDisp; mChromeDisp = chromeDisp;
mOrientation = orientation; mOrientation = orientation;
@ -1662,8 +1664,8 @@ TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height, baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
true); true);
mPuppetWidget->Resize(screenRect.x + chromeDisp.x, mPuppetWidget->Resize(screenRect.x + clientOffset.x + chromeDisp.x,
screenRect.y + chromeDisp.y, screenRect.y + clientOffset.y + chromeDisp.y,
screenSize.width, screenSize.height, true); screenSize.width, screenSize.height, true);
return true; return true;
@ -2940,8 +2942,8 @@ TabChild::RecvUIResolutionChanged(const float& aDpi, const double& aScale)
ScreenIntSize screenSize = GetInnerSize(); ScreenIntSize screenSize = GetInnerSize();
if (mHasValidInnerSize && oldScreenSize != screenSize) { if (mHasValidInnerSize && oldScreenSize != screenSize) {
ScreenIntRect screenRect = GetOuterRect(); ScreenIntRect screenRect = GetOuterRect();
mPuppetWidget->Resize(screenRect.x + mChromeDisp.x, mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeDisp.x,
screenRect.y + mChromeDisp.y, screenRect.y + mClientOffset.y + mChromeDisp.y,
screenSize.width, screenSize.height, true); screenSize.width, screenSize.height, true);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation()); nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());

View File

@ -333,6 +333,7 @@ public:
RecvUpdateDimensions(const CSSRect& aRect, RecvUpdateDimensions(const CSSRect& aRect,
const CSSSize& aSize, const CSSSize& aSize,
const ScreenOrientationInternal& aOrientation, const ScreenOrientationInternal& aOrientation,
const LayoutDeviceIntPoint& aClientOffset,
const LayoutDeviceIntPoint& aChromeDisp) override; const LayoutDeviceIntPoint& aChromeDisp) override;
virtual bool virtual bool
RecvSizeModeChanged(const nsSizeMode& aSizeMode) override; RecvSizeModeChanged(const nsSizeMode& aSizeMode) override;
@ -578,6 +579,7 @@ public:
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut); nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; }
LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; }; LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; };
bool IPCOpen() const { return mIPCOpen; } bool IPCOpen() const { return mIPCOpen; }
@ -729,6 +731,8 @@ private:
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback; SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
bool mHasValidInnerSize; bool mHasValidInnerSize;
bool mDestroyed; bool mDestroyed;
// Position of client area relative to the outer window
LayoutDeviceIntPoint mClientOffset;
// Position of tab, relative to parent widget (typically the window) // Position of tab, relative to parent widget (typically the window)
LayoutDeviceIntPoint mChromeDisp; LayoutDeviceIntPoint mChromeDisp;
TabId mUniqueId; TabId mUniqueId;

View File

@ -962,28 +962,28 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
if (mIsDestroyed) { if (mIsDestroyed) {
return; return;
} }
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
ScreenOrientationInternal orientation = config.orientation();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
nsCOMPtr<nsIWidget> widget = GetWidget(); nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) { if (!widget) {
NS_WARNING("No widget found in TabParent::UpdateDimensions"); NS_WARNING("No widget found in TabParent::UpdateDimensions");
return; return;
} }
nsIntRect contentRect = rect;
contentRect.x += widget->GetClientOffset().x; hal::ScreenConfiguration config;
contentRect.y += widget->GetClientOffset().y; hal::GetCurrentScreenConfiguration(&config);
ScreenOrientationInternal orientation = config.orientation();
LayoutDeviceIntPoint clientOffset = widget->GetClientOffset();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
if (!mUpdatedDimensions || mOrientation != orientation || if (!mUpdatedDimensions || mOrientation != orientation ||
mDimensions != size || !mRect.IsEqualEdges(contentRect) || mDimensions != size || !mRect.IsEqualEdges(rect) ||
clientOffset != mClientOffset ||
chromeOffset != mChromeOffset) { chromeOffset != mChromeOffset) {
mUpdatedDimensions = true; mUpdatedDimensions = true;
mRect = contentRect; mRect = rect;
mDimensions = size; mDimensions = size;
mOrientation = orientation; mOrientation = orientation;
mClientOffset = clientOffset;
mChromeOffset = chromeOffset; mChromeOffset = chromeOffset;
CSSToLayoutDeviceScale widgetScale = widget->GetDefaultScale(); CSSToLayoutDeviceScale widgetScale = widget->GetDefaultScale();
@ -998,7 +998,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
CSSRect unscaledRect = devicePixelRect / widgetScale; CSSRect unscaledRect = devicePixelRect / widgetScale;
CSSSize unscaledSize = devicePixelSize / widgetScale; CSSSize unscaledSize = devicePixelSize / widgetScale;
Unused << SendUpdateDimensions(unscaledRect, unscaledSize, Unused << SendUpdateDimensions(unscaledRect, unscaledSize,
orientation, chromeOffset); orientation, clientOffset, chromeOffset);
} }
} }

View File

@ -603,6 +603,7 @@ protected:
CSSToLayoutDeviceScale mDefaultScale; CSSToLayoutDeviceScale mDefaultScale;
bool mUpdatedDimensions; bool mUpdatedDimensions;
nsSizeMode mSizeMode; nsSizeMode mSizeMode;
LayoutDeviceIntPoint mClientOffset;
LayoutDeviceIntPoint mChromeOffset; LayoutDeviceIntPoint mChromeOffset;
private: private:

View File

@ -1234,7 +1234,7 @@ PuppetWidget::GetWindowPosition()
int32_t winX, winY, winW, winH; int32_t winX, winY, winW, winH;
NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX, &winY, &winW, &winH), nsIntPoint()); NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX, &winY, &winW, &winH), nsIntPoint());
return nsIntPoint(winX, winY); return nsIntPoint(winX, winY) + GetOwningTabChild()->GetClientOffset().ToUnknownPoint();
} }
NS_METHOD NS_METHOD