Bug 1430014 - Part 1: Add --enable-stylo=only configure option and MOZ_OLD_STYLE define. r?glandium,xidorn
MozReview-Commit-ID: FsypJFV1sxS
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8209,24 +8209,29 @@ 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
+
// We should only create the blocklist ONCE, and ignore any blocklist
// reloads happen. Because otherwise we could have a top level page that
// uses Stylo (if its load happens before the blocklist reload) and a
// child iframe that uses Gecko (if its load happens after the blocklist
// reload). If some page contains both backends, and they try to move
// element across backend boundary, it could crash (see bug 1404020).
sStyloBlocklistEnabled =
Preferences::GetBool("layout.css.stylo-blocklist.enabled");
@@ -8368,25 +8373,29 @@ nsLayoutUtils::RemoveFromStyloBlocklist(
sStyloBlocklist = nullptr;
}
}
/* 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
@@ -5788,17 +5788,21 @@ pref("layout.css.stylo-blocklist.blocked
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,51 @@ 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 = None
- # 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
+ old_style = True
elif len(value) and value[0] == 'build':
# Build but disable by request.
build_stylo = True
+ old_style = True
+ elif len(value) and value[0] == 'only':
+ # Disable the old style system.
+ build_stylo = True
+ enable_stylo = True
elif bool(value):
# Build and enable.
build_stylo = True
enable_stylo = True
+ old_style = 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 +795,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]