WebKit Bugzilla
Attachment 347028 Details for
Bug 188529
: Remove unused CSSSelector::parseNth
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188529-20180813125557.patch (text/plain), 9.70 KB, created by
Alex Christensen
on 2018-08-13 12:55:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-08-13 12:55:58 PDT
Size:
9.70 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 234812) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,26 @@ >+2018-08-13 Alex Christensen <achristensen@webkit.org> >+ >+ Remove unused CSSSelector::parseNth >+ https://bugs.webkit.org/show_bug.cgi?id=188529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This was conceptually replaced by the call to setNth in CSSSelectorParser::consumePseudo. >+ >+ * css/CSSSelector.cpp: >+ (WebCore::CSSSelector::CSSSelector): >+ (WebCore::CSSSelector::setNth): >+ (WebCore::CSSSelector::nthA const): >+ (WebCore::CSSSelector::nthB const): >+ (WebCore::CSSSelector::parseNth const): Deleted. >+ (WebCore::CSSSelector::RareData::parseNth): Deleted. >+ * css/CSSSelector.h: >+ (WebCore::CSSSelector::CSSSelector): >+ * css/SelectorChecker.cpp: >+ (WebCore::SelectorChecker::checkOne const): >+ * cssjit/SelectorCompiler.cpp: >+ (WebCore::SelectorCompiler::addNthChildType): >+ > 2018-08-13 Antti Koivisto <antti@apple.com> > > Meaning of OptionSet::contains is unclear when used with OptionSet argument >Index: Source/WebCore/css/CSSSelector.cpp >=================================================================== >--- Source/WebCore/css/CSSSelector.cpp (revision 234663) >+++ Source/WebCore/css/CSSSelector.cpp (working copy) >@@ -52,7 +52,6 @@ CSSSelector::CSSSelector(const Qualified > : m_relation(DescendantSpace) > , m_match(Tag) > , m_pseudoType(0) >- , m_parsedNth(false) > , m_isLastInSelectorList(false) > , m_isLastInTagHistory(true) > , m_hasRareData(false) >@@ -787,22 +786,9 @@ void CSSSelector::setSelectorList(std::u > void CSSSelector::setNth(int a, int b) > { > createRareData(); >- m_parsedNth = true; // FIXME-NEWPARSER: Can remove this parsed boolean once old parser is gone. > m_data.m_rareData->m_a = a; > m_data.m_rareData->m_b = b; > } >- >-// FIXME-NEWPARSER: All the code to parse nth-child stuff can be removed when >-// the new parser is enabled. >-bool CSSSelector::parseNth() const >-{ >- if (!m_hasRareData) >- return false; >- if (m_parsedNth) >- return true; >- m_parsedNth = m_data.m_rareData->parseNth(); >- return m_parsedNth; >-} > > bool CSSSelector::matchNth(int count) const > { >@@ -813,14 +799,12 @@ bool CSSSelector::matchNth(int count) co > int CSSSelector::nthA() const > { > ASSERT(m_hasRareData); >- ASSERT(m_parsedNth); > return m_data.m_rareData->m_a; > } > > int CSSSelector::nthB() const > { > ASSERT(m_hasRareData); >- ASSERT(m_parsedNth); > return m_data.m_rareData->m_b; > } > >@@ -836,67 +820,6 @@ CSSSelector::RareData::RareData(AtomicSt > > CSSSelector::RareData::~RareData() = default; > >-// a helper function for parsing nth-arguments >-bool CSSSelector::RareData::parseNth() >-{ >- if (m_argument.isEmpty()) >- return false; >- >- if (equalLettersIgnoringASCIICase(m_argument, "odd")) { >- m_a = 2; >- m_b = 1; >- } else if (equalLettersIgnoringASCIICase(m_argument, "even")) { >- m_a = 2; >- m_b = 0; >- } else { >- m_a = 0; >- m_b = 0; >- >- size_t n = std::min(m_argument.find('n'), m_argument.find('N')); >- if (n != notFound) { >- if (m_argument[0] == '-') { >- if (n == 1) >- m_a = -1; // -n == -1n >- else { >- bool ok; >- m_a = StringView(m_argument).substring(0, n).toIntStrict(ok); >- if (!ok) >- return false; >- } >- } else if (!n) >- m_a = 1; // n == 1n >- else { >- bool ok; >- m_a = StringView(m_argument).substring(0, n).toIntStrict(ok); >- if (!ok) >- return false; >- } >- >- size_t p = m_argument.find('+', n); >- if (p != notFound) { >- bool ok; >- m_b = StringView(m_argument).substring(p + 1).toIntStrict(ok); >- if (!ok) >- return false; >- } else { >- p = m_argument.find('-', n); >- if (p != notFound) { >- bool ok; >- m_b = -StringView(m_argument).substring(p + 1).toIntStrict(ok); >- if (!ok) >- return false; >- } >- } >- } else { >- bool ok; >- m_b = m_argument.string().toIntStrict(&ok); >- if (!ok) >- return false; >- } >- } >- return true; >-} >- > // a helper function for checking nth-arguments > bool CSSSelector::RareData::matchNth(int count) > { >Index: Source/WebCore/css/CSSSelector.h >=================================================================== >--- Source/WebCore/css/CSSSelector.h (revision 234663) >+++ Source/WebCore/css/CSSSelector.h (working copy) >@@ -251,7 +251,6 @@ namespace WebCore { > void setLangArgumentList(std::unique_ptr<Vector<AtomicString>>); > void setSelectorList(std::unique_ptr<CSSSelectorList>); > >- bool parseNth() const; > bool matchNth(int count) const; > int nthA() const; > int nthB() const; >@@ -326,7 +325,6 @@ namespace WebCore { > unsigned m_relation : 4; // enum RelationType. > mutable unsigned m_match : 4; // enum Match. > mutable unsigned m_pseudoType : 8; // PseudoType. >- mutable unsigned m_parsedNth : 1; // Used for :nth-*. > unsigned m_isLastInSelectorList : 1; > unsigned m_isLastInTagHistory : 1; > unsigned m_hasRareData : 1; >@@ -347,7 +345,6 @@ namespace WebCore { > static Ref<RareData> create(AtomicString&& value) { return adoptRef(*new RareData(WTFMove(value))); } > ~RareData(); > >- bool parseNth(); > bool matchNth(int count); > > // For quirks mode, class and id are case-insensitive. In the case where uppercase >@@ -484,7 +481,6 @@ inline CSSSelector::CSSSelector() > : m_relation(DescendantSpace) > , m_match(Unknown) > , m_pseudoType(0) >- , m_parsedNth(false) > , m_isLastInSelectorList(false) > , m_isLastInTagHistory(true) > , m_hasRareData(false) >@@ -502,7 +498,6 @@ inline CSSSelector::CSSSelector(const CS > : m_relation(o.m_relation) > , m_match(o.m_match) > , m_pseudoType(o.m_pseudoType) >- , m_parsedNth(o.m_parsedNth) > , m_isLastInSelectorList(o.m_isLastInSelectorList) > , m_isLastInTagHistory(o.m_isLastInTagHistory) > , m_hasRareData(o.m_hasRareData) >Index: Source/WebCore/css/SelectorChecker.cpp >=================================================================== >--- Source/WebCore/css/SelectorChecker.cpp (revision 234663) >+++ Source/WebCore/css/SelectorChecker.cpp (working copy) >@@ -837,8 +837,6 @@ bool SelectorChecker::checkOne(CheckingC > } > return false; > case CSSSelector::PseudoClassNthChild: >- if (!selector.parseNth()) >- break; > if (auto* parentElement = element.parentElement()) { > auto relation = context.isSubjectOrAdjacentElement ? Style::Relation::ChildrenAffectedByForwardPositionalRules : Style::Relation::DescendantsAffectedByForwardPositionalRules; > addStyleRelation(checkingContext, *parentElement, relation); >@@ -867,9 +865,6 @@ bool SelectorChecker::checkOne(CheckingC > } > break; > case CSSSelector::PseudoClassNthOfType: >- if (!selector.parseNth()) >- break; >- > if (auto* parentElement = element.parentElement()) { > auto relation = context.isSubjectOrAdjacentElement ? Style::Relation::ChildrenAffectedByForwardPositionalRules : Style::Relation::DescendantsAffectedByForwardPositionalRules; > addStyleRelation(checkingContext, *parentElement, relation); >@@ -880,8 +875,6 @@ bool SelectorChecker::checkOne(CheckingC > } > break; > case CSSSelector::PseudoClassNthLastChild: >- if (!selector.parseNth()) >- break; > if (Element* parentElement = element.parentElement()) { > if (const CSSSelectorList* selectorList = selector.selectorList()) { > unsigned selectorListSpecificity; >@@ -913,8 +906,6 @@ bool SelectorChecker::checkOne(CheckingC > } > break; > case CSSSelector::PseudoClassNthLastOfType: >- if (!selector.parseNth()) >- break; > if (Element* parentElement = element.parentElement()) { > auto relation = context.isSubjectOrAdjacentElement ? Style::Relation::ChildrenAffectedByBackwardPositionalRules : Style::Relation::DescendantsAffectedByBackwardPositionalRules; > addStyleRelation(checkingContext, *parentElement, relation); >Index: Source/WebCore/cssjit/SelectorCompiler.cpp >=================================================================== >--- Source/WebCore/cssjit/SelectorCompiler.cpp (revision 234663) >+++ Source/WebCore/cssjit/SelectorCompiler.cpp (working copy) >@@ -451,9 +451,6 @@ static inline FunctionType addScrollbarP > // Handle the forward :nth-child() and backward :nth-last-child(). > static FunctionType addNthChildType(const CSSSelector& selector, SelectorContext selectorContext, FragmentPositionInRootFragments positionInRootFragments, CSSSelector::PseudoClassType firstMatchAlternative, bool visitedMatchEnabled, Vector<std::pair<int, int>, 2>& simpleCases, Vector<NthChildOfSelectorInfo>& filteredCases, HashSet<unsigned>& pseudoClasses, unsigned& internalSpecificity) > { >- if (!selector.parseNth()) >- return FunctionType::CannotMatchAnything; >- > int a = selector.nthA(); > int b = selector.nthB(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188529
: 347028