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

Unified Diff: Source/WebCore/css/SelectorChecker.cpp

Issue 8365028: Merge 97745 - REGRESSION(r97248): :visited as descendant selector broken (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « Source/WebCore/css/CSSStyleSelector.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/css/SelectorChecker.cpp
===================================================================
--- Source/WebCore/css/SelectorChecker.cpp (revision 98066)
+++ Source/WebCore/css/SelectorChecker.cpp (working copy)
@@ -450,17 +450,17 @@
sel = sel->tagHistory();
if (!sel)
return SelectorMatches;
-
+
if (relation != CSSSelector::SubSelector) {
// Bail-out if this selector is irrelevant for the pseudoStyle
if (m_pseudoStyle != NOPSEUDO && m_pseudoStyle != dynamicPseudo)
return SelectorFailsCompletely;
- // Disable :visited matching after we move to selector components that would match anything else than the current element.
- if (!isSubSelector)
+ // Disable :visited matching when we see the first link or try to match anything else than an ancestors.
+ if (!isSubSelector && (e->isLink() || (relation != CSSSelector::Descendant && relation != CSSSelector::Child)))
visitedMatchType = VisitedMatchDisabled;
}
-
+
switch (relation) {
case CSSSelector::Descendant:
while (true) {
@@ -1338,7 +1338,7 @@
unsigned linkMatchType = MatchAll;
// Statically determine if this selector will match a link in visited, unvisited or any state, or never.
- // :visited never matches other elements than the current.
+ // :visited never matches other elements than the innermost link element.
for (; selector; selector = selector->tagHistory()) {
switch (selector->pseudoType()) {
case CSSSelector::PseudoNot:
@@ -1361,10 +1361,14 @@
// We don't support :link and :visited inside :-webkit-any.
break;
}
- if (selector->relation() != CSSSelector::SubSelector)
+ CSSSelector::Relation relation = selector->relation();
+ if (relation == CSSSelector::SubSelector)
+ continue;
+ if (relation != CSSSelector::Descendant && relation != CSSSelector::Child)
return linkMatchType;
+ if (linkMatchType != MatchAll)
+ return linkMatchType;
}
- ASSERT_NOT_REACHED();
return linkMatchType;
}
« no previous file with comments | « Source/WebCore/css/CSSStyleSelector.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698