From 72b5e35b5789c44a1e9b1f4e2deee662d078cef3 Mon Sep 17 00:00:00 2001 From: David Parks Date: Fri, 30 Jan 2015 15:55:27 -0800 Subject: [PATCH] Bug 1075670 - Cleanup content process widget-chrome behavior. r=smaug Math for window chrome calculation was off on Linux. Removed redundant, and incorrect, math in favor of other better functions. --- dom/base/nsFrameLoader.cpp | 6 ++---- dom/ipc/TabParent.cpp | 9 ++++----- dom/ipc/TabParent.h | 4 +--- layout/generic/nsSubDocumentFrame.cpp | 21 --------------------- layout/generic/nsSubDocumentFrame.h | 2 -- 5 files changed, 7 insertions(+), 35 deletions(-) diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index a22a2013f68e..44bf65470d2f 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -914,8 +914,7 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size, // Don't show remote iframe if we are waiting for the completion of reflow. if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) { - nsIntPoint chromeDisp = aFrame->GetChromeDisplacement(); - mRemoteBrowser->UpdateDimensions(dimensions, size, chromeDisp); + mRemoteBrowser->UpdateDimensions(dimensions, size); } } @@ -1960,8 +1959,7 @@ nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame) nsIntSize size = aIFrame->GetSubdocumentSize(); nsIntRect dimensions; NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), NS_ERROR_FAILURE); - nsIntPoint chromeDisp = aIFrame->GetChromeDisplacement(); - mRemoteBrowser->UpdateDimensions(dimensions, size, chromeDisp); + mRemoteBrowser->UpdateDimensions(dimensions, size); } return NS_OK; } diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 15569ce23612..0c2b4ef239f2 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -907,8 +907,7 @@ TabParent::RecvSetDimensions(const uint32_t& aFlags, } void -TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size, - const nsIntPoint& aChromeDisp) +TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size) { if (mIsDestroyed) { return; @@ -923,9 +922,9 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size, mRect = rect; mDimensions = size; mOrientation = orientation; - mChromeDisp = aChromeDisp; - unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, mChromeDisp); + nsIntPoint chromeOffset = -GetChildProcessOffset(); + unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, chromeOffset); } } @@ -2707,7 +2706,7 @@ TabParent::HandleEvent(nsIDOMEvent* aEvent) } nsIntRect windowDims; NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE); - UpdateDimensions(windowDims, mDimensions, mChromeDisp); + UpdateDimensions(windowDims, mDimensions); return NS_OK; } return NS_OK; diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 63e2cc51aef9..86e4d7e918b9 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -247,8 +247,7 @@ public: // message-sending functions under a layer of indirection and // eating the return values void Show(const nsIntSize& size, bool aParentIsActive); - void UpdateDimensions(const nsIntRect& rect, const nsIntSize& size, - const nsIntPoint& chromeDisp); + void UpdateDimensions(const nsIntRect& rect, const nsIntSize& size); void UpdateFrame(const layers::FrameMetrics& aFrameMetrics); void UIResolutionChanged(); void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration); @@ -445,7 +444,6 @@ protected: nsIntRect mRect; nsIntSize mDimensions; ScreenOrientation mOrientation; - nsIntPoint mChromeDisp; float mDPI; CSSToLayoutDeviceScale mDefaultScale; bool mShown; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 4a74295513a1..a470a66b952c 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -1274,24 +1274,3 @@ nsSubDocumentFrame::ObtainIntrinsicSizeFrame() } return nullptr; } - -nsIntPoint -nsSubDocumentFrame::GetChromeDisplacement() -{ - nsIFrame* nextFrame = nsLayoutUtils::GetCrossDocParentFrame(this); - if (!nextFrame) { - NS_WARNING("Couldn't find window chrome to calculate displacement to."); - return nsIntPoint(); - } - - nsIFrame* rootFrame = nextFrame; - while (nextFrame) { - rootFrame = nextFrame; - nextFrame = nsLayoutUtils::GetCrossDocParentFrame(rootFrame); - } - - nsPoint offset = GetOffsetToCrossDoc(rootFrame); - int32_t appUnitsPerDevPixel = rootFrame->PresContext()->AppUnitsPerDevPixel(); - return nsIntPoint((int)(offset.x/appUnitsPerDevPixel), - (int)(offset.y/appUnitsPerDevPixel)); -} diff --git a/layout/generic/nsSubDocumentFrame.h b/layout/generic/nsSubDocumentFrame.h index 788e4d8d9b63..f409f3bd4759 100644 --- a/layout/generic/nsSubDocumentFrame.h +++ b/layout/generic/nsSubDocumentFrame.h @@ -127,8 +127,6 @@ public: */ bool PassPointerEventsToChildren(); - nsIntPoint GetChromeDisplacement(); - protected: friend class AsyncFrameInit;