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

Unified Diff: Source/core/css/CSSGrammar.y

Issue 330043003: Add support for case-insensitive attribute value selectors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move zero-initialization of m_bits to RareData constructor (explicitly). 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/CSSGrammar.y
diff --git a/Source/core/css/CSSGrammar.y b/Source/core/css/CSSGrammar.y
index d4e782a9589b9caa8e5796ffab0f6e649e8b1de4..ebef4e54950886aa15303539986e85d84b434fc0 100644
--- a/Source/core/css/CSSGrammar.y
+++ b/Source/core/css/CSSGrammar.y
@@ -83,6 +83,7 @@ using namespace HTMLNames;
Vector<OwnPtr<CSSParserSelector> >* selectorList;
CSSSelector::MarginBoxType marginBox;
CSSSelector::Relation relation;
+ CSSSelector::AttributeMatchType attributeMatchType;
MediaQuerySet* mediaList;
MediaQuery* mediaQuery;
MediaQuery::Restrictor mediaQueryRestrictor;
@@ -363,6 +364,9 @@ inline static CSSParserValue makeIdentValue(CSSParserString string)
%type <string> element_name
%type <string> attr_name
+%type <attributeMatchType> attr_match_type
+%type <attributeMatchType> maybe_attr_match_type
+
%type <location> error_location
%type <valueList> ident_list
@@ -1242,26 +1246,40 @@ attr_name:
}
;
+attr_match_type:
+ IDENT maybe_space {
+ CSSSelector::AttributeMatchType attrMatchType = CSSSelector::CaseSensitive;
+ if (!parser->parseAttributeMatchType(attrMatchType, $1))
+ YYERROR;
+ $$ = attrMatchType;
+ }
+ ;
+
+maybe_attr_match_type:
+ attr_match_type
+ | /* empty */ { $$ = CSSSelector::CaseSensitive; }
+ ;
+
attrib:
'[' maybe_space attr_name closing_square_bracket {
$$ = parser->createFloatingSelector();
- $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
+ $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom), CSSSelector::CaseSensitive);
$$->setMatch(CSSSelector::Set);
}
- | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space closing_square_bracket {
+ | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space maybe_attr_match_type closing_square_bracket {
$$ = parser->createFloatingSelector();
- $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom));
+ $$->setAttribute(QualifiedName(nullAtom, $3, nullAtom), $8);
$$->setMatch((CSSSelector::Match)$4);
$$->setValue($6);
}
| '[' maybe_space namespace_selector attr_name closing_square_bracket {
$$ = parser->createFloatingSelector();
- $$->setAttribute(parser->determineNameInNamespace($3, $4));
+ $$->setAttribute(parser->determineNameInNamespace($3, $4), CSSSelector::CaseSensitive);
$$->setMatch(CSSSelector::Set);
}
- | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space closing_square_bracket {
+ | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space maybe_attr_match_type closing_square_bracket {
$$ = parser->createFloatingSelector();
- $$->setAttribute(parser->determineNameInNamespace($3, $4));
+ $$->setAttribute(parser->determineNameInNamespace($3, $4), $9);
$$->setMatch((CSSSelector::Match)$5);
$$->setValue($7);
}

Powered by Google App Engine
This is Rietveld 408576698