Chromium Code Reviews| Index: Source/core/css/CSSSelector.h |
| diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h |
| index 704cc4051339c98244edf12102fff23beba2a168..92f71bc633a1e24724e4dbef9f3e26205ff4d402 100644 |
| --- a/Source/core/css/CSSSelector.h |
| +++ b/Source/core/css/CSSSelector.h |
| @@ -239,6 +239,11 @@ namespace blink { |
| RightBottomMarginBox, |
| }; |
| + enum AttributeFlags { |
| + NoAttributeFlags, |
| + CaseInsensitive, |
| + }; |
| + |
| PseudoType pseudoType() const |
| { |
| if (m_pseudoType == PseudoNotParsed) |
| @@ -262,6 +267,7 @@ namespace blink { |
| // how you use the returned QualifiedName. |
| // http://www.w3.org/TR/css3-selectors/#attrnmsp |
| const QualifiedName& attribute() const; |
| + AttributeFlags attributeFlags() const; |
| // Returns the argument of a parameterized selector. For example, nth-child(2) would have an argument of 2. |
| const AtomicString& argument() const { return m_hasRareData ? m_data.m_rareData->m_argument : nullAtom; } |
| const CSSSelectorList* selectorList() const { return m_hasRareData ? m_data.m_rareData->m_selectorList.get() : 0; } |
| @@ -272,7 +278,7 @@ namespace blink { |
| #endif |
| void setValue(const AtomicString&); |
| - void setAttribute(const QualifiedName&); |
| + void setAttribute(const QualifiedName&, unsigned flags); |
| void setArgument(const AtomicString&); |
| void setSelectorList(PassOwnPtr<CSSSelectorList>); |
| void setMatchUserAgentOnly(); |
| @@ -347,8 +353,14 @@ namespace blink { |
| bool matchNth(int count); |
| AtomicString m_value; |
| - int m_a; // Used for :nth-* |
| - int m_b; // Used for :nth-* |
| + union Bits { |
|
eseidel
2014/07/29 15:43:22
I'm confused by these. It looks like this is a bi
fs
2014/07/29 17:14:32
The union is "reaction" to comments in https://cod
|
| + Bits() : m_nth() { } |
|
eseidel
2014/07/29 15:43:22
This doesn't do anything.
fs
2014/07/29 17:14:32
It initializes m_nth to zeros.
|
| + struct { |
| + int m_a; // Used for :nth-* |
| + int m_b; // Used for :nth-* |
| + } m_nth; |
| + unsigned m_attributeFlags; // used for attribute selector (with value) |
| + } m_bits; |
| QualifiedName m_attribute; // used for attribute selector |
| AtomicString m_argument; // Used for :contains, :lang, :nth-* |
| OwnPtr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not |
| @@ -373,6 +385,13 @@ inline const QualifiedName& CSSSelector::attribute() const |
| return m_data.m_rareData->m_attribute; |
| } |
| +inline CSSSelector::AttributeFlags CSSSelector::attributeFlags() const |
| +{ |
| + ASSERT(isAttributeSelector()); |
| + ASSERT(m_hasRareData); |
| + return static_cast<AttributeFlags>(m_data.m_rareData->m_bits.m_attributeFlags); |
| +} |
| + |
| inline bool CSSSelector::matchesPseudoElement() const |
| { |
| if (m_pseudoType == PseudoUnknown) |