-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Drop CSSSelectorList::next() and port call sites to using modern range loops instead #47131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop CSSSelectorList::next() and port call sites to using modern range loops instead #47131
Conversation
EWS run on previous version of this PR (hash 7cf352a) |
7cf352a
to
48b8d6e
Compare
EWS run on previous version of this PR (hash 48b8d6e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that I see how these iterators are safer than raw pointers.
Source/WebCore/css/CSSSelectorList.h
Outdated
const_iterator operator++(int) | ||
{ | ||
const_iterator temp = *this; | ||
++(*this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++(*this); | |
++*this; |
At the moment, not a lot safer, though range loops are more concise and less error-prone. However, it will look into hardening out iterators in the future so it is good to be following consistent patterns across the codebase. Now we have one bottleneck, the iterator operator++() and we could make it bound safe if performance allows. |
48b8d6e
to
7d817c1
Compare
EWS run on current version of this PR (hash 7d817c1) |
…e loops instead https://bugs.webkit.org/show_bug.cgi?id=294925 Reviewed by Darin Adler. Drop CSSSelectorList::next() and port call sites to using modern range loops instead, to avoid dealing with raw pointers. This also restricts the WTF_ALLOW_UNSAFE_BUFFER_USAGE to `CSSSelectorList::const_iterator::operator++()`. * Source/WebCore/css/CSSSelector.cpp: (WebCore::CSSSelector::visitAllSimpleSelectors const): * Source/WebCore/css/CSSSelectorList.h: (WebCore::CSSSelectorList::first const): (WebCore::CSSSelectorList::indexOfNextSelectorAfter const): (WebCore::CSSSelectorList::const_iterator::const_iterator): (WebCore::CSSSelectorList::const_iterator::operator++): (WebCore::CSSSelectorList::next): Deleted. * Source/WebCore/css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): (WebCore::SelectorChecker::matchSelectorList const): * Source/WebCore/css/StyleRule.cpp: (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const): * Source/WebCore/css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::resolveNestingParent): * Source/WebCore/css/parser/MutableCSSSelector.cpp: (WebCore::selectorListMatchesPseudoElement): * Source/WebCore/dom/SelectorQuery.cpp: (WebCore::SelectorDataList::SelectorDataList): * Source/WebCore/inspector/InspectorStyleSheet.cpp: * Source/WebCore/inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): * Source/WebCore/inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * Source/WebCore/style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::scopeRulesMatch): * Source/WebCore/style/RuleData.cpp: (WebCore::Style::selectorCanMatchPseudoElement): (WebCore::Style::determinePropertyAllowlist): * Source/WebCore/style/RuleFeature.cpp: (WebCore::Style::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): (WebCore::Style::RuleFeatureSet::collectFeatures): Canonical link: https://commits.webkit.org/296627@main
7d817c1
to
ca6229d
Compare
Committed 296627@main (ca6229d): https://commits.webkit.org/296627@main Reviewed commits have been landed. Closing PR #47131 and removing active labels. |
ca6229d
7d817c1
🛠 win🧪 wpe-wk2🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 mac-wk1🛠 wpe-cairo🧪 mac-AS-debug-wk2🧪 gtk-wk2🧪 api-gtk🛠 mac-safer-cpp