Bug 1430014 - Part 1: Add --enable-stylo=only configure option and MOZ_OLD_STYLE define. r=glandium,xidorn
authorCameron McCormack <cam@mcc.id.au>
Thu, 01 Feb 2018 15:04:04 +1100
changeset 402022 6de1de81767341ff29b351d0235f23e3647eefbc
parent 402021 c7dffbc2563adc58c9d484461bcef2f455268513
child 402023 00eb76cb9633b69785c0f52266c07430ab1ab542
push id58974
push userxquan@mozilla.com
push dateThu, 01 Feb 2018 04:04:57 +0000
treeherderautoland@6993eb29af7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, xidorn
bugs1430014
milestone60.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 1430014 - Part 1: Add --enable-stylo=only configure option and MOZ_OLD_STYLE define. r=glandium,xidorn MozReview-Commit-ID: FsypJFV1sxS
layout/base/nsLayoutUtils.cpp
modules/libpref/init/all.js
toolkit/moz.configure
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8215,25 +8215,30 @@ nsLayoutUtils::Initialize()
                                "nglayout.debug.invalidation");
   Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
                                "layout.interruptible-reflow.enabled");
   Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
                                "svg.transform-box.enabled");
   Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
                                "layout.css.text-combine-upright-digits.enabled");
 #ifdef MOZ_STYLO
+#ifdef MOZ_OLD_STYLE
   if (PR_GetEnv("STYLO_FORCE_ENABLED")) {
     sStyloEnabled = true;
   } else if (PR_GetEnv("STYLO_FORCE_DISABLED")) {
     sStyloEnabled = false;
   } else {
     Preferences::AddBoolVarCache(&sStyloEnabled,
                                  "layout.css.servo.enabled");
   }
+#else
+  sStyloEnabled = true;
 #endif
+#endif
+
   Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
                                "layout.idle_period.time_limit",
                                DEFAULT_IDLE_PERIOD_TIME_LIMIT);
   Preferences::AddUintVarCache(&sQuiescentFramesBeforeIdlePeriod,
                                "layout.idle_period.required_quiescent_frames",
                                DEFAULT_QUIESCENT_FRAMES);
 
   for (auto& callback : kPrefCallbacks) {
@@ -8276,25 +8281,29 @@ nsLayoutUtils::ShouldUseStylo(nsIPrincip
 
   return true;
 }
 
 /* static */
 bool
 nsLayoutUtils::StyloChromeEnabled()
 {
+#ifdef MOZ_OLD_STYLE
   static bool sInitialized = false;
   static bool sEnabled = false;
   if (!sInitialized) {
     // We intentionally don't allow dynamic toggling of this pref
     // because it is rather risky to mix style backend in XUL.
     sEnabled = Preferences::GetBool("layout.css.servo.chrome.enabled");
     sInitialized = true;
   }
   return sEnabled;
+#else
+  return true;
+#endif
 }
 #endif
 
 /* static */
 void
 nsLayoutUtils::RegisterImageRequest(nsPresContext* aPresContext,
                                     imgIRequest* aRequest,
                                     bool* aRequestRegistered)
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5817,17 +5817,21 @@ pref("media.block-autoplay-until-in-fore
 pref("layout.css.servo.enabled", true);
 #else
 pref("layout.css.servo.enabled", false);
 #endif
 // Whether Stylo is enabled for chrome document?
 // If Stylo is not enabled, this pref doesn't take any effect.
 // Note that this pref is only read once when requested. Changing it
 // at runtime may have no effect.
+#ifdef MOZ_OLD_STYLE
 pref("layout.css.servo.chrome.enabled", false);
+#else
+pref("layout.css.servo.chrome.enabled", true);
+#endif
 #endif
 
 // TODO: Bug 1324406: Treat 'data:' documents as unique, opaque origins
 // If true, data: URIs will be treated as unique opaque origins, hence will use
 // a NullPrincipal as the security context.
 // Otherwise it will inherit the origin from parent node, this is the legacy
 // behavior of Firefox.
 pref("security.data_uri.unique_opaque_origin", true);
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -545,40 +545,49 @@ id_and_secret_keyfile('Bing API')
 simple_keyfile('Adjust SDK')
 
 id_and_secret_keyfile('Leanplum SDK')
 
 simple_keyfile('Pocket API')
 
 # Servo integration
 # ==============================================================
-option('--enable-stylo', nargs='?', choices=('build',),
-       help='Include Stylo in the build and/or enable it at runtime')
+option('--enable-stylo', nargs='?', choices=('build', 'only'),
+       help='Include Stylo in the build.  "build" means to disable Stylo at ' +
+            'runtime, and "only" means to exclude the old style system from ' +
+            'the build.')
 
 @depends('--enable-stylo', '--help')
 def stylo_config(value, _):
     build_stylo = None
     enable_stylo = None
+    old_style = True
 
-    # If nothing is specified, default to building and enabling Stylo where it
-    # is known to work.
+    # If nothing is specified, default to building and enabling Stylo,
+    # and building the old style system.
     if value.origin == 'default':
         build_stylo = True
         enable_stylo = True
     elif len(value) and value[0] == 'build':
         # Build but disable by request.
         build_stylo = True
+    elif len(value) and value[0] == 'only':
+        # Disable the old style system.
+        build_stylo = True
+        enable_stylo = True
+        old_style = None
     elif bool(value):
         # Build and enable.
         build_stylo = True
         enable_stylo = True
 
     return namespace(
         build = build_stylo,
         enable = enable_stylo,
+        old_style = old_style,
     )
 
 option('--disable-stylo-build-bindgen',
        help='Disable build-time bindgen for Stylo')
 
 @depends(stylo_config, '--enable-stylo-build-bindgen', '--enable-compile-environment')
 def building_stylo_bindgen(stylo_config, bindgen_enabled, compile_environment):
     if not compile_environment:
@@ -784,16 +793,18 @@ with only_when(building_stylo_bindgen):
     set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
     set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
     set_config('MOZ_STYLO_BINDGEN', depends_if('--enable-stylo-build-bindgen')(lambda _: True))
 
 set_config('MOZ_STYLO', stylo_config.build)
 set_define('MOZ_STYLO', stylo_config.build)
 set_config('MOZ_STYLO_ENABLE', stylo_config.enable)
 set_define('MOZ_STYLO_ENABLE', stylo_config.enable)
+set_config('MOZ_OLD_STYLE', stylo_config.old_style)
+set_define('MOZ_OLD_STYLE', stylo_config.old_style)
 
 option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
        help='Absolute path of the target directory where libgeckoservo can '
             'be found. This is generally servo_src_dir/target/release.')
 
 @depends_if('--with-servo')
 def servo_target_dir(value):
     return value[0]