Bug 1290013 - Add a pref to disable stylo. r=bholley

MozReview-Commit-ID: DG9Q61OYlvl
This commit is contained in:
Cameron McCormack 2016-08-05 17:45:58 +08:00
parent d6bc8f10b9
commit bddd447666
4 changed files with 27 additions and 15 deletions

View File

@ -170,6 +170,9 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
#ifdef MOZ_STYLO
/* static */ bool nsLayoutUtils::sStyloEnabled;
#endif
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
@ -7840,6 +7843,10 @@ nsLayoutUtils::Initialize()
"svg.transform-box.enabled");
Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
"layout.css.text-combine-upright-digits.enabled");
#ifdef MOZ_STYLO
Preferences::AddBoolVarCache(&sStyloEnabled,
"layout.css.servo.enabled");
#endif
for (auto& callback : kPrefCallbacks) {
Preferences::RegisterCallbackAndCall(callback.func, callback.name);
@ -9337,7 +9344,7 @@ nsLayoutUtils::GetCumulativeApzCallbackTransform(nsIFrame* aFrame)
/* static */ bool
nsLayoutUtils::SupportsServoStyleBackend(nsIDocument* aDocument)
{
return nsPresContext::StyloEnabled() &&
return StyloEnabled() &&
aDocument->IsHTMLOrXHTML() &&
static_cast<nsDocument*>(aDocument)->IsContentDocument();
}

View File

@ -2421,6 +2421,17 @@ public:
return sTextCombineUprightDigitsEnabled;
}
// Stylo (the Servo backend for Gecko's style system) is generally enabled
// or disabled at compile-time. However, we provide the additional capability
// to disable it dynamically in stylo-enabled builds via a pref.
static bool StyloEnabled() {
#ifdef MOZ_STYLO
return sStyloEnabled;
#else
return false;
#endif
}
/**
* See comment above "font.size.inflation.mappingIntercept" in
* modules/libpref/src/init/all.js .
@ -2861,6 +2872,9 @@ private:
static bool sInterruptibleReflowEnabled;
static bool sSVGTransformBoxEnabled;
static bool sTextCombineUprightDigitsEnabled;
#ifdef MOZ_STYLO
static bool sStyloEnabled;
#endif
/**
* Helper function for LogTestDataForPaint().

View File

@ -1106,20 +1106,6 @@ public:
mHasWarnedAboutTooLargeDashedOrDottedRadius = true;
}
static bool StyloEnabled()
{
// Stylo (the Servo backend for Gecko's style system) is generally enabled
// or disabled at compile-time. However, we provide the additional capability
// to disable it dynamically in stylo-enabled builds via an environmental
// variable.
#ifdef MOZ_STYLO
static bool disabled = PR_GetEnv("MOZ_DISABLE_STYLO");
return !disabled;
#else
return false;
#endif
}
protected:
friend class nsRunnableMethod<nsPresContext>;
void ThemeChangedInternal();

View File

@ -5500,3 +5500,8 @@ pref("osfile.reset_worker_delay", 30000);
pref("dom.webkitBlink.dirPicker.enabled", true);
pref("dom.webkitBlink.filesystem.enabled", true);
#endif
#ifdef MOZ_STYLO
// Is the Servo-backed style system enabled?
pref("layout.css.servo.enabled", true);
#endif