Bug 1032880 - Disable 'transparent content with displayports' warning in tests. r=tn
authorBotond Ballo <botond@mozilla.com>
Tue, 22 Jul 2014 17:01:50 -0400
changeset 195917 0d04d8ef1fc7af580df7a3ae369536561f56aded
parent 195916 554e549aab67d72e99daecc144f4e135eae092e9
child 195918 4692447866224ca1fd8d60a12b71cd7baa193ea8
push id46734
push userbballo@mozilla.com
push dateThu, 24 Jul 2014 18:20:18 +0000
treeherdermozilla-inbound@0d04d8ef1fc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1032880
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1032880 - Disable 'transparent content with displayports' warning in tests. r=tn
layout/base/nsDisplayList.cpp
modules/libpref/src/init/all.js
testing/profiles/prefs_general.js
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -60,16 +60,32 @@
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 using namespace mozilla::layout;
 typedef FrameMetrics::ViewID ViewID;
 
+#ifdef DEBUG
+static bool
+SpammyLayoutWarningsEnabled()
+{
+  static bool sValue = false;
+  static bool sValueInitialized = false;
+
+  if (!sValueInitialized) {
+    Preferences::GetBool("layout.spammy_warnings.enabled", &sValue);
+    sValueInitialized = true;
+  }
+
+  return sValue;
+}
+#endif
+
 static inline nsIFrame*
 GetTransformRootFrame(nsIFrame* aFrame)
 {
   return nsLayoutUtils::GetTransformRootFrame(aFrame);
 }
 
 static void AddTransformFunctions(nsCSSValueList* aList,
                                   nsStyleContext* aContext,
@@ -1249,35 +1265,41 @@ void nsDisplayList::PaintForFrame(nsDisp
   }
   // Root is being scaled up by the X/Y resolution. Scale it back down.
   root->SetPostScale(1.0f/containerParameters.mXScale,
                      1.0f/containerParameters.mYScale);
 
   bool isRoot = presContext->IsRootContentDocument();
 
   nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
-  bool usingDisplayport = false;
-  if (rootScrollFrame) {
-    nsIContent* content = rootScrollFrame->GetContent();
-    if (content) {
-      usingDisplayport = nsLayoutUtils::GetDisplayPort(content, nullptr);
-    }
-  }
 
   nsRect viewport(aBuilder->ToReferenceFrame(aForFrame), aForFrame->GetSize());
 
   RecordFrameMetrics(aForFrame, rootScrollFrame,
                      aBuilder->FindReferenceFrameFor(aForFrame),
                      root, viewport,
                      !isRoot, isRoot, containerParameters);
+
+  // NS_WARNING is debug-only, so don't even bother checking the conditions in
+  // a release build.
+#ifdef DEBUG
+  bool usingDisplayport = false;
+  if (rootScrollFrame) {
+    nsIContent* content = rootScrollFrame->GetContent();
+    if (content) {
+      usingDisplayport = nsLayoutUtils::GetDisplayPort(content, nullptr);
+    }
+  }
   if (usingDisplayport &&
-      !(root->GetContentFlags() & Layer::CONTENT_OPAQUE)) {
+      !(root->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
+      SpammyLayoutWarningsEnabled()) {
     // See bug 693938, attachment 567017
     NS_WARNING("Transparent content with displayports can be expensive.");
   }
+#endif
 
   layerManager->SetRoot(root);
   layerBuilder->WillEndTransaction();
 
   if (widgetTransaction ||
       // SVG-as-an-image docs don't paint as part of the retained layer tree,
       // but they still need the invalidation state bits cleared in order for
       // invalidation for CSS/SMIL animation to work properly.
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -2041,16 +2041,19 @@ pref("layout.display-list.dump", false);
 // after we've just finished processing the last notification, which might
 // lead to starvation problems.
 // When false, we use a "slack" timer which fires Nms after the *end*
 // of the last notification. This can give less tight frame rates
 // but provides more time for other operations when the browser is
 // heavily loaded.
 pref("layout.frame_rate.precise", false);
 
+// pref to control whether layout warnings that are hit quite often are enabled 
+pref("layout.spammy_warnings.enabled", true);
+
 // Is support for the Web Animations API enabled?
 #ifdef RELEASE_BUILD
 pref("dom.animations-api.core.enabled", false);
 #else
 pref("dom.animations-api.core.enabled", true);
 #endif
 
 // pref to permit users to make verified SOAP calls by default
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -134,16 +134,19 @@ user_pref("datareporting.healthreport.ab
 user_pref("layout.css.report_errors", true);
 
 // Enable CSS Grid for testing
 user_pref("layout.css.grid.enabled", true);
 
 // Enable CSS Ruby for testing
 user_pref("layout.css.ruby.enabled", true);
 
+// Disable spammy layout warnings because they pollute test logs
+user_pref("layout.spammy_warnings.enabled", false);
+
 // Enable mozContacts
 user_pref("dom.mozContacts.enabled", true);
 user_pref("dom.navigator-property.disable.mozContacts", false);
 user_pref("dom.global-constructor.disable.mozContact", false);
 
 // Enable mozSettings
 user_pref("dom.mozSettings.enabled", true);