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.
This commit is contained in:
David Parks 2015-01-30 15:55:27 -08:00
parent e362b3b9e3
commit 462c259c6c
5 changed files with 7 additions and 35 deletions

View File

@ -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;
}

View File

@ -905,8 +905,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;
@ -921,9 +920,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);
}
}
@ -2693,7 +2692,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;

View File

@ -246,8 +246,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);
@ -443,7 +442,6 @@ protected:
nsIntRect mRect;
nsIntSize mDimensions;
ScreenOrientation mOrientation;
nsIntPoint mChromeDisp;
float mDPI;
CSSToLayoutDeviceScale mDefaultScale;
bool mShown;

View File

@ -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));
}

View File

@ -127,8 +127,6 @@ public:
*/
bool PassPointerEventsToChildren();
nsIntPoint GetChromeDisplacement();
protected:
friend class AsyncFrameInit;