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

Unified Diff: Source/core/css/CSSSelector.h

Issue 751023002: Use SubSelector as relation on left-most selector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: SubSelector is not a combinator Created 6 years, 1 month 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: Source/core/css/CSSSelector.h
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 100241c79d3b8771cb111261745be63fc82dbcef..647bea9970583b87b14c4e52e0eb7c261ebb52f6 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -48,9 +48,6 @@ namespace blink {
// --> (relation == SubSelector)
// selectorText(): .b
//
- // Note that currently a bare selector such as ".a" has a relation() of Descendant. This is a bug - instead the relation should be
- // "None".
- //
// The order of tagHistory() varies depending on the situation.
// * Relations using combinators (http://www.w3.org/TR/css3-selectors/#combinators), such as descendant, sibling, etc., are parsed
// right-to-left (in the example above, this is why .c is earlier in the tagHistory() chain than .a.b).
@@ -106,7 +103,7 @@ namespace blink {
/* how the attribute value has to match.... Default is Exact */
enum Match {
- Unknown = 0,
+ Unknown,
Tag, // Example: div
Id, // Example: #id
Class, // example: .class
@@ -124,17 +121,17 @@ namespace blink {
};
enum Relation {
- Descendant = 0, // "Space" combinator
+ SubSelector, // No combinator
+ Descendant, // "Space" combinator
Child, // > combinator
DirectAdjacent, // + combinator
IndirectAdjacent, // ~ combinator
- SubSelector, // "No space" combinator
ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element
ShadowDeep // /deep/ combinator
};
enum PseudoType {
- PseudoNotParsed = 0,
+ PseudoNotParsed,
PseudoUnknown,
PseudoEmpty,
PseudoFirstChild,
@@ -296,8 +293,6 @@ namespace blink {
bool isHostPseudoClass() const;
bool isTreeBoundaryCrossing() const;
bool isInsertionPointCrossing() const;
- // FIXME: selectors with no tagHistory() get a relation() of Descendant (and sometimes even SubSelector). It should instead be
- // None.
Relation relation() const { return static_cast<Relation>(m_relation); }
void setRelation(Relation relation)
{
@@ -472,7 +467,7 @@ inline void CSSSelector::setValue(const AtomicString& value)
}
inline CSSSelector::CSSSelector()
- : m_relation(Descendant)
+ : m_relation(SubSelector)
, m_match(Unknown)
, m_pseudoType(PseudoNotParsed)
, m_parsedNth(false)
@@ -486,7 +481,7 @@ inline CSSSelector::CSSSelector()
}
inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsForNamespaceRule)
- : m_relation(Descendant)
+ : m_relation(SubSelector)
, m_match(Tag)
, m_pseudoType(PseudoNotParsed)
, m_parsedNth(false)
« no previous file with comments | « LayoutTests/fast/css/invalidation/sub-selector-adjacent-cancellation-expected.txt ('k') | Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698