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

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

Issue 330043003: Add support for case-insensitive attribute value selectors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Flags -> enum. add accessors for nth. Created 6 years, 5 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: Source/core/css/CSSSelector.h
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 176bc34a69f32f0362996dd870d74e22f0ef850d..079ca89056f1b027a5adb8505bf3a5778b3dac34 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -239,6 +239,11 @@ namespace blink {
RightBottomMarginBox,
};
+ enum AttributeMatchType {
+ CaseSensitive,
+ 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;
+ AttributeMatchType attributeMatchType() 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&, AttributeMatchType);
void setArgument(const AtomicString&);
void setSelectorList(PassOwnPtr<CSSSelectorList>);
void setMatchUserAgentOnly();
@@ -344,10 +350,20 @@ namespace blink {
bool parseNth();
bool matchNth(int count);
+ int nthAValue() const { return m_bits.m_nth.m_a; }
+ void setNthAValue(int nthA) { m_bits.m_nth.m_a = nthA; }
+ int nthBValue() const { return m_bits.m_nth.m_b; }
+ void setNthBValue(int nthB) { m_bits.m_nth.m_b = nthB; }
AtomicString m_value;
- int m_a; // Used for :nth-*
- int m_b; // Used for :nth-*
+ union Bits {
+ Bits() : m_nth() { }
eseidel 2014/07/30 20:12:41 How does this initailize to zeros? Do structs hav
fs 2014/07/31 09:27:15 This boils down to "value-initialize" vs. "default
+ struct {
+ int m_a; // Used for :nth-*
+ int m_b; // Used for :nth-*
+ } m_nth;
+ AttributeMatchType m_attributeMatchType; // 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
@@ -372,6 +388,13 @@ inline const QualifiedName& CSSSelector::attribute() const
return m_data.m_rareData->m_attribute;
}
+inline CSSSelector::AttributeMatchType CSSSelector::attributeMatchType() const
+{
+ ASSERT(isAttributeSelector());
+ ASSERT(m_hasRareData);
+ return m_data.m_rareData->m_bits.m_attributeMatchType;
+}
+
inline bool CSSSelector::matchesPseudoElement() const
{
if (m_pseudoType == PseudoUnknown)

Powered by Google App Engine
This is Rietveld 408576698