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

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: Make union w/ m_attributeFlags and nth-state; Return enum type. Created 6 years, 6 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 da24b51feaf8dc22c402752991b4d71254c48439..d36acdea2ed40967a57bf9475b7b6bffdec86dcf 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -238,6 +238,11 @@ namespace WebCore {
RightBottomMarginBox,
};
+ enum AttributeFlags {
+ NoAttributeFlags,
+ CaseInsensitive,
+ };
+
PseudoType pseudoType() const
{
if (m_pseudoType == PseudoNotParsed)
@@ -261,6 +266,7 @@ namespace WebCore {
// 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; }
@@ -271,7 +277,7 @@ namespace WebCore {
#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();
@@ -346,8 +352,14 @@ namespace WebCore {
bool matchNth(int count);
AtomicString m_value;
- int m_a; // Used for :nth-*
- int m_b; // Used for :nth-*
+ union Bits {
+ Bits() : m_nth() { }
+ 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
@@ -372,6 +384,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)

Powered by Google App Engine
This is Rietveld 408576698