Bug 1259641 - Do not force reflow for all tabs when size mode changed. r?smaug
MozReview-Commit-ID: GoTCM60Hmlf
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1650,23 +1650,25 @@ TabChild::RecvUpdateDimensions(const CSS
return true;
}
bool
TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode)
{
mPuppetWidget->SetSizeMode(aSizeMode);
+ if (!mPuppetWidget->IsVisible()) {
+ return true;
+ }
nsCOMPtr<nsIDocument> document(GetDocument());
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
if (presShell) {
nsPresContext* presContext = presShell->GetPresContext();
if (presContext) {
- presContext->MediaFeatureValuesChangedAllDocuments(eRestyle_Subtree,
- NS_STYLE_HINT_REFLOW);
+ presContext->SizeModeChanged(aSizeMode);
}
}
return true;
}
bool
TabChild::UpdateFrame(const FrameMetrics& aFrameMetrics)
{
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -323,16 +323,19 @@ GetDisplayMode(nsPresContext* aPresConte
if (!baseWindow) {
aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_BROWSER, eCSSUnit_Enumerated);
return NS_OK;
}
nsCOMPtr<nsIWidget> mainWidget;
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
int32_t displayMode;
nsSizeMode mode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
+ // Background tabs are always in 'browser' mode for now.
+ // If new modes are supported, please ensure not cause the regression in
+ // Bug 1259641.
switch (mode) {
case nsSizeMode_Fullscreen:
displayMode = NS_STYLE_DISPLAY_MODE_FULLSCREEN;
break;
default:
displayMode = NS_STYLE_DISPLAY_MODE_BROWSER;
break;
}