Bug 1259641 - Do not force reflow for all tabs when size mode changed. r=smaug
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 20 Apr 2016 11:41:42 +0800
changeset 318486 4965b4f209335d05855c813e772e5ec45ba2df0c
parent 318485 5b7355654e6e70f9248c414abbc5e9347279292b
child 318487 cecb988dcacb3532adca881a93ef3fb0585f90f0
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1259641
milestone48.0a1
Bug 1259641 - Do not force reflow for all tabs when size mode changed. r=smaug MozReview-Commit-ID: GoTCM60Hmlf
dom/ipc/TabChild.cpp
layout/style/nsMediaFeatures.cpp
--- 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;
   }