Skip to content

Commit

Permalink
Bug 1400540 - Decide style backend type based on principal. r=bholley
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: A4y9Shdbr7g

--HG--
extra : source : cdfe5e5e059273a1c7fc6506d6e0fecb2bb7affb
  • Loading branch information
upsuper committed Sep 19, 2017
1 parent 5f2728b commit 6905267
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13465,20 +13465,15 @@ nsIDocument::UpdateStyleBackendType()

#ifdef MOZ_STYLO
if (nsLayoutUtils::StyloEnabled()) {
if (IsBeingUsedAsImage()) {
// Enable stylo for SVG-as-image.
// Disable stylo only for system principal. Other principals aren't
// able to use XUL by default, and the back door to enable XUL is
// mostly just for testing, which means they don't matter, and we
// shouldn't respect them at the same time.
// Note that, since tests can have XUL support, we still need to
// explicitly exclude XUL documents here.
if (!nsContentUtils::IsSystemPrincipal(NodePrincipal()) &&
!IsXULDocument()) {
mStyleBackendType = StyleBackendType::Servo;
} else if (!mDocumentContainer) {
// Not docshell, assume Gecko. Various callers can end up setting this
// explicitly afterwards to inherit it in various situations.
} else if (!IsXULDocument() && IsContentDocument()) {
// Disable stylo for about: pages other than about:blank, since
// they tend to use unsupported selectors like XUL tree pseudos.
bool isAbout = false;
mDocumentURI->SchemeIs("about", &isAbout);
if (!isAbout || NS_IsAboutBlank(mDocumentURI)) {
mStyleBackendType = StyleBackendType::Servo;
}
}
}
#endif
Expand Down

0 comments on commit 6905267

Please sign in to comment.