Backed out 4 changesets (bug 1447611) for mass failures due to --enable-stylo removal. CLOSED TREE

Backed out changeset c6193142bbcf (bug 1447611)
Backed out changeset 01ada1c5a95f (bug 1447611)
Backed out changeset 86c9fed44da2 (bug 1447611)
Backed out changeset bb84ac6e1468 (bug 1447611)
This commit is contained in:
Csoregi Natalia 2018-03-21 19:01:07 +02:00
Родитель f8eadb8613
Коммит d6c6d38406
23 изменённых файлов: 458 добавлений и 156 удалений

Просмотреть файл

@ -1500,6 +1500,7 @@ nsIDocument::nsIDocument()
mAsyncOnloadBlockCount(0), mAsyncOnloadBlockCount(0),
mCompatMode(eCompatibility_FullStandards), mCompatMode(eCompatibility_FullStandards),
mReadyState(ReadyState::READYSTATE_UNINITIALIZED), mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
mStyleBackendType(StyleBackendType::None),
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
mVisibilityState(dom::VisibilityState::Hidden), mVisibilityState(dom::VisibilityState::Hidden),
#else #else
@ -2155,9 +2156,13 @@ nsDocument::Init()
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!"); NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
UpdateStyleBackendType();
// Set this when document is initialized and value stays the same for the // Set this when document is initialized and value stays the same for the
// lifetime of the document. // lifetime of the document.
mIsShadowDOMEnabled = nsContentUtils::IsShadowDOMEnabled(); mIsShadowDOMEnabled =
mStyleBackendType == StyleBackendType::Servo &&
nsContentUtils::IsShadowDOMEnabled();
// If after creation the owner js global is not set for a document // If after creation the owner js global is not set for a document
// we use the default compartment for this document, instead of creating // we use the default compartment for this document, instead of creating
@ -8899,6 +8904,7 @@ nsDocument::CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const
clone->mContentLanguage = mContentLanguage; clone->mContentLanguage = mContentLanguage;
clone->SetContentTypeInternal(GetContentTypeInternal()); clone->SetContentTypeInternal(GetContentTypeInternal());
clone->mSecurityInfo = mSecurityInfo; clone->mSecurityInfo = mSecurityInfo;
clone->mStyleBackendType = mStyleBackendType;
// State from nsDocument // State from nsDocument
clone->mType = mType; clone->mType = mType;
@ -12602,6 +12608,21 @@ nsIDocument::ReportHasScrollLinkedEffect()
"ScrollLinkedEffectFound2"); "ScrollLinkedEffectFound2");
} }
void
nsIDocument::UpdateStyleBackendType()
{
MOZ_ASSERT(mStyleBackendType == StyleBackendType::None,
"no need to call UpdateStyleBackendType now");
// Assume Gecko by default.
mStyleBackendType = StyleBackendType::Gecko;
if (nsLayoutUtils::StyloEnabled() &&
nsLayoutUtils::ShouldUseStylo(NodePrincipal())) {
mStyleBackendType = StyleBackendType::Servo;
}
}
void void
nsIDocument::SetUserHasInteracted(bool aUserHasInteracted) nsIDocument::SetUserHasInteracted(bool aUserHasInteracted)
{ {

Просмотреть файл

@ -1737,13 +1737,24 @@ public:
return mCSSLoader; return mCSSLoader;
} }
mozilla::StyleBackendType GetStyleBackendType() const mozilla::StyleBackendType GetStyleBackendType() const {
{ MOZ_ASSERT(mStyleBackendType != mozilla::StyleBackendType::None,
return mozilla::StyleBackendType::Servo; "Not initialized yet");
return mStyleBackendType;
} }
bool IsStyledByServo() const /**
{ * Documents generally decide their style backend type themselves, and
* this is only used for XBL documents to set their style backend type to
* their bounding document's.
*/
/**
* Decide this document's own style backend type.
*/
void UpdateStyleBackendType();
bool IsStyledByServo() const {
return GetStyleBackendType() == mozilla::StyleBackendType::Servo; return GetStyleBackendType() == mozilla::StyleBackendType::Servo;
} }
@ -4214,6 +4225,10 @@ protected:
// Our readyState // Our readyState
ReadyState mReadyState; ReadyState mReadyState;
// Whether this document has (or will have, once we have a pres shell) a
// Gecko- or Servo-backed style system.
mozilla::StyleBackendType mStyleBackendType;
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
// Our visibility state // Our visibility state
mozilla::dom::VisibilityState mVisibilityState; mozilla::dom::VisibilityState mVisibilityState;

Просмотреть файл

@ -2368,11 +2368,17 @@ nsXULPrototypeElement::SetAttrAt(uint32_t aPos, const nsAString& aValue,
// TODO: If we implement Content Security Policy for chrome documents // TODO: If we implement Content Security Policy for chrome documents
// as has been discussed, the CSP should be checked here to see if // as has been discussed, the CSP should be checked here to see if
// inline styles are allowed to be applied. // inline styles are allowed to be applied.
RefPtr<URLExtraData> data =
new URLExtraData(aDocumentURI, aDocumentURI, principal); RefPtr<DeclarationBlock> declaration;
RefPtr<DeclarationBlock> declaration = if (nsLayoutUtils::StyloEnabled() &&
ServoDeclarationBlock::FromCssText( nsLayoutUtils::ShouldUseStylo(principal)) {
aValue, data, eCompatibility_FullStandards, nullptr); RefPtr<URLExtraData> data =
new URLExtraData(aDocumentURI, aDocumentURI, principal);
declaration = ServoDeclarationBlock::FromCssText(
aValue, data, eCompatibility_FullStandards, nullptr);
} else {
MOZ_CRASH("old style system disabled");
}
if (declaration) { if (declaration) {
mAttributes[aPos].mValue.SetTo(declaration.forget(), &aValue); mAttributes[aPos].mValue.SetTo(declaration.forget(), &aValue);

Просмотреть файл

@ -196,6 +196,7 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled; /* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled; /* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled; /* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
/* static */ bool nsLayoutUtils::sStyloEnabled;
/* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit; /* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
/* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod; /* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
@ -8279,6 +8280,8 @@ nsLayoutUtils::Initialize()
"svg.transform-box.enabled"); "svg.transform-box.enabled");
Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled, Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
"layout.css.text-combine-upright-digits.enabled"); "layout.css.text-combine-upright-digits.enabled");
sStyloEnabled = true;
Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit, Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
"layout.idle_period.time_limit", "layout.idle_period.time_limit",
DEFAULT_IDLE_PERIOD_TIME_LIMIT); DEFAULT_IDLE_PERIOD_TIME_LIMIT);
@ -8310,6 +8313,20 @@ nsLayoutUtils::Shutdown()
nsStyleList::Shutdown(); nsStyleList::Shutdown();
} }
/* static */
bool
nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
{
return true;
}
/* static */
bool
nsLayoutUtils::StyloChromeEnabled()
{
return true;
}
/* static */ /* static */
void void
nsLayoutUtils::RegisterImageRequest(nsPresContext* aPresContext, nsLayoutUtils::RegisterImageRequest(nsPresContext* aPresContext,

Просмотреть файл

@ -2521,6 +2521,36 @@ public:
return sTextCombineUprightDigitsEnabled; 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() {
return true;
}
// Whether Stylo should be allowed to be enabled in this process.
static bool StyloSupportedInCurrentProcess() {
if (XRE_IsContentProcess()) {
return true;
}
if (XRE_IsParentProcess()) {
// If Stylo is enabled for chrome document, we use it in all
// parent processes, regardless of whether it's e10s parent.
if (StyloChromeEnabled()) {
return true;
}
// Otherwise we only use stylo on non-e10s parent.
return !XRE_IsE10sParentProcess();
}
// Stylo is not enabled for any other process.
MOZ_DIAGNOSTIC_ASSERT(false, "We should not be creating any document "
"in processes other than content and parent");
return false;
}
// Whether Stylo should be used on chrome documents.
static bool StyloChromeEnabled();
static uint32_t IdlePeriodDeadlineLimit() { static uint32_t IdlePeriodDeadlineLimit() {
return sIdlePeriodDeadlineLimit; return sIdlePeriodDeadlineLimit;
} }
@ -2549,6 +2579,11 @@ public:
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();
/**
* Return whether stylo should be used for a given document principal.
*/
static bool ShouldUseStylo(nsIPrincipal* aPrincipal);
/** /**
* Register an imgIRequest object with a refresh driver. * Register an imgIRequest object with a refresh driver.
* *
@ -3066,6 +3101,7 @@ private:
static bool sInterruptibleReflowEnabled; static bool sInterruptibleReflowEnabled;
static bool sSVGTransformBoxEnabled; static bool sSVGTransformBoxEnabled;
static bool sTextCombineUprightDigitsEnabled; static bool sTextCombineUprightDigitsEnabled;
static bool sStyloEnabled;
static uint32_t sIdlePeriodDeadlineLimit; static uint32_t sIdlePeriodDeadlineLimit;
static uint32_t sQuiescentFramesBeforeIdlePeriod; static uint32_t sQuiescentFramesBeforeIdlePeriod;

Просмотреть файл

@ -170,11 +170,24 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
rv = LoadAndRegisterSheetInternal(aSheetURI, aSheetType); rv = LoadAndRegisterSheetInternal(aSheetURI, aSheetType);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
// Success means that at least the Gecko sheet was loaded. It's possible
// that a Servo sheet was also loaded. In both cases, the new sheets are
// the last sheets in m{Gecko,Servo}Sheets[aSheetType]
bool servoSheetWasAdded = false;
servoSheetWasAdded = nsLayoutUtils::StyloSupportedInCurrentProcess();
// Hold on to a copy of the registered PresShells. // Hold on to a copy of the registered PresShells.
nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells); nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
for (nsIPresShell* presShell : toNotify) { for (nsIPresShell* presShell : toNotify) {
StyleSheet* sheet = Sheets(StyleBackendType::Servo)[aSheetType].LastElement(); if (presShell->StyleSet()) {
presShell->NotifyStyleSheetServiceSheetAdded(sheet, aSheetType); StyleBackendType backendType = presShell->StyleSet()->BackendType();
if (backendType == StyleBackendType::Gecko || servoSheetWasAdded) {
StyleSheet* sheet = Sheets(backendType)[aSheetType].LastElement();
presShell->NotifyStyleSheetServiceSheetAdded(sheet, aSheetType);
} else {
MOZ_ASSERT_UNREACHABLE("Servo pres shell, but stylo unsupported?");
}
}
} }
if (XRE_IsParentProcess()) { if (XRE_IsParentProcess()) {
@ -232,11 +245,14 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
} }
RefPtr<StyleSheet> servoSheet;
nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet); if (nsLayoutUtils::StyloSupportedInCurrentProcess()) {
NS_ENSURE_SUCCESS(rv, rv); RefPtr<StyleSheet> servoSheet;
MOZ_ASSERT(servoSheet); nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
mServoSheets[aSheetType].AppendElement(servoSheet); NS_ENSURE_SUCCESS(rv, rv);
MOZ_ASSERT(servoSheet);
mServoSheets[aSheetType].AppendElement(servoSheet);
}
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -85,10 +85,13 @@ PreloadedStyleSheet::Preload()
// fetching the URL again, but for the usage patterns of this API this is // fetching the URL again, but for the usage patterns of this API this is
// unlikely, and it doesn't seem worth trying to store the contents of the URL // unlikely, and it doesn't seem worth trying to store the contents of the URL
// and duplicating a bunch of css::Loader's logic. // and duplicating a bunch of css::Loader's logic.
auto type = nsLayoutUtils::StyloEnabled() ? StyleBackendType::Servo
: StyleBackendType::Gecko;
mLoaded = true; mLoaded = true;
StyleSheet* sheet; StyleSheet* sheet;
return GetSheet(StyleBackendType::Servo, &sheet); return GetSheet(type, &sheet);
} }
NS_IMPL_ISUPPORTS(PreloadedStyleSheet::StylesheetPreloadObserver, NS_IMPL_ISUPPORTS(PreloadedStyleSheet::StylesheetPreloadObserver,
@ -117,10 +120,17 @@ PreloadedStyleSheet::PreloadAsync(NotNull<dom::Promise*> aPromise)
{ {
MOZ_DIAGNOSTIC_ASSERT(!mLoaded); MOZ_DIAGNOSTIC_ASSERT(!mLoaded);
RefPtr<StyleSheet>& sheet = mServo; // As with the Preload() method, we can't be sure that the sheet will only be
// used with the backend that we're preloading it for now. If it's used with
// a different backend later, it will be synchronously loaded for that
// backend the first time it's used.
auto type = nsLayoutUtils::StyloEnabled() ? StyleBackendType::Servo
: StyleBackendType::Gecko;
RefPtr<css::Loader> loader = RefPtr<StyleSheet>& sheet =
new css::Loader(StyleBackendType::Servo, nullptr); type == StyleBackendType::Gecko ? mGecko : mServo;
RefPtr<css::Loader> loader = new css::Loader(type, nullptr);
RefPtr<StylesheetPreloadObserver> obs = RefPtr<StylesheetPreloadObserver> obs =
new StylesheetPreloadObserver(aPromise, this); new StylesheetPreloadObserver(aPromise, this);

Просмотреть файл

@ -2,7 +2,7 @@
args = [ args = [
"-x", "c++", "-std=c++14", "-fno-sized-deallocation", "-x", "c++", "-std=c++14", "-fno-sized-deallocation",
"-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1", "-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1",
"-DMOZILLA_INTERNAL_API", "-DRUST_BINDGEN" "-DMOZILLA_INTERNAL_API", "-DRUST_BINDGEN", "-DMOZ_STYLO"
] ]
"family=unix" = ["-DOS_POSIX=1"] "family=unix" = ["-DOS_POSIX=1"]
"os=solaris" = ["-DOS_SOLARIS=1"] "os=solaris" = ["-DOS_SOLARIS=1"]

Просмотреть файл

@ -482,8 +482,21 @@ let retainedDisplayListsEnabled = prefs.getBoolPref("layout.display-list.retain"
sandbox.retainedDisplayLists = retainedDisplayListsEnabled && !g.compareRetainedDisplayLists; sandbox.retainedDisplayLists = retainedDisplayListsEnabled && !g.compareRetainedDisplayLists;
sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists; sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists;
// TODO(emilio): Remove the remaining reftest expectations that mention stylo. #ifdef MOZ_STYLO
sandbox.stylo = true; let styloEnabled = false;
// Perhaps a bit redundant in places, but this is easier to compare with the
// the real check in `nsLayoutUtils.cpp` to ensure they test the same way.
if (env.get("STYLO_FORCE_ENABLED")) {
styloEnabled = true;
} else if (env.get("STYLO_FORCE_DISABLED")) {
styloEnabled = false;
} else {
styloEnabled = prefs.getBoolPref("layout.css.servo.enabled", false);
}
sandbox.stylo = styloEnabled;
#else
sandbox.stylo = false;
#endif
sandbox.skiaPdf = false; sandbox.skiaPdf = false;

Просмотреть файл

@ -97,5 +97,11 @@ load 583957-1.html
load 617089.html load 617089.html
load menulist-focused.xhtml load menulist-focused.xhtml
load 716503.html load 716503.html
load 1379332-1.xul
load 1379332-2.xul # Bug 1379332's tests need stylo to be disabled in order for the
# 'visiblity:collapse' to take effect (which is needed to trigger the assertion
# that these tests are screening for, in unpatched builds). (Also, we skip
# these tests on Android, because otherwise we trigger bug 1350948 when trying
# to force the servo pref to false on that platform.)
skip-if(Android) pref(layout.css.servo.enabled,false) load 1379332-1.xul
skip-if(Android) pref(layout.css.servo.enabled,false) load 1379332-2.xul

Просмотреть файл

@ -5918,6 +5918,21 @@ pref("dom.webkitBlink.filesystem.enabled", true);
pref("media.block-autoplay-until-in-foreground", true); pref("media.block-autoplay-until-in-foreground", true);
// Is Stylo CSS support built and enabled?
// Only define these prefs if Stylo support is actually built in.
#ifdef MOZ_STYLO
#ifdef MOZ_STYLO_ENABLE
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.
pref("layout.css.servo.chrome.enabled", true);
#endif
// TODO: Bug 1324406: Treat 'data:' documents as unique, opaque origins // TODO: Bug 1324406: Treat 'data:' documents as unique, opaque origins
// If true, data: URIs will be treated as unique opaque origins, hence will use // If true, data: URIs will be treated as unique opaque origins, hence will use
// a NullPrincipal as the security context. // a NullPrincipal as the security context.

Просмотреть файл

@ -83,8 +83,7 @@ def build_dict(config, env=os.environ):
d['datareporting'] = bool(substs.get('MOZ_DATA_REPORTING')) d['datareporting'] = bool(substs.get('MOZ_DATA_REPORTING'))
d['healthreport'] = substs.get('MOZ_SERVICES_HEALTHREPORT') == '1' d['healthreport'] = substs.get('MOZ_SERVICES_HEALTHREPORT') == '1'
d['sync'] = substs.get('MOZ_SERVICES_SYNC') == '1' d['sync'] = substs.get('MOZ_SERVICES_SYNC') == '1'
# FIXME(emilio): We need to update a lot of WPT expectations before removing this. d['stylo'] = substs.get('MOZ_STYLO_ENABLE') == '1'
d['stylo'] = True
d['asan'] = substs.get('MOZ_ASAN') == '1' d['asan'] = substs.get('MOZ_ASAN') == '1'
d['tsan'] = substs.get('MOZ_TSAN') == '1' d['tsan'] = substs.get('MOZ_TSAN') == '1'
d['ubsan'] = substs.get('MOZ_UBSAN') == '1' d['ubsan'] = substs.get('MOZ_UBSAN') == '1'

Просмотреть файл

@ -69,6 +69,9 @@ class MachCommands(MachCommandBase):
else: else:
os.environ['STYLO_THREADS'] = '4' os.environ['STYLO_THREADS'] = '4'
if 'enable_stylo' in kwargs and kwargs['enable_stylo']:
os.environ['STYLO_FORCE_ENABLED'] = '1'
if 'enable_webrender' in kwargs and kwargs['enable_webrender']: if 'enable_webrender' in kwargs and kwargs['enable_webrender']:
os.environ['MOZ_WEBRENDER'] = '1' os.environ['MOZ_WEBRENDER'] = '1'
os.environ['MOZ_ACCELERATED'] = '1' os.environ['MOZ_ACCELERATED'] = '1'
@ -202,6 +205,9 @@ class MachCommands(MachCommandBase):
dest='settleWaitTime', dest='settleWaitTime',
help='Seconds to wait for things to settled down. ' help='Seconds to wait for things to settled down. '
'Defaults to %s.' % SETTLE_WAIT_TIME) 'Defaults to %s.' % SETTLE_WAIT_TIME)
@CommandArgument('--enable-stylo', group='AWSY', action='store_true',
dest='enable_stylo', default=False,
help='Enable Stylo.')
@CommandArgument('--single-stylo-traversal', group='AWSY', action='store_true', @CommandArgument('--single-stylo-traversal', group='AWSY', action='store_true',
dest='single_stylo_traversal', default=False, dest='single_stylo_traversal', default=False,
help='Set STYLO_THREADS=1.') help='Set STYLO_THREADS=1.')

Просмотреть файл

@ -163,6 +163,12 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
"default": False, "default": False,
"help": "Forcibly enable single thread traversal in Stylo with STYLO_THREADS=1"} "help": "Forcibly enable single thread traversal in Stylo with STYLO_THREADS=1"}
], ],
[["--enable-stylo"], {
"action": "store_true",
"dest": "enable_stylo",
"default": False,
"help": "Run tests with Stylo enabled"}
],
[["--enable-webrender"], { [["--enable-webrender"], {
"action": "store_true", "action": "store_true",
"dest": "enable_webrender", "dest": "enable_webrender",

Просмотреть файл

@ -88,6 +88,18 @@ class WebPlatformTest(TestingMixin, MercurialScript, BlobUploadMixin, CodeCovera
"default": False, "default": False,
"help": "Forcibly enable single thread traversal in Stylo with STYLO_THREADS=1"} "help": "Forcibly enable single thread traversal in Stylo with STYLO_THREADS=1"}
], ],
[["--enable-stylo"], {
"action": "store_true",
"dest": "enable_stylo",
"default": False,
"help": "Run tests with Stylo enabled"}
],
[["--disable-stylo"], {
"action": "store_true",
"dest": "disable_stylo",
"default": False,
"help": "Run tests with Stylo disabled"}
],
] + copy.deepcopy(testing_config_options) + \ ] + copy.deepcopy(testing_config_options) + \
copy.deepcopy(blobupload_config_options) + \ copy.deepcopy(blobupload_config_options) + \
copy.deepcopy(code_coverage_config_options) copy.deepcopy(code_coverage_config_options)
@ -310,11 +322,20 @@ class WebPlatformTest(TestingMixin, MercurialScript, BlobUploadMixin, CodeCovera
env['MOZ_HEADLESS_WIDTH'] = self.config['headless_width'] env['MOZ_HEADLESS_WIDTH'] = self.config['headless_width']
env['MOZ_HEADLESS_HEIGHT'] = self.config['headless_height'] env['MOZ_HEADLESS_HEIGHT'] = self.config['headless_height']
if self.config['disable_stylo']:
if self.config['single_stylo_traversal']:
self.fatal("--disable-stylo conflicts with --single-stylo-traversal")
if self.config['enable_stylo']:
self.fatal("--disable-stylo conflicts with --enable-stylo")
if self.config['single_stylo_traversal']: if self.config['single_stylo_traversal']:
env['STYLO_THREADS'] = '1' env['STYLO_THREADS'] = '1'
else: else:
env['STYLO_THREADS'] = '4' env['STYLO_THREADS'] = '4'
if self.config['enable_stylo']:
env['STYLO_FORCE_ENABLED'] = '1'
env = self.query_env(partial_env=env, log_level=INFO) env = self.query_env(partial_env=env, log_level=INFO)
start_time = datetime.now() start_time = datetime.now()

Просмотреть файл

@ -245,6 +245,7 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["layers.prefer-d3d9", {what: RECORD_PREF_VALUE}], ["layers.prefer-d3d9", {what: RECORD_PREF_VALUE}],
["layers.prefer-opengl", {what: RECORD_PREF_VALUE}], ["layers.prefer-opengl", {what: RECORD_PREF_VALUE}],
["layout.css.devPixelsPerPx", {what: RECORD_PREF_VALUE}], ["layout.css.devPixelsPerPx", {what: RECORD_PREF_VALUE}],
["layout.css.servo.enabled", {what: RECORD_PREF_VALUE}],
["marionette.enabled", {what: RECORD_PREF_VALUE}], ["marionette.enabled", {what: RECORD_PREF_VALUE}],
["network.proxy.autoconfig_url", {what: RECORD_PREF_STATE}], ["network.proxy.autoconfig_url", {what: RECORD_PREF_STATE}],
["network.proxy.http", {what: RECORD_PREF_STATE}], ["network.proxy.http", {what: RECORD_PREF_STATE}],

Просмотреть файл

@ -4,10 +4,15 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
gkrust_features = ['servo', 'bindgen'] gkrust_features = []
if CONFIG['MOZ_STYLO']:
gkrust_features += ['servo']
if CONFIG['MOZ_DEBUG']: if CONFIG['MOZ_STYLO_BINDGEN']:
gkrust_features += ['gecko_debug'] gkrust_features += ['bindgen']
if CONFIG['MOZ_DEBUG']:
gkrust_features += ['gecko_debug']
if CONFIG['MOZ_BUILD_WEBRENDER']: if CONFIG['MOZ_BUILD_WEBRENDER']:
gkrust_features += ['quantum_render'] gkrust_features += ['quantum_render']

Просмотреть файл

@ -333,4 +333,12 @@ this.AppConstants = Object.freeze({
#else #else
false, false,
#endif #endif
MOZ_STYLO:
#ifdef MOZ_STYLO
true,
#else
false,
#endif
}); });

Просмотреть файл

@ -16,6 +16,9 @@ try {
} catch (e) { } catch (e) {
} }
const env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
// We use a preferences whitelist to make sure we only show preferences that // We use a preferences whitelist to make sure we only show preferences that
// are useful for support and won't compromise the user's privacy. Note that // are useful for support and won't compromise the user's privacy. Note that
// entries are *prefixes*: for example, "accessibility." applies to all prefs // entries are *prefixes*: for example, "accessibility." applies to all prefs
@ -64,6 +67,7 @@ const PREFS_WHITELIST = [
"keyword.", "keyword.",
"layers.", "layers.",
"layout.css.dpi", "layout.css.dpi",
"layout.css.servo.",
"layout.display-list.", "layout.display-list.",
"media.", "media.",
"mousewheel.", "mousewheel.",
@ -220,6 +224,33 @@ var dataProviders = {
data.autoStartStatus = -1; data.autoStartStatus = -1;
} }
data.styloBuild = AppConstants.MOZ_STYLO;
data.styloDefault = Services.prefs.getDefaultBranch(null)
.getBoolPref("layout.css.servo.enabled", false);
data.styloResult = false;
// Perhaps a bit redundant in places, but this is easier to compare with the
// the real check in `nsLayoutUtils.cpp` to ensure they test the same way.
if (AppConstants.MOZ_STYLO) {
if (env.get("STYLO_FORCE_ENABLED")) {
data.styloResult = true;
} else if (env.get("STYLO_FORCE_DISABLED")) {
data.styloResult = false;
} else {
data.styloResult =
Services.prefs.getBoolPref("layout.css.servo.enabled", false);
}
}
data.styloChromeDefault =
Services.prefs.getDefaultBranch(null)
.getBoolPref("layout.css.servo.chrome.enabled", false);
data.styloChromeResult = false;
if (data.styloResult) {
let winUtils = Services.wm.getMostRecentWindow("").
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
data.styloChromeResult = winUtils.isStyledByServo;
}
if (Services.policies) { if (Services.policies) {
data.policiesStatus = Services.policies.status; data.policiesStatus = Services.policies.status;
} }

Просмотреть файл

@ -144,6 +144,21 @@ const SNAPSHOT_SCHEMA = {
maxContentProcesses: { maxContentProcesses: {
type: "number", type: "number",
}, },
styloBuild: {
type: "boolean",
},
styloDefault: {
type: "boolean",
},
styloResult: {
type: "boolean",
},
styloChromeDefault: {
type: "boolean",
},
styloChromeResult: {
type: "boolean",
},
policiesStatus: { policiesStatus: {
type: "number", type: "number",
}, },

Просмотреть файл

@ -550,6 +550,47 @@ id_and_secret_keyfile('Leanplum SDK')
simple_keyfile('Pocket API') simple_keyfile('Pocket API')
# Servo integration
# ==============================================================
option('--enable-stylo', nargs='?', choices=('build',),
help='Include Stylo in the build. "build" means to disable Stylo at ' +
'runtime.')
@depends('--enable-stylo', '--help')
def stylo_config(value, _):
# If nothing is specified, default to building and enabling Stylo,
# and not building the old style system.
build_stylo = True
enable_stylo = True
old_style = None
if len(value) and value[0] == 'build':
# Build but disable by request.
enable_stylo = None
old_style = True
elif value.origin != 'default' and not bool(value):
# Disable stylo entirely.
old_style = True
build_stylo = None
enable_stylo = None
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('--enable-stylo-build-bindgen', '--enable-compile-environment')
def building_stylo_bindgen(bindgen_enabled, compile_environment):
if not compile_environment:
return False
if not bindgen_enabled:
return False
return True
# We support setting up the appropriate options for Stylo's build-time # We support setting up the appropriate options for Stylo's build-time
# bindings generation via setting LLVM_CONFIG or by providing explicit # bindings generation via setting LLVM_CONFIG or by providing explicit
# configure options. The Windows installer of LLVM/Clang doesn't provide # configure options. The Windows installer of LLVM/Clang doesn't provide
@ -599,151 +640,161 @@ def llvm_config_paths(host):
return llvm_config_progs return llvm_config_progs
llvm_config = check_prog('LLVM_CONFIG', llvm_config_paths, llvm_config = check_prog('LLVM_CONFIG', llvm_config_paths,
when=building_stylo_bindgen,
what='llvm-config', allow_missing=True) what='llvm-config', allow_missing=True)
option('--with-libclang-path', nargs=1, with only_when(building_stylo_bindgen):
help='Absolute path to a directory containing Clang/LLVM libraries for Stylo (version 3.9.x or above)') option('--with-libclang-path', nargs=1,
option('--with-clang-path', nargs=1, help='Absolute path to a directory containing Clang/LLVM libraries for Stylo (version 3.9.x or above)')
help='Absolute path to a Clang binary for Stylo bindgen (version 3.9.x or above)') option('--with-clang-path', nargs=1,
help='Absolute path to a Clang binary for Stylo bindgen (version 3.9.x or above)')
def invoke_llvm_config(llvm_config, *options): def invoke_llvm_config(llvm_config, *options):
'''Invoke llvm_config with the given options and return the first line of '''Invoke llvm_config with the given options and return the first line of
output.''' output.'''
lines = check_cmd_output(llvm_config, *options).splitlines() lines = check_cmd_output(llvm_config, *options).splitlines()
return lines[0] return lines[0]
@imports(_from='textwrap', _import='dedent') @imports(_from='textwrap', _import='dedent')
def check_minimum_llvm_config_version(llvm_config): def check_minimum_llvm_config_version(llvm_config):
version = Version(invoke_llvm_config(llvm_config, '--version')) version = Version(invoke_llvm_config(llvm_config, '--version'))
min_version = Version('3.9.0') min_version = Version('3.9.0')
if version < min_version: if version < min_version:
die(dedent('''\
llvm installation {} is incompatible with Stylo bindgen.
To compile Stylo, please install version {} or greater of
Clang + LLVM and ensure that the 'llvm-config' from that
installation is first on your path.
You can verify this by typing 'llvm-config --version'.
'''.format(version, min_version)))
@depends(llvm_config, '--with-libclang-path', '--with-clang-path',
host_library_name_info, host)
@imports('os.path')
@imports('glob')
@imports(_from='textwrap', _import='dedent')
def bindgen_config_paths(llvm_config, libclang_path, clang_path,
library_name_info, host):
def search_for_libclang(path):
# Try to ensure that the clang shared library that bindgen is going
# to look for is actually present. The files that we search for
# mirror the logic in clang-sys/build.rs.
libclang_choices = []
if host.os == 'WINNT':
libclang_choices.append('libclang.dll')
libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix,
library_name_info.dll.suffix))
if host.kernel == 'Linux':
libclang_choices.append('libclang.so.1')
if host.os == 'OpenBSD':
libclang_choices = glob.glob(path + '/libclang.so.*.*')
# At least one of the choices must be found.
for choice in libclang_choices:
libclang = os.path.join(path, choice)
if os.path.exists(libclang):
return (True, None)
else:
return (False, list(set(libclang_choices)))
if not libclang_path and not clang_path:
# We must have LLVM_CONFIG in this case.
if not llvm_config:
die(dedent('''\ die(dedent('''\
Could not find LLVM/Clang installation for compiling stylo build-time llvm installation {} is incompatible with Stylo bindgen.
bindgen. Please specify the 'LLVM_CONFIG' environment variable
(recommended), pass the '--with-libclang-path' and '--with-clang-path'
options to configure, or put 'llvm-config' in your PATH. Altering your
PATH may expose 'clang' as well, potentially altering your compiler,
which may not be what you intended.'''))
check_minimum_llvm_config_version(llvm_config) To compile Stylo, please install version {} or greater of
libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir' Clang + LLVM and ensure that the 'llvm-config' from that
libclang_path = invoke_llvm_config(llvm_config, libclang_arg) installation is first on your path.
clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'),
'clang')
libclang_path = normsep(libclang_path)
clang_path = normsep(clang_path)
# Debian-based distros, at least, can have llvm-config installed You can verify this by typing 'llvm-config --version'.
# but not have other packages installed. Since the user is trying '''.format(version, min_version)))
# to use their system packages, we can't be more specific about what
# they need. @depends(llvm_config, '--with-libclang-path', '--with-clang-path',
clang_resolved = find_program(clang_path) host_library_name_info, host)
if not clang_resolved: @imports('os.path')
@imports('glob')
@imports(_from='textwrap', _import='dedent')
def bindgen_config_paths(llvm_config, libclang_path, clang_path,
library_name_info, host):
def search_for_libclang(path):
# Try to ensure that the clang shared library that bindgen is going
# to look for is actually present. The files that we search for
# mirror the logic in clang-sys/build.rs.
libclang_choices = []
if host.os == 'WINNT':
libclang_choices.append('libclang.dll')
libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix,
library_name_info.dll.suffix))
if host.kernel == 'Linux':
libclang_choices.append('libclang.so.1')
if host.os == 'OpenBSD':
libclang_choices = glob.glob(path + '/libclang.so.*.*')
# At least one of the choices must be found.
for choice in libclang_choices:
libclang = os.path.join(path, choice)
if os.path.exists(libclang):
return (True, None)
else:
return (False, list(set(libclang_choices)))
if not libclang_path and not clang_path:
# We must have LLVM_CONFIG in this case.
if not llvm_config:
die(dedent('''\
Could not find LLVM/Clang installation for compiling stylo build-time
bindgen. Please specify the 'LLVM_CONFIG' environment variable
(recommended), pass the '--with-libclang-path' and '--with-clang-path'
options to configure, or put 'llvm-config' in your PATH. Altering your
PATH may expose 'clang' as well, potentially altering your compiler,
which may not be what you intended.'''))
check_minimum_llvm_config_version(llvm_config)
libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir'
libclang_path = invoke_llvm_config(llvm_config, libclang_arg)
clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'),
'clang')
libclang_path = normsep(libclang_path)
clang_path = normsep(clang_path)
# Debian-based distros, at least, can have llvm-config installed
# but not have other packages installed. Since the user is trying
# to use their system packages, we can't be more specific about what
# they need.
clang_resolved = find_program(clang_path)
if not clang_resolved:
die(dedent('''\
The file {} returned by `llvm-config {}` does not exist.
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(clang_path, '--bindir')))
if not os.path.exists(libclang_path):
die(dedent('''\
The directory {} returned by `llvm-config {}` does not exist.
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(libclang_path, libclang_arg)))
(found, searched) = search_for_libclang(libclang_path)
if not found:
die(dedent('''\
Could not find the clang shared library in the path {}
returned by `llvm-config {}` (searched for files {}).
clang is required to build Stylo. Please install the necessary packages,
run `mach bootstrap`, or add --disable-stylo to your mozconfig.
'''.format(libclang_path, libclang_arg, searched)))
return namespace(
libclang_path=libclang_path,
clang_path=clang_resolved,
)
if (not libclang_path and clang_path) or \
(libclang_path and not clang_path):
die(dedent('''\ die(dedent('''\
The file {} returned by `llvm-config {}` does not exist. You must provide both of --with-libclang-path and --with-clang-path
clang is required to build Firefox. Please install the necessary or neither of them.'''))
packages, or run `mach bootstrap`.
'''.format(clang_path, '--bindir')))
if not os.path.exists(libclang_path): libclang_path = libclang_path[0]
clang_path = clang_path[0]
if not os.path.exists(libclang_path) or \
not os.path.isdir(libclang_path):
die(dedent('''\ die(dedent('''\
The directory {} returned by `llvm-config {}` does not exist. The argument to --with-libclang-path is not a directory: {}
clang is required to build Firefox. Please install the necessary '''.format(libclang_path)))
packages, or run `mach bootstrap`.
'''.format(libclang_path, libclang_arg)))
(found, searched) = search_for_libclang(libclang_path) (found, searched) = search_for_libclang(libclang_path)
if not found: if not found:
die(dedent('''\ die(dedent('''\
Could not find the clang shared library in the path {} Could not find the clang shared library in the path {}
returned by `llvm-config {}` (searched for files {}). specified by --with-libclang-path (searched for files {}).
clang is required to build Firefox. Please install the necessary '''.format(libclang_path, searched)))
packages, or run `mach bootstrap`.
'''.format(libclang_path, libclang_arg, searched))) clang_resolved = find_program(clang_path)
if not clang_resolved:
die(dedent('''\
The argument to --with-clang-path is not a file: {}
'''.format(clang_path)))
return namespace( return namespace(
libclang_path=libclang_path, libclang_path=libclang_path,
clang_path=clang_resolved, clang_path=clang_resolved,
) )
if (not libclang_path and clang_path) or \ set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
(libclang_path and not clang_path): set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
die(dedent('''\ set_config('MOZ_STYLO_BINDGEN', depends_if('--enable-stylo-build-bindgen')(lambda _: True))
You must provide both of --with-libclang-path and --with-clang-path
or neither of them.'''))
libclang_path = libclang_path[0] set_config('MOZ_STYLO', stylo_config.build)
clang_path = clang_path[0] set_define('MOZ_STYLO', stylo_config.build)
set_config('MOZ_STYLO_ENABLE', stylo_config.enable)
if not os.path.exists(libclang_path) or \ set_define('MOZ_STYLO_ENABLE', stylo_config.enable)
not os.path.isdir(libclang_path): set_config('MOZ_OLD_STYLE', stylo_config.old_style)
die(dedent('''\ set_define('MOZ_OLD_STYLE', stylo_config.old_style)
The argument to --with-libclang-path is not a directory: {}
'''.format(libclang_path)))
(found, searched) = search_for_libclang(libclang_path)
if not found:
die(dedent('''\
Could not find the clang shared library in the path {}
specified by --with-libclang-path (searched for files {}).
'''.format(libclang_path, searched)))
clang_resolved = find_program(clang_path)
if not clang_resolved:
die(dedent('''\
The argument to --with-clang-path is not a file: {}
'''.format(clang_path)))
return namespace(
libclang_path=libclang_path,
clang_path=clang_resolved,
)
set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
option('--with-servo', env='SERVO_TARGET_DIR', nargs=1, option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
help='Absolute path of the target directory where libgeckoservo can ' help='Absolute path of the target directory where libgeckoservo can '

Просмотреть файл

@ -91,11 +91,13 @@ ifdef MOZ_ASAN
$(PYTHON) $(MOZILLA_DIR)/build/unix/rewrite_asan_dylib.py $(DIST)/$(MOZ_PKG_DIR)$(_BINPATH) $(PYTHON) $(MOZILLA_DIR)/build/unix/rewrite_asan_dylib.py $(DIST)/$(MOZ_PKG_DIR)$(_BINPATH)
endif # MOZ_ASAN endif # MOZ_ASAN
endif # Darwin endif # Darwin
ifdef MOZ_STYLO
ifndef MOZ_ARTIFACT_BUILDS ifndef MOZ_ARTIFACT_BUILDS
@echo 'Packing stylo binding files...' @echo 'Packing stylo binding files...'
cd '$(DIST)/rust_bindings/style' && \ cd '$(DIST)/rust_bindings/style' && \
zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(STYLO_BINDINGS_PACKAGE)' . zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(STYLO_BINDINGS_PACKAGE)' .
endif # MOZ_ARTIFACT_BUILDS endif # MOZ_ARTIFACT_BUILDS
endif # MOZ_STYLO
prepare-package: stage-package prepare-package: stage-package

Просмотреть файл

@ -407,7 +407,6 @@ UPLOAD_FILES= \
$(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup.exe) \ $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup.exe) \
$(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup-stub.exe) \ $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup-stub.exe) \
$(call QUOTED_WILDCARD,$(topsrcdir)/toolchains.json) \ $(call QUOTED_WILDCARD,$(topsrcdir)/toolchains.json) \
$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(STYLO_BINDINGS_PACKAGE)) \
$(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f)))) $(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
ifneq ($(filter-out en-US x-test,$(AB_CD)),) ifneq ($(filter-out en-US x-test,$(AB_CD)),)
@ -424,6 +423,9 @@ ifdef MOZ_CODE_COVERAGE
$(NULL) $(NULL)
endif endif
ifdef MOZ_STYLO
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(STYLO_BINDINGS_PACKAGE))
endif
ifdef ENABLE_MOZSEARCH_PLUGIN ifdef ENABLE_MOZSEARCH_PLUGIN
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip) UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip)