Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-07-18 22:32:59 +08:00
commit a57b7e6ca4
21 changed files with 546 additions and 25 deletions

View file

@ -2802,20 +2802,9 @@ nsDocument::GetPrincipal()
return NodePrincipal();
}
extern bool sDisablePrefetchHTTPSPref;
void
nsDocument::SetPrincipal(nsIPrincipal *aNewPrincipal)
{
if (aNewPrincipal && mAllowDNSPrefetch && sDisablePrefetchHTTPSPref) {
nsCOMPtr<nsIURI> uri;
aNewPrincipal->GetURI(getter_AddRefs(uri));
bool isHTTPS;
if (!uri || NS_FAILED(uri->SchemeIs("https", &isHTTPS)) ||
isHTTPS) {
mAllowDNSPrefetch = false;
}
}
mNodeInfoManager->SetDocumentPrincipal(aNewPrincipal);
#ifdef DEBUG

View file

@ -237,6 +237,16 @@ DOMInterfaces = {
'headerFile': 'nsCSSRules.h',
},
'CSSLayerBlockRule': {
'nativeType': 'mozilla::CSSLayerBlockRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLayerStatementRule': {
'nativeType': 'mozilla::CSSLayerStatementRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLexer': {
'wrapperCache': False
},

View file

@ -37,7 +37,6 @@ using namespace mozilla::dom;
using namespace mozilla::net;
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
bool sDisablePrefetchHTTPSPref;
static bool sInitialized = false;
static nsIDNSService *sDNSService = nullptr;
static nsHTMLDNSPrefetch::nsDeferrals *sPrefetches = nullptr;
@ -59,13 +58,6 @@ nsHTMLDNSPrefetch::Initialize()
sPrefetches->Activate();
Preferences::AddBoolVarCache(&sDisablePrefetchHTTPSPref,
"network.dns.disablePrefetchFromHTTPS");
// Default is false, so we need an explicit call to prime the cache.
sDisablePrefetchHTTPSPref =
Preferences::GetBool("network.dns.disablePrefetchFromHTTPS", true);
NS_IF_RELEASE(sDNSService);
nsresult rv;
rv = CallGetService(kDNSServiceCID, &sDNSService);

View file

@ -13,6 +13,8 @@ XPIDL_SOURCES += [
'nsIDOMCSSImportRule.idl',
'nsIDOMCSSKeyframeRule.idl',
'nsIDOMCSSKeyframesRule.idl',
'nsIDOMCSSLayerBlockRule.idl',
'nsIDOMCSSLayerStatementRule.idl',
'nsIDOMCSSMediaRule.idl',
'nsIDOMCSSMozDocumentRule.idl',
'nsIDOMCSSPageRule.idl',

View file

@ -14,4 +14,5 @@ interface nsIDOMCSSImportRule : nsISupports
readonly attribute DOMString href;
readonly attribute nsIDOMMediaList media;
readonly attribute nsIDOMCSSStyleSheet styleSheet;
readonly attribute DOMString layerName;
};

View file

@ -0,0 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsIDOMCSSGroupingRule.idl"
[scriptable, uuid(2865c2ba-ae78-4282-8eff-9b7a2d71f9eb)]
interface nsIDOMCSSLayerBlockRule : nsIDOMCSSGroupingRule
{
readonly attribute DOMString name;
};

View file

@ -0,0 +1,11 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsISupports.idl"
[scriptable, uuid(ec215b70-417e-41fa-8d48-8edd6d30aac3)]
interface nsIDOMCSSLayerStatementRule : nsISupports
{
};

View file

@ -44,6 +44,9 @@ interface nsIDOMCSSRule : nsISupports
const unsigned short COUNTER_STYLE_RULE = 11;
const unsigned short SUPPORTS_RULE = 12;
const unsigned short FONT_FEATURE_VALUES_RULE = 14;
const unsigned short RESERVED1_RULE = 15;
const unsigned short LAYER_BLOCK_RULE = 16;
const unsigned short LAYER_STATEMENT_RULE = 17;
readonly attribute unsigned short type;
attribute DOMString cssText;

View file

@ -15,3 +15,9 @@ interface CSSImportRule : CSSRule {
// be. See <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>.
[SameObject] readonly attribute CSSStyleSheet? styleSheet;
};
// https://drafts.csswg.org/css-cascade-5/#extensions-to-cssimportrule-interface
partial interface CSSImportRule {
[Pref="layout.css.cascade-layers.enabled"]
readonly attribute DOMString? layerName;
};

View file

@ -0,0 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-cascade-5/#the-csslayerblockrule-interface
*/
[Exposed=Window, Pref="layout.css.cascade-layers.enabled"]
interface CSSLayerBlockRule : CSSGroupingRule {
readonly attribute DOMString name;
};

View file

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-cascade-5/#the-csslayerstatementrule-interface
*/
[Exposed=Window, Pref="layout.css.cascade-layers.enabled"]
interface CSSLayerStatementRule : CSSRule {
// readonly attribute FrozenArray<CSSOMString> nameList;
[Frozen, Cached, Pure]
readonly attribute sequence<DOMString> nameList;
};

View file

@ -98,6 +98,8 @@ WEBIDL_FILES = [
'CSSImportRule.webidl',
'CSSKeyframeRule.webidl',
'CSSKeyframesRule.webidl',
'CSSLayerBlockRule.webidl',
'CSSLayerStatementRule.webidl',
'CSSLexer.webidl',
'CSSMediaRule.webidl',
'CSSMozDocumentRule.webidl',

View file

@ -18,6 +18,8 @@
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSSupportsRule.h"
#include "nsIDOMCSSLayerBlockRule.h"
#include "nsIDOMCSSLayerStatementRule.h"
#include "nsIDOMCSSRule.h"
#include "nsIURI.h"
#include "nsIDocument.h"
@ -322,6 +324,12 @@ inCSSValueSearch::SearchRuleList(nsIDOMCSSRuleList* aRuleList, nsIURI* aBaseURL)
supportsRule->GetCssRules(getter_AddRefs(childRules));
SearchRuleList(childRules, aBaseURL);
} break;
case nsIDOMCSSRule::LAYER_BLOCK_RULE: {
nsCOMPtr<nsIDOMCSSLayerBlockRule> layerBlockRule = do_QueryInterface(rule);
nsCOMPtr<nsIDOMCSSRuleList> childRules;
layerBlockRule->GetCssRules(getter_AddRefs(childRules));
SearchRuleList(childRules, aBaseURL);
} break;
default:
// XXX handle nsIDOMCSSRule::PAGE_RULE if we ever support it
break;

View file

@ -1896,6 +1896,8 @@ CSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
case css::Rule::COUNTER_STYLE_RULE:
case css::Rule::DOCUMENT_RULE:
case css::Rule::SUPPORTS_RULE:
case css::Rule::LAYER_BLOCK_RULE:
case css::Rule::LAYER_STATEMENT_RULE:
// these types are OK to insert into a group
break;
case css::Rule::CHARSET_RULE:

View file

@ -29,6 +29,7 @@ class ImportRule final : public Rule,
{
public:
ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
const nsString& aLayerName,
uint32_t aLineNumber, uint32_t aColumnNumber);
private:
// for |Clone|
@ -65,9 +66,11 @@ public:
// The XPCOM GetHref is fine, since it never fails.
nsMediaList* Media() const { return mMedia; }
StyleSheet* GetStyleSheet() const;
// The XPCOM GetLayerName is OK
private:
nsString mURLSpec;
nsString mLayerName;
RefPtr<nsMediaList> mMedia;
RefPtr<CSSStyleSheet> mChildSheet;
};

View file

@ -78,7 +78,10 @@ public:
DOCUMENT_RULE,
SUPPORTS_RULE,
FONT_FEATURE_VALUES_RULE,
COUNTER_STYLE_RULE
COUNTER_STYLE_RULE,
RESERVED1_RULE,
LAYER_BLOCK_RULE,
LAYER_STATEMENT_RULE
};
virtual int32_t GetType() const = 0;

View file

@ -68,6 +68,7 @@ static bool sWebkitDevicePixelRatioEnabled;
static bool sMozGradientsEnabled;
static bool sControlCharVisibility;
static bool sLegacyNegationPseudoClassEnabled;
static bool sCascadeLayersEnabled;
const uint32_t
nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
@ -705,6 +706,7 @@ protected:
bool ParseMediaQueryExpression(nsMediaQuery* aQuery);
void ProcessImport(const nsString& aURLSpec,
nsMediaList* aMedia,
const nsString& aLayerName,
RuleAppendFunc aAppendFunc,
void* aProcessData,
uint32_t aLineNumber,
@ -752,6 +754,8 @@ protected:
nsCSSValue& aValue);
bool ParseCounterRange(nsCSSValuePair& aPair);
bool ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData);
/**
* Parses the current input stream for a CSS token stream value and resolves
* any variable references using the variables in aVariables.
@ -3452,6 +3456,11 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
parseFunc = &CSSParserImpl::ParseSupportsRule;
newSection = eCSSSection_General;
} else if (mToken.mIdent.LowerCaseEqualsLiteral("layer") &&
sCascadeLayersEnabled) {
parseFunc = &CSSParserImpl::ParseLayerRule;
newSection = eCSSSection_General;
} else if (mToken.mIdent.LowerCaseEqualsLiteral("counter-style")) {
parseFunc = &CSSParserImpl::ParseCounterStyleRule;
newSection = eCSSSection_General;
@ -3885,19 +3894,24 @@ CSSParserImpl::ParseImportRule(RuleAppendFunc aAppendFunc, void* aData)
NS_ASSERTION(media->Length() != 0, "media list must be nonempty");
}
ProcessImport(url, media, aAppendFunc, aData, linenum, colnum);
// FIXME: Layer functions inside @import declarations are treated as an error.
nsAutoString layerName;
ProcessImport(url, media, layerName, aAppendFunc, aData, linenum, colnum);
return true;
}
void
CSSParserImpl::ProcessImport(const nsString& aURLSpec,
nsMediaList* aMedia,
const nsString& aLayerName,
RuleAppendFunc aAppendFunc,
void* aData,
uint32_t aLineNumber,
uint32_t aColumnNumber)
{
RefPtr<css::ImportRule> rule = new css::ImportRule(aMedia, aURLSpec,
aLayerName,
aLineNumber,
aColumnNumber);
(*aAppendFunc)(rule, aData);
@ -4929,6 +4943,113 @@ CSSParserImpl::ParseSupportsConditionTermsAfterOperator(
}
}
bool
CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
{
nsString layerName;
nsTArray<nsString>* nameList = new nsTArray<nsString>();
uint32_t linenum, colnum;
if (!GetNextTokenLocation(true, &linenum, &colnum)) {
return false;
}
nsCSSToken* tk = &mToken;
if (!GetToken(true)) {
return false;
}
// Parse the layer name or name list if we aren't immediately
// followed by a "{", which indicates an anonymous layer.
bool isStatement = false;
if (tk->mType == eCSSToken_Ident) {
nsString* currentName = new nsString();
currentName->Assign(tk->mIdent);
bool parsing = true;
bool expectIdent = false;
while (parsing) {
if (!GetToken(true)) {
return false;
}
switch (tk->mType) {
case eCSSToken_Symbol: {
if ('.' == tk->mSymbol) {
expectIdent = true;
if (!currentName->IsEmpty()) {
currentName->Append(tk->mSymbol);
continue;
}
parsing = false;
break;
} else if (',' == tk->mSymbol) {
if (expectIdent) {
parsing = false;
break;
}
nameList->AppendElement(*currentName);
currentName = new nsString();
expectIdent = true;
continue;
} else if (';' == tk->mSymbol) {
if (expectIdent) {
parsing = false;
break;
}
nameList->AppendElement(*currentName);
currentName = new nsString();
isStatement = true;
parsing = false;
break;
} else if ('{' == tk->mSymbol) {
if (expectIdent) {
parsing = false;
break;
}
nameList->AppendElement(*currentName);
uint32_t nameListLength = nameList->Length();
if (nameListLength == 0 || nameListLength > 1) {
return false;
}
layerName.Assign(nameList->ElementAt(0));
parsing = false;
break;
}
}
case eCSSToken_Ident: {
expectIdent = false;
currentName->Append(tk->mIdent);
break;
}
default: {
return false;
}
}
}
if (expectIdent) {
UngetToken();
return false;
}
} else if (tk->mType == eCSSToken_Symbol && '{' != tk->mSymbol) {
UngetToken();
return false;
}
if (isStatement) {
RefPtr<CSSLayerStatementRule> rule =
new CSSLayerStatementRule(*nameList, linenum, colnum);
(*aAppendFunc)(rule, aProcessData);
return true;
}
UngetToken();
RefPtr<css::GroupRule> rule =
new CSSLayerBlockRule(layerName, linenum, colnum);
return ParseGroupRule(rule, aAppendFunc, aProcessData);
}
bool
CSSParserImpl::ParseCounterStyleRule(RuleAppendFunc aAppendFunc, void* aData)
{
@ -18179,6 +18300,8 @@ nsCSSParser::Startup()
"layout.css.control-characters.visible");
Preferences::AddBoolVarCache(&sLegacyNegationPseudoClassEnabled,
"layout.css.legacy-negation-pseudo.enabled");
Preferences::AddBoolVarCache(&sCascadeLayersEnabled,
"layout.css.cascade-layers.enabled");
}
nsCSSParser::nsCSSParser(mozilla::css::Loader* aLoader,

View file

@ -3932,7 +3932,8 @@ GatherDocRuleEnumFunc(css::Rule* aRule, void* aData)
"mMustGatherDocumentRules is true");
if (css::Rule::MEDIA_RULE == type ||
css::Rule::SUPPORTS_RULE == type) {
css::Rule::SUPPORTS_RULE == type ||
css::Rule::LAYER_BLOCK_RULE == type) {
css::GroupRule* groupRule = static_cast<css::GroupRule*>(aRule);
if (!groupRule->EnumerateRulesForwards(GatherDocRuleEnumFunc, aData)) {
return false;
@ -4011,7 +4012,8 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData)
}
}
else if (css::Rule::MEDIA_RULE == type ||
css::Rule::SUPPORTS_RULE == type) {
css::Rule::SUPPORTS_RULE == type ||
css::Rule::LAYER_BLOCK_RULE == type) {
css::GroupRule* groupRule = static_cast<css::GroupRule*>(aRule);
const bool use =
groupRule->UseForPresentation(data->mPresContext, data->mCacheKey);

View file

@ -36,6 +36,8 @@
#include "mozilla/dom/CSSNamespaceRuleBinding.h"
#include "mozilla/dom/CSSImportRuleBinding.h"
#include "mozilla/dom/CSSMediaRuleBinding.h"
#include "mozilla/dom/CSSLayerBlockRuleBinding.h"
#include "mozilla/dom/CSSLayerStatementRuleBinding.h"
#include "mozilla/dom/CSSSupportsRuleBinding.h"
#include "mozilla/dom/CSSMozDocumentRuleBinding.h"
#include "mozilla/dom/CSSPageRuleBinding.h"
@ -247,10 +249,12 @@ GroupRuleRuleList::IndexedGetter(uint32_t aIndex, bool& aFound)
//
ImportRule::ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
const nsString& aLayerName,
uint32_t aLineNumber, uint32_t aColumnNumber)
: Rule(aLineNumber, aColumnNumber)
, mURLSpec(aURLSpec)
, mMedia(aMedia)
, mLayerName(aLayerName)
{
MOZ_ASSERT(aMedia);
// XXXbz This is really silly.... the mMedia here will be replaced
@ -259,8 +263,9 @@ ImportRule::ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
}
ImportRule::ImportRule(const ImportRule& aCopy)
: Rule(aCopy),
mURLSpec(aCopy.mURLSpec)
: Rule(aCopy)
, mURLSpec(aCopy.mURLSpec)
, mLayerName(aCopy.mLayerName)
{
// Whether or not an @import rule has a null sheet is a permanent
// property of that @import rule, since it is null only if the target
@ -412,6 +417,13 @@ ImportRule::GetStyleSheet(nsIDOMCSSStyleSheet * *aStyleSheet)
return NS_OK;
}
NS_IMETHODIMP
ImportRule::GetLayerName(nsAString & aLayerName)
{
aLayerName = mLayerName;
return NS_OK;
}
/* virtual */ size_t
ImportRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
@ -3351,3 +3363,229 @@ nsCSSCounterStyleRule::WrapObject(JSContext* aCx,
{
return CSSCounterStyleRuleBinding::Wrap(aCx, this, aGivenProto);
}
namespace mozilla {
// -------------------------------------------
// LayerStatementRule
//
CSSLayerStatementRule::CSSLayerStatementRule(
const nsTArray<nsString>& aNameList,
uint32_t aLineNumber, uint32_t aColumnNumber)
: Rule(aLineNumber, aColumnNumber)
, mNameList(aNameList)
{
}
CSSLayerStatementRule::CSSLayerStatementRule(const CSSLayerStatementRule& aCopy)
: Rule(aCopy)
, mNameList(aCopy.mNameList)
{
}
CSSLayerStatementRule::~CSSLayerStatementRule()
{
}
NS_IMPL_ADDREF_INHERITED(CSSLayerStatementRule, Rule)
NS_IMPL_RELEASE_INHERITED(CSSLayerStatementRule, Rule)
bool
CSSLayerStatementRule::IsCCLeaf() const
{
// We're not a leaf.
return false;
}
// QueryInterface implementation for CSSLayerStatementRule
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(CSSLayerStatementRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSLayerStatementRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
NS_IMPL_CYCLE_COLLECTION_CLASS(CSSLayerStatementRule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CSSLayerStatementRule)
tmp->mNameList.Clear();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSLayerStatementRule, mozilla::css::Rule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
#ifdef DEBUG
/* virtual */ void
CSSLayerStatementRule::List(FILE* out, int32_t aIndent) const
{
// TODO
}
#endif
/* virtual */ int32_t
CSSLayerStatementRule::GetType() const
{
return Rule::LAYER_STATEMENT_RULE;
}
/* virtual */ already_AddRefed<Rule>
CSSLayerStatementRule::Clone() const
{
RefPtr<Rule> clone = new CSSLayerStatementRule(*this);
return clone.forget();
}
uint16_t
CSSLayerStatementRule::Type() const
{
return nsIDOMCSSRule::LAYER_STATEMENT_RULE;
}
void
CSSLayerStatementRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@layer ");
for (uint32_t i = 0, i_end = mNameList.Length(); i != i_end; ++i) {
aCssText.Append(mNameList[i]);
if (i != i_end - 1) {
aCssText.AppendLiteral(", ");
}
}
aCssText.Append(';');
}
void
CSSLayerStatementRule::GetNameList(nsTArray<nsString>& aResult)
{
aResult = mNameList;
}
/* virtual */ size_t
CSSLayerStatementRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this);
}
/* virtual */ JSObject*
CSSLayerStatementRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return CSSLayerStatementRuleBinding::Wrap(aCx, this, aGivenProto);
}
// -------------------------------------------
// LayerBlockRule
//
CSSLayerBlockRule::CSSLayerBlockRule(const nsString& aName,
uint32_t aLineNumber, uint32_t aColumnNumber)
: css::GroupRule(aLineNumber, aColumnNumber)
, mName(aName)
{
}
CSSLayerBlockRule::~CSSLayerBlockRule()
{
}
CSSLayerBlockRule::CSSLayerBlockRule(const CSSLayerBlockRule& aCopy)
: css::GroupRule(aCopy)
, mName(aCopy.mName)
{
}
#ifdef DEBUG
/* virtual */ void
CSSLayerBlockRule::List(FILE* out, int32_t aIndent) const
{
// TODO
}
#endif
/* virtual */ int32_t
CSSLayerBlockRule::GetType() const
{
return Rule::LAYER_BLOCK_RULE;
}
/* virtual */ already_AddRefed<mozilla::css::Rule>
CSSLayerBlockRule::Clone() const
{
RefPtr<css::Rule> clone = new CSSLayerBlockRule(*this);
return clone.forget();
}
/* virtual */ bool
CSSLayerBlockRule::UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey)
{
// This will never be reached.
return true;
}
NS_IMPL_ADDREF_INHERITED(CSSLayerBlockRule, css::GroupRule)
NS_IMPL_RELEASE_INHERITED(CSSLayerBlockRule, css::GroupRule)
// QueryInterface implementation for CSSLayerBlockRule
NS_INTERFACE_MAP_BEGIN(CSSLayerBlockRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSGroupingRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSLayerBlockRule)
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
uint16_t
CSSLayerBlockRule::Type() const
{
return nsIDOMCSSRule::LAYER_BLOCK_RULE;
}
void
CSSLayerBlockRule::GetCssTextImpl(nsAString& aCssText) const
{
aCssText.AssignLiteral("@layer ");
aCssText.Append(mName);
css::GroupRule::AppendRulesToCssText(aCssText);
}
// nsIDOMCSSGroupingRule methods
NS_IMETHODIMP
CSSLayerBlockRule::GetCssRules(nsIDOMCSSRuleList* *aRuleList)
{
return css::GroupRule::GetCssRules(aRuleList);
}
NS_IMETHODIMP
CSSLayerBlockRule::InsertRule(const nsAString & aRule, uint32_t aIndex, uint32_t* _retval)
{
return css::GroupRule::InsertRule(aRule, aIndex, _retval);
}
NS_IMETHODIMP
CSSLayerBlockRule::DeleteRule(uint32_t aIndex)
{
return css::GroupRule::DeleteRule(aIndex);
}
// nsIDOMCSSLayerBlockRule methods
NS_IMETHODIMP
CSSLayerBlockRule::GetName(nsAString& aConditionText)
{
aConditionText.Assign(mName);
return NS_OK;
}
/* virtual */ size_t
CSSLayerBlockRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
n += css::GroupRule::SizeOfExcludingThis(aMallocSizeOf);
n += mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
return n;
}
/* virtual */ JSObject*
CSSLayerBlockRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return CSSLayerBlockRuleBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace mozilla

View file

@ -26,6 +26,8 @@
#include "nsIDOMCSSFontFaceRule.h"
#include "nsIDOMCSSFontFeatureValuesRule.h"
#include "nsIDOMCSSGroupingRule.h"
#include "nsIDOMCSSLayerBlockRule.h"
#include "nsIDOMCSSLayerStatementRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSMozDocumentRule.h"
#include "nsIDOMCSSPageRule.h"
@ -737,4 +739,87 @@ private:
uint32_t mGeneration;
};
namespace mozilla {
class CSSLayerStatementRule final : public css::Rule,
public nsIDOMCSSLayerStatementRule
{
public:
CSSLayerStatementRule(const nsTArray<nsString>& aNameList,
uint32_t aLineNumber, uint32_t aColumnNumber);
CSSLayerStatementRule(const CSSLayerStatementRule& aCopy);
// Rule methods
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CSSLayerStatementRule, Rule)
NS_DECL_ISUPPORTS_INHERITED
virtual bool IsCCLeaf() const override;
// nsIDOMCSSLayerStatementRule interface
NS_DECL_NSIDOMCSSLAYERSTATEMENTRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
void GetNameList(nsTArray<nsString>& aResult);
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
protected:
virtual ~CSSLayerStatementRule();
nsTArray<nsString> mNameList;
};
class CSSLayerBlockRule final : public css::GroupRule,
public nsIDOMCSSLayerBlockRule
{
public:
CSSLayerBlockRule(const nsString& aName,
uint32_t aLineNumber, uint32_t aColumnNumber);
CSSLayerBlockRule(const CSSLayerBlockRule& aCopy);
// Rule methods
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
virtual int32_t GetType() const override;
using Rule::GetType;
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
virtual bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) override;
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMCSSGroupingRule interface
NS_DECL_NSIDOMCSSGROUPINGRULE
// nsIDOMCSSLayerBlockRule interface
NS_DECL_NSIDOMCSSLAYERBLOCKRULE
// WebIDL interface
uint16_t Type() const override;
void GetCssTextImpl(nsAString& aCssText) const override;
// Our XPCOM GetName is OK
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
protected:
virtual ~CSSLayerBlockRule();
nsString mName;
};
} // namespace mozilla
#endif /* !defined(nsCSSRules_h_) */

View file

@ -2684,6 +2684,9 @@ pref("layout.css.control-characters.visible", false);
// Is support for ResizeObservers enabled?
pref("layout.css.resizeobserver.enabled", true);
// Is support for cascade layers enabled?
pref("layout.css.cascade-layers.enabled", true);
// pref for which side vertical scrollbars should be on
// 0 = end-side in UI direction
// 1 = end-side in document/content direction