Bug 1554861 - Disable clipping and scaling for top-level remote browsers to resolve regressions. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D35702

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan Hunt 2019-06-25 03:16:31 +00:00
parent 5a7cce5fce
commit 6b6abd3a36
5 changed files with 25 additions and 16 deletions

View File

@ -3332,16 +3332,16 @@ ScreenIntSize BrowserChild::GetInnerSize() {
innerSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
};
LayoutDeviceIntRect BrowserChild::GetVisibleRect() {
CSSRect visibleRect;
Maybe<LayoutDeviceIntRect> BrowserChild::GetVisibleRect() const {
if (mIsTopLevel) {
// We are conservative about visible rects for top-level browsers to avoid
// artifacts when resizing
visibleRect = CSSRect(CSSPoint(), mUnscaledInnerSize);
} else {
visibleRect = CSSPixel::FromAppUnits(mEffectsInfo.mVisibleRect);
return Nothing();
}
return RoundedToInt(visibleRect * mPuppetWidget->GetDefaultScale());
CSSRect visibleRectCSS = CSSPixel::FromAppUnits(mEffectsInfo.mVisibleRect);
LayoutDeviceIntRect visibleRectLD =
RoundedToInt(visibleRectCSS * mPuppetWidget->GetDefaultScale());
return Some(visibleRectLD);
}
ScreenIntRect BrowserChild::GetOuterRect() {

View File

@ -239,6 +239,8 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
return mBrowserChildMessageManager;
}
bool IsTopLevel() const { return mIsTopLevel; }
/**
* MessageManagerCallback methods that we override.
*/
@ -549,7 +551,7 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
ScreenIntSize GetInnerSize();
LayoutDeviceIntRect GetVisibleRect();
Maybe<LayoutDeviceIntRect> GetVisibleRect() const;
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow(const ShowInfo& aShowInfo);

View File

@ -3792,11 +3792,14 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// If we are in a remote browser, then apply clipping from ancestor browsers
if (BrowserChild* browserChild = BrowserChild::GetFrom(presShell)) {
LayoutDeviceIntRect unscaledVisibleRect = browserChild->GetVisibleRect();
CSSRect visibleRect =
unscaledVisibleRect / presContext->CSSToDevPixelScale();
rootVisualOverflow.IntersectRect(rootVisualOverflow,
CSSPixel::ToAppUnits(visibleRect));
Maybe<LayoutDeviceIntRect> unscaledVisibleRect =
browserChild->GetVisibleRect();
if (unscaledVisibleRect) {
CSSRect visibleRect =
*unscaledVisibleRect / presContext->CSSToDevPixelScale();
rootVisualOverflow.IntersectRect(rootVisualOverflow,
CSSPixel::ToAppUnits(visibleRect));
}
}
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();

View File

@ -2880,8 +2880,10 @@ FrameLayerBuilder* nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
// If we are in a remote browser, then apply scaling from ancestor browsers
if (BrowserChild* browserChild = BrowserChild::GetFrom(presShell)) {
resolutionX *= browserChild->GetEffectsInfo().mScaleX;
resolutionY *= browserChild->GetEffectsInfo().mScaleY;
if (!browserChild->IsTopLevel()) {
resolutionX *= browserChild->GetEffectsInfo().mScaleX;
resolutionY *= browserChild->GetEffectsInfo().mScaleY;
}
}
ContainerLayerParameters containerParameters(resolutionX, resolutionY);

View File

@ -1159,10 +1159,12 @@ LayoutDeviceIntRect PuppetWidget::GetScreenBounds() {
}
LayoutDeviceIntSize PuppetWidget::GetCompositionSize() {
if (!mBrowserChild) {
Maybe<LayoutDeviceIntRect> visibleRect =
mBrowserChild ? mBrowserChild->GetVisibleRect() : Nothing();
if (!visibleRect) {
return nsBaseWidget::GetCompositionSize();
}
return mBrowserChild->GetVisibleRect().Size();
return visibleRect->Size();
}
uint32_t PuppetWidget::GetMaxTouchPoints() const {