mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1406274 - Re-enable stylo in about:reader. r=xidorn
Remove the about:reader check for <style scoped>, too, since that is no longer needed. MozReview-Commit-ID: Zomjn1WDvp --HG-- extra : rebase_source : f5c82ef6c35b72079b37c35adc9137ad9f610946
This commit is contained in:
parent
9a100cb5c1
commit
4805d2cde9
@ -13238,7 +13238,7 @@ nsIDocument::UpdateStyleBackendType()
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (nsLayoutUtils::StyloEnabled() &&
|
||||
nsLayoutUtils::ShouldUseStylo(mDocumentURI, NodePrincipal())) {
|
||||
nsLayoutUtils::ShouldUseStylo(NodePrincipal())) {
|
||||
mStyleBackendType = StyleBackendType::Servo;
|
||||
}
|
||||
#endif
|
||||
@ -13902,30 +13902,11 @@ nsDocument::IsThirdParty()
|
||||
return mIsThirdParty.value();
|
||||
}
|
||||
|
||||
static bool
|
||||
IsAboutReader(nsIURI* aURI)
|
||||
{
|
||||
if (!aURI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
|
||||
// Reader mode URLs look like about:reader?[...].
|
||||
return StringBeginsWith(spec, NS_LITERAL_CSTRING("about:reader"));
|
||||
}
|
||||
|
||||
bool
|
||||
nsIDocument::IsScopedStyleEnabled()
|
||||
{
|
||||
if (mIsScopedStyleEnabled == eScopedStyle_Unknown) {
|
||||
// We allow <style scoped> in about:reader pages since on Android
|
||||
// we use it to inject some in-page UI. (We currently don't
|
||||
// support styling about:reader pages in stylo anyway, so for
|
||||
// now it's OK to enable it here.)
|
||||
mIsScopedStyleEnabled = nsContentUtils::IsChromeDoc(this) ||
|
||||
IsAboutReader(mDocumentURI) ||
|
||||
nsContentUtils::IsScopedStylePrefEnabled()
|
||||
? eScopedStyle_Enabled
|
||||
: eScopedStyle_Disabled;
|
||||
|
@ -2339,7 +2339,7 @@ nsXULPrototypeElement::SetAttrAt(uint32_t aPos, const nsAString& aValue,
|
||||
|
||||
RefPtr<DeclarationBlock> declaration;
|
||||
if (nsLayoutUtils::StyloEnabled() &&
|
||||
nsLayoutUtils::ShouldUseStylo(aDocumentURI, principal)) {
|
||||
nsLayoutUtils::ShouldUseStylo(principal)) {
|
||||
RefPtr<URLExtraData> data =
|
||||
new URLExtraData(aDocumentURI, aDocumentURI, principal);
|
||||
declaration = ServoDeclarationBlock::FromCssText(
|
||||
|
@ -8290,7 +8290,7 @@ nsLayoutUtils::Shutdown()
|
||||
#ifdef MOZ_STYLO
|
||||
/* static */
|
||||
bool
|
||||
nsLayoutUtils::ShouldUseStylo(nsIURI* aDocumentURI, nsIPrincipal* aPrincipal)
|
||||
nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
// Disable stylo for system principal because XUL hasn't been fully
|
||||
// supported. Other principal aren't able to use XUL by default, and
|
||||
@ -8300,20 +8300,6 @@ nsLayoutUtils::ShouldUseStylo(nsIURI* aDocumentURI, nsIPrincipal* aPrincipal)
|
||||
nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
return false;
|
||||
}
|
||||
// Check any internal page which we need to explicitly blacklist.
|
||||
if (aDocumentURI) {
|
||||
bool isAbout = false;
|
||||
if (NS_SUCCEEDED(aDocumentURI->SchemeIs("about", &isAbout)) && isAbout) {
|
||||
nsAutoCString path;
|
||||
aDocumentURI->GetFilePath(path);
|
||||
// about:reader requires support of scoped style, so we have to
|
||||
// use Gecko backend for now. See bug 1402094.
|
||||
// This should be fixed by bug 1204818.
|
||||
if (path.EqualsLiteral("reader")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check the stylo block list.
|
||||
if (IsInStyloBlocklist(aPrincipal)) {
|
||||
return false;
|
||||
|
@ -2582,10 +2582,9 @@ public:
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
/**
|
||||
* Return whether stylo should be used for a given document URI and
|
||||
* principal.
|
||||
* Return whether stylo should be used for a given document principal.
|
||||
*/
|
||||
static bool ShouldUseStylo(nsIURI* aDocumentURI, nsIPrincipal* aPrincipal);
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal);
|
||||
|
||||
/**
|
||||
* Principal-based blocklist for stylo.
|
||||
@ -2610,7 +2609,7 @@ public:
|
||||
*/
|
||||
static void RemoveFromStyloBlocklist(const nsACString& aBlockedDomain);
|
||||
#else
|
||||
static bool ShouldUseStylo(nsIURI* aDocumentURI, nsIPrincipal* aPrincipal) {
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user