Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: third_party/WebKit/Source/core/dom/SelectorQuery.cpp

Issue 1602833002: No pseudo elements in SelectorChecker::Mode QueryingRules. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-pseudoelm-check-2-20160118
Patch Set: Another review issue Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/SelectorQuery.cpp
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
index 91257de398f7b08db78f4e7ff3ad411846ee4716..7d6d0f9b33a183375eda78b1d359bec90ec0382d 100644
--- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
+++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
@@ -110,6 +110,8 @@ void SelectorDataList::initialize(const CSSSelectorList& selectorList)
m_selectors.reserveInitialCapacity(selectorCount);
unsigned index = 0;
for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector), ++index) {
+ if (selector->matchesPseudoElement())
+ continue;
m_selectors.uncheckedAppend(selector);
m_usesDeepCombinatorOrShadowPseudo |= selectorList.selectorUsesDeepCombinatorOrShadowPseudo(index);
m_needsUpdatedDistribution |= selectorList.selectorNeedsUpdatedDistribution(index);
@@ -141,10 +143,13 @@ bool SelectorDataList::matches(Element& targetElement) const
Element* SelectorDataList::closest(Element& targetElement) const
{
+ unsigned selectorCount = m_selectors.size();
+ if (!selectorCount)
+ return nullptr;
+
if (m_needsUpdatedDistribution)
targetElement.updateDistribution();
- unsigned selectorCount = m_selectors.size();
for (Element* currentElement = &targetElement; currentElement; currentElement = currentElement->parentElement()) {
for (unsigned i = 0; i < selectorCount; ++i) {
if (selectorMatches(*m_selectors[i], *currentElement, targetElement))
@@ -451,6 +456,9 @@ const CSSSelector* SelectorDataList::selectorForIdLookup(const CSSSelector& firs
template <typename SelectorQueryTrait>
void SelectorDataList::execute(ContainerNode& rootNode, typename SelectorQueryTrait::OutputType& output) const
{
+ if (m_selectors.isEmpty())
+ return;
+
if (!canUseFastQuery(rootNode)) {
if (m_needsUpdatedDistribution)
rootNode.updateDistribution();
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.h ('k') | third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698