Bug 1349949 - Turn some advanced layers prefs into override prefs. r?mchang
This allows us to remove the #ifdef MOZ_ENABLE_WEBRENDER for the advanced layers
prefs from all.js. As additional advanced layers are turned on for webrender (or
non-webrender) they can be converted into override prefs without affecting the
call sites.
MozReview-Commit-ID: F9tMc23ow8A
--- a/dom/plugins/test/reftest/reftest.list
+++ b/dom/plugins/test/reftest/reftest.list
@@ -2,17 +2,17 @@
random-if(!haveTestPlugin) != plugin-sanity.html about:blank
fails-if(!haveTestPlugin) == plugin-sanity.html div-sanity.html
fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,160000) == plugin-alpha-zindex.html div-alpha-zindex.html
fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,164000) fails-if(webrender) == plugin-alpha-opacity.html div-alpha-opacity.html
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == windowless-clipping-1.html windowless-clipping-1-ref.html # bug 631832
# fuzzy because of anti-aliasing in dashed border
fuzzy(16,256) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == border-padding-1.html border-padding-1-ref.html # bug 629430
fuzzy(16,256) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html # bug 629430
-skip-if(!webrender) pref(layers.advanced.border-layers,true) fuzzy(16,256) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) fuzzy(16,256) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html
fuzzy(16,256) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) skip-if(!haveTestPlugin||Android) == border-padding-3.html border-padding-3-ref.html # bug 629430 # bug 773482
# The following two "pluginproblemui-direction" tests are unreliable on all platforms. They should be re-written or replaced.
#random-if(cocoaWidget||d2d||/^Windows\x20NT\x205\.1/.test(http.oscpu)) fails-if(!haveTestPlugin&&!Android) == pluginproblemui-direction-1.html pluginproblemui-direction-1-ref.html # bug 567367
#random-if(cocoaWidget) fails-if(!haveTestPlugin&&!Android) == pluginproblemui-direction-2.html pluginproblemui-direction-2-ref.html
fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,160000) == plugin-canvas-alpha-zindex.html div-alpha-zindex.html
fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,160000) == plugin-transform-alpha-zindex.html div-alpha-zindex.html
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,160000) == plugin-busy-alpha-zindex.html div-alpha-zindex.html
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,32400) == plugin-background.html plugin-background-ref.html
--- a/gfx/thebes/gfxPrefs.cpp
+++ b/gfx/thebes/gfxPrefs.cpp
@@ -4,16 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxPrefs.h"
#include "MainThreadUtils.h"
#include "nsXULAppAPI.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
+#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/GPUChild.h"
#include "mozilla/gfx/GPUProcessManager.h"
using namespace mozilla;
nsTArray<gfxPrefs::Pref*>* gfxPrefs::sGfxPrefList = nullptr;
gfxPrefs* gfxPrefs::sInstance = nullptr;
@@ -300,8 +301,13 @@ void gfxPrefs::CopyPrefValue(const GfxPr
{
*aOutValue = aValue->get_float();
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue)
{
*aOutValue = aValue->get_nsCString().get();
}
+
+bool gfxPrefs::OverrideBase_WebRender()
+{
+ return gfx::gfxVars::UseWebRender();
+}
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -480,23 +480,23 @@ private:
DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor", ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
- DECL_GFX_PREF(Live, "layers.advanced.border-layers", LayersAllowBorderLayers, bool, false);
+ DECL_OVERRIDE_PREF(Live, "layers.advanced.border-layers", LayersAllowBorderLayers, false);
DECL_GFX_PREF(Live, "layers.advanced.boxshadow-inset-layers", LayersAllowInsetBoxShadow, bool, false);
- DECL_GFX_PREF(Live, "layers.advanced.boxshadow-outer-layers", LayersAllowOuterBoxShadow, bool, false);
+ DECL_OVERRIDE_PREF(Live, "layers.advanced.boxshadow-outer-layers", LayersAllowOuterBoxShadow, false);
DECL_GFX_PREF(Live, "layers.advanced.bullet-layers", LayersAllowBulletLayers, bool, false);
DECL_GFX_PREF(Live, "layers.advanced.button-foreground-layers", LayersAllowButtonForegroundLayers, bool, false);
DECL_GFX_PREF(Live, "layers.advanced.canvas-background-color", LayersAllowCanvasBackgroundColorLayers, bool, false);
- DECL_GFX_PREF(Live, "layers.advanced.caret-layers", LayersAllowCaretLayers, bool, false);
+ DECL_OVERRIDE_PREF(Live, "layers.advanced.caret-layers", LayersAllowCaretLayers, gfxPrefs::OverrideBase_WebRender());
DECL_GFX_PREF(Live, "layers.advanced.displaybuttonborder-layers", LayersAllowDisplayButtonBorder, bool, false);
DECL_GFX_PREF(Live, "layers.advanced.image-layers", LayersAllowImageLayers, bool, false);
DECL_GFX_PREF(Live, "layers.advanced.outline-layers", LayersAllowOutlineLayers, bool, false);
DECL_GFX_PREF(Live, "layers.advanced.text-layers", LayersAllowTextLayers, bool, false);
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
@@ -733,16 +733,21 @@ private:
static void CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue);
static void AssertMainThread();
+ // Some wrapper functions for the DECL_OVERRIDE_PREF prefs' base values, so
+ // that we don't to include all sorts of header files into this gfxPrefs.h
+ // file.
+ static bool OverrideBase_WebRender();
+
gfxPrefs();
~gfxPrefs();
gfxPrefs(const gfxPrefs&) = delete;
gfxPrefs& operator=(const gfxPrefs&) = delete;
};
#undef DECL_GFX_PREF /* Don't need it outside of this file */
--- a/layout/reftests/border-radius/reftest.list
+++ b/layout/reftests/border-radius/reftest.list
@@ -29,17 +29,17 @@ fuzzy-if(gtkWidget,14,280) fuzzy-if(coco
# Corners
== corner-1.html corner-1-ref.svg # bottom corners different radius than top corners
fuzzy-if(gtkWidget,23,5) fuzzy-if(winWidget&&!d2d,23,5) fuzzy-if(d2d,32,8) fuzzy-if(Android,10,8) == corner-2.html corner-2-ref.svg # right corners different radius than left corners; see bug 500804
fuzzy-if(gtkWidget,3,10) fuzzy-if(winWidget&&!d2d,3,10) fuzzy-if(d2d,15,32) fuzzy-if(Android,3,15) fuzzy-if(skiaContent,3,100) == corner-3.html corner-3-ref.svg
fuzzy-if(skiaContent,1,2728) == corner-4.html corner-4-ref.svg
# Test that radii too long are reduced
== border-reduce-height.html border-reduce-height-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == border-reduce-height.html border-reduce-height-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == border-reduce-height.html border-reduce-height-ref.html
# Tests for border clipping
fails == clipping-1.html clipping-1-ref.html # background color should completely fill box; bug 466572
!= clipping-2.html about:blank # background color clipped to inner/outer border, can't get
# great tests for this due to antialiasing problems described in bug 466572
fuzzy-if(skiaContent,1,13) == clipping-3.html clipping-3-ref.xhtml # edge of border-radius clips an underlying object's background
# Tests for clipping the contents of replaced elements and overflow!=visible
--- a/layout/reftests/box-sizing/reftest.list
+++ b/layout/reftests/box-sizing/reftest.list
@@ -1,32 +1,32 @@
== intrinsic-1a.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1a.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1a.html intrinsic-1-ref.html
== intrinsic-1b.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1b.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1b.html intrinsic-1-ref.html
== intrinsic-1c.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1c.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1c.html intrinsic-1-ref.html
== intrinsic-1d.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1d.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1d.html intrinsic-1-ref.html
== intrinsic-1e.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1e.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1e.html intrinsic-1-ref.html
== intrinsic-1f.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1f.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1f.html intrinsic-1-ref.html
== intrinsic-1g.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1g.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1g.html intrinsic-1-ref.html
== intrinsic-1h.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1h.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1h.html intrinsic-1-ref.html
== intrinsic-1i.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1i.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1i.html intrinsic-1-ref.html
== intrinsic-1j.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1j.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1j.html intrinsic-1-ref.html
== intrinsic-1k.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1k.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1k.html intrinsic-1-ref.html
== intrinsic-1l.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1l.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1l.html intrinsic-1-ref.html
== intrinsic-1m.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1m.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1m.html intrinsic-1-ref.html
== intrinsic-1n.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1n.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1n.html intrinsic-1-ref.html
== intrinsic-1o.html intrinsic-1-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == intrinsic-1o.html intrinsic-1-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == intrinsic-1o.html intrinsic-1-ref.html
== computed-size-reporting.html computed-size-reporting-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == computed-size-reporting.html computed-size-reporting-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == computed-size-reporting.html computed-size-reporting-ref.html
--- a/layout/reftests/css-sizing/reftest.list
+++ b/layout/reftests/css-sizing/reftest.list
@@ -1,7 +1,7 @@
== min-intrinsic-with-percents-across-img-cases.html min-intrinsic-with-percents-across-img-cases-ref.html
== min-intrinsic-with-percents-across-elements.html min-intrinsic-with-percents-across-elements-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == min-intrinsic-with-percents-across-elements.html min-intrinsic-with-percents-across-elements-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == min-intrinsic-with-percents-across-elements.html min-intrinsic-with-percents-across-elements-ref.html
== min-intrinsic-with-max-width-percents-across-form-controls.html min-intrinsic-with-max-width-percents-across-form-controls-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == min-intrinsic-with-max-width-percents-across-form-controls.html min-intrinsic-with-max-width-percents-across-form-controls-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == min-intrinsic-with-max-width-percents-across-form-controls.html min-intrinsic-with-max-width-percents-across-form-controls-ref.html
== min-intrinsic-with-width-percents-across-form-controls.html min-intrinsic-with-width-percents-across-form-controls-ref.html
-skip-if(!webrender) pref(layers.advanced.border-layers,true) == min-intrinsic-with-width-percents-across-form-controls.html min-intrinsic-with-width-percents-across-form-controls-ref.html
+skip-if(!webrender) pref(layers.advanced.border-layers,1) == min-intrinsic-with-width-percents-across-form-controls.html min-intrinsic-with-width-percents-across-form-controls-ref.html
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5636,16 +5636,17 @@ pref("dom.moduleScripts.enabled", false)
// Maximum number of setTimeout()/setInterval() callbacks to run in a single
// event loop runnable. Minimum value of 1.
pref("dom.timeout.max_consecutive_callbacks", 5);
#ifdef FUZZING
pref("fuzzing.enabled", false);
#endif
-// Set advanced layers preferences here.
-pref("layers.advanced.border-layers", false);
-#ifdef MOZ_ENABLE_WEBRENDER
-pref("layers.advanced.caret-layers", true);
-pref("layers.advanced.boxshadow-outer-layers", false);
-#else
-pref("layers.advanced.caret-layers", false);
-#endif
+// Set advanced layers preferences here to have them show up in about:config or
+// to be overridable in reftest.list files. They should pretty much all be set
+// to a value of 2, and the conditional-pref code in gfxPrefs.h will convert
+// it to a boolean as appropriate. In particular, do NOT add ifdefs here to
+// turn these on and off, instead use the conditional-pref code in gfxPrefs.h
+// to do that.
+pref("layers.advanced.border-layers", 2);
+pref("layers.advanced.boxshadow-outer-layers", 2);
+pref("layers.advanced.caret-layers", 2);