From daa8e38158e62d23af8c66b7b8c4b6288d7a9718 Mon Sep 17 00:00:00 2001 From: Wei-Cheng Pan Date: Wed, 20 Apr 2016 11:41:42 +0800 Subject: [PATCH] Bug 1259641 - Do not force reflow for all tabs when size mode changed. r=smaug MozReview-Commit-ID: GoTCM60Hmlf --HG-- extra : transplant_source : S%88%AD%A3%99%9Bk%D3%E4U%0302%82%87o3%28%FFK --- dom/ipc/TabChild.cpp | 6 ++++-- layout/style/nsMediaFeatures.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 5eb5d2f26acb..7c74a82c311b 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1655,13 +1655,15 @@ bool TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode) { mPuppetWidget->SetSizeMode(aSizeMode); + if (!mPuppetWidget->IsVisible()) { + return true; + } nsCOMPtr document(GetDocument()); nsCOMPtr presShell = document->GetShell(); if (presShell) { nsPresContext* presContext = presShell->GetPresContext(); if (presContext) { - presContext->MediaFeatureValuesChangedAllDocuments(eRestyle_Subtree, - NS_STYLE_HINT_REFLOW); + presContext->SizeModeChanged(aSizeMode); } } return true; diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 0bd1b0cfefe5..075e1b251966 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -328,6 +328,9 @@ GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*, 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;