diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-19 16:57:55 +0800 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-03-23 12:17:58 +0100 |
commit | d2be38e92b72b0cb53eb5c42acbde83a46e4a6b4 (patch) | |
tree | 793b0329ded49b4cdb9d31b7fa953f2e9b263ddd /layout | |
parent | fc5d7a94b7670444288b46985c2525e9fbc732d1 (diff) | |
download | uxp-d2be38e92b72b0cb53eb5c42acbde83a46e4a6b4.tar.gz |
Issue #1592 - Part 1c: Pass SelectorParsingFlags as a reference
Diffstat (limited to 'layout')
-rw-r--r-- | layout/style/nsCSSParser.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 8c4f16f24d..47ceab3f41 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -777,7 +777,7 @@ protected: // aFlags is not set. nsSelectorParsingStatus ParsePseudoSelector(int32_t& aDataMask, nsCSSSelector& aSelector, - SelectorParsingFlags aFlags, + SelectorParsingFlags& aFlags, nsIAtom** aPseudoElement, nsAtomList** aPseudoElementArgs, CSSPseudoElementType* aPseudoElementType); @@ -785,9 +785,9 @@ protected: nsSelectorParsingStatus ParseAttributeSelector(int32_t& aDataMask, nsCSSSelector& aSelector); - nsSelectorParsingStatus ParseTypeOrUniversalSelector(int32_t& aDataMask, - nsCSSSelector& aSelector, - SelectorParsingFlags aFlags); + nsSelectorParsingStatus ParseTypeOrUniversalSelector(int32_t& aDataMask, + nsCSSSelector& aSelector, + SelectorParsingFlags& aFlags); nsSelectorParsingStatus ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector, CSSPseudoClassType aType); @@ -797,22 +797,22 @@ protected: nsSelectorParsingStatus ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, CSSPseudoClassType aType, - SelectorParsingFlags aFlags); + SelectorParsingFlags& aFlags); - nsSelectorParsingStatus ParseNegatedSimpleSelector(int32_t& aDataMask, - nsCSSSelector& aSelector, - SelectorParsingFlags aFlags); + nsSelectorParsingStatus ParseNegatedSimpleSelector(int32_t& aDataMask, + nsCSSSelector& aSelector, + SelectorParsingFlags& aFlags); // If aStopChar is non-zero, the selector list is done when we hit // aStopChar. Otherwise, it's done when we hit EOF. bool ParseSelectorList(nsCSSSelectorList*& aListHead, char16_t aStopChar, - SelectorParsingFlags aFlags = SelectorParsingFlags::eNone); + SelectorParsingFlags& aFlags); bool ParseSelectorGroup(nsCSSSelectorList*& aListHead, - SelectorParsingFlags aFlags); + SelectorParsingFlags& aFlags); bool ParseSelector(nsCSSSelectorList* aList, char16_t aPrevCombinator, - SelectorParsingFlags aFlags); + SelectorParsingFlags& aFlags); enum { eParseDeclaration_InBraces = 1 << 0, @@ -2342,7 +2342,8 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString, css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURI); InitScanner(scanner, reporter, aURI, aURI, nullptr); - bool success = ParseSelectorList(*aSelectorList, char16_t(0)); + SelectorParsingFlags flags = SelectorParsingFlags::eNone; + bool success = ParseSelectorList(*aSelectorList, char16_t(0), flags); // We deliberately do not call OUTPUT_ERROR here, because all our // callers map a failure return to a JS exception, and if that JS @@ -5463,9 +5464,10 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData, { // First get the list of selectors for the rule nsCSSSelectorList* slist = nullptr; + SelectorParsingFlags flags = SelectorParsingFlags::eNone; uint32_t linenum, colnum; if (!GetNextTokenLocation(true, &linenum, &colnum) || - !ParseSelectorList(slist, char16_t('{'))) { + !ParseSelectorList(slist, char16_t('{'), flags)) { REPORT_UNEXPECTED(PEBadSelectorRSIgnored); OUTPUT_ERROR(); SkipRuleSet(aInsideBraces); @@ -5502,7 +5504,7 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData, bool CSSParserImpl::ParseSelectorList(nsCSSSelectorList*& aListHead, char16_t aStopChar, - SelectorParsingFlags aFlags) + SelectorParsingFlags& aFlags) { nsCSSSelectorList* list = nullptr; if (! ParseSelectorGroup(list, aFlags)) { @@ -5586,7 +5588,7 @@ static bool IsUniversalSelector(const nsCSSSelector& aSelector) bool CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList, - SelectorParsingFlags aFlags) + SelectorParsingFlags& aFlags) { char16_t combinator = 0; nsAutoPtr<nsCSSSelectorList> list(new nsCSSSelectorList()); @@ -5687,9 +5689,9 @@ CSSParserImpl::ParseClassSelector(int32_t& aDataMask, // namespace|type or namespace|* or *|* or * // CSSParserImpl::nsSelectorParsingStatus -CSSParserImpl::ParseTypeOrUniversalSelector(int32_t& aDataMask, - nsCSSSelector& aSelector, - SelectorParsingFlags aFlags) +CSSParserImpl::ParseTypeOrUniversalSelector(int32_t& aDataMask, + nsCSSSelector& aSelector, + SelectorParsingFlags& aFlags) { nsAutoString buffer; if (mToken.IsSymbol('*')) { // universal element selector, or universal namespace @@ -6052,7 +6054,7 @@ CSSParserImpl::ParseAttributeSelector(int32_t& aDataMask, CSSParserImpl::nsSelectorParsingStatus CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask, nsCSSSelector& aSelector, - SelectorParsingFlags aFlags, + SelectorParsingFlags& aFlags, nsIAtom** aPseudoElement, nsAtomList** aPseudoElementArgs, CSSPseudoElementType* aPseudoElementType) @@ -6331,9 +6333,9 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask, // Parse the argument of a negation pseudo-class :not() // CSSParserImpl::nsSelectorParsingStatus -CSSParserImpl::ParseNegatedSimpleSelector(int32_t& aDataMask, - nsCSSSelector& aSelector, - SelectorParsingFlags aFlags) +CSSParserImpl::ParseNegatedSimpleSelector(int32_t& aDataMask, + nsCSSSelector& aSelector, + SelectorParsingFlags& aFlags) { aFlags |= SelectorParsingFlags::eIsNegated; @@ -6611,7 +6613,7 @@ CSSParserImpl::ParsePseudoClassWithNthPairArg(nsCSSSelector& aSelector, CSSParserImpl::nsSelectorParsingStatus CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, CSSPseudoClassType aType, - SelectorParsingFlags aFlags) + SelectorParsingFlags& aFlags) { bool isSingleSelector = nsCSSPseudoClasses::HasSingleSelectorArg(aType); @@ -6679,7 +6681,7 @@ CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, bool CSSParserImpl::ParseSelector(nsCSSSelectorList* aList, char16_t aPrevCombinator, - SelectorParsingFlags aFlags) + SelectorParsingFlags& aFlags) { if (! GetToken(true)) { REPORT_UNEXPECTED_EOF(PESelectorEOF); |