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

Issue 252683011: Add support for case-insensitive attribute value selectors (Closed)

Created:
6 years, 7 months ago by Jens Widell
Modified:
6 years, 3 months ago
Reviewers:
eseidel, apavlov, fs, dglazkov, ojan
CC:
blink-reviews, ed+blinkwatch_opera.com, ojan, dglazkov+blink, apavlov+blink_chromium.org, darktears, rune+blink, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Add support for case-insensitive attribute value selectors Selectors Level 4 adds the syntax '*[foo="bar" i]' for making an attribute value selector case-insensitive. Add support for that. BUG=366563

Patch Set 1 #

Patch Set 2 : Fix testcase #

Patch Set 3 : rebased #

Patch Set 4 : add runtime flag; fix selector serializing #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -11 lines) Patch
A LayoutTests/fast/css/attribute-selector-case-insensitive.html View 1 1 chunk +27 lines, -0 lines 0 comments Download
A LayoutTests/fast/css/attribute-selector-case-insensitive-expected.txt View 1 1 chunk +8 lines, -0 lines 0 comments Download
M Source/core/css/CSSGrammar.y View 2 chunks +22 lines, -6 lines 0 comments Download
M Source/core/css/CSSParserValues.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/css/CSSSelector.h View 5 chunks +15 lines, -1 line 5 comments Download
M Source/core/css/CSSSelector.cpp View 1 2 3 3 chunks +5 lines, -1 line 0 comments Download
M Source/core/css/SelectorChecker.cpp View 2 chunks +6 lines, -2 lines 0 comments Download
M Source/core/css/parser/BisonCSSParser.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/parser/BisonCSSParser-in.cpp View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
M Source/platform/RuntimeEnabledFeatures.in View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Jens Widell
Please take a look. First of all: please shout if you think that I should ...
6 years, 7 months ago (2014-04-28 14:12:56 UTC) #1
eseidel
6 years, 7 months ago (2014-04-28 15:40:01 UTC) #2
apavlov
Grammar and Bison parser lgtm
6 years, 7 months ago (2014-04-28 15:58:40 UTC) #3
rune
On 2014/04/28 14:12:56, Jens Lindström wrote: > Please take a look. > > First of ...
6 years, 7 months ago (2014-04-28 19:18:49 UTC) #4
Jens Widell
On 2014/04/28 19:18:49, rune wrote: > On 2014/04/28 14:12:56, Jens Lindström wrote: > > Please ...
6 years, 7 months ago (2014-05-06 14:15:55 UTC) #5
eseidel
If this shoudl only be ASCII case insensitive, then I would recommend that we only ...
6 years, 7 months ago (2014-05-07 18:11:39 UTC) #6
eseidel
https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h File Source/core/css/CSSSelector.h (right): https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h#newcode268 Source/core/css/CSSSelector.h:268: unsigned attributeFlags() const; Can't this return the enum? Normally ...
6 years, 7 months ago (2014-05-07 18:12:58 UTC) #7
eseidel
https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h File Source/core/css/CSSSelector.h (right): https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h#newcode268 Source/core/css/CSSSelector.h:268: unsigned attributeFlags() const; Can't this return the enum? Normally ...
6 years, 7 months ago (2014-05-07 18:12:58 UTC) #8
Jens Widell
On 2014/05/07 18:11:39, eseidel wrote: > If this shoudl only be ASCII case insensitive, then ...
6 years, 7 months ago (2014-05-07 18:17:40 UTC) #9
eseidel
Honestly, I consider this a mis-feature of CSS. I think this is an easy foot-gun ...
6 years, 6 months ago (2014-05-29 00:23:43 UTC) #10
eseidel
Oh, I misread. I guess they're always case sensitive now, this patch is about adding ...
6 years, 6 months ago (2014-05-29 00:24:07 UTC) #11
eseidel
https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h File Source/core/css/CSSSelector.h (right): https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h#newcode346 Source/core/css/CSSSelector.h:346: unsigned m_attributeFlags; // used for attribute selector (with value) ...
6 years, 6 months ago (2014-05-29 00:25:00 UTC) #12
apavlov
https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h File Source/core/css/CSSSelector.h (right): https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelector.h#newcode346 Source/core/css/CSSSelector.h:346: unsigned m_attributeFlags; // used for attribute selector (with value) ...
6 years, 6 months ago (2014-06-11 12:26:19 UTC) #13
fs
6 years, 6 months ago (2014-06-12 16:42:31 UTC) #14
Attempted to resuscitate this at [1] since jl has been otherwise engaged
recently.

[1] https://codereview.chromium.org/330043003/

https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelec...
File Source/core/css/CSSSelector.h (right):

https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelec...
Source/core/css/CSSSelector.h:268: unsigned attributeFlags() const;
On 2014/05/07 18:12:58, eseidel (OOO until June 16) wrote:
> Can't this return the enum?  Normally we store enums as unsigned (bitfields)
but
> cast them to/from their enum type in getters/setters to allow the rest of the
> code to use the compiler's type-safety.

Sure (done in [1]). It doesn't really add much in terms of type-safety though
(all uses as of now imply widening conversions). Having a flag-field with a
single flag might be a bit overkill though =)

https://codereview.chromium.org/252683011/diff/80001/Source/core/css/CSSSelec...
Source/core/css/CSSSelector.h:346: unsigned m_attributeFlags; // used for
attribute selector (with value)
On 2014/06/11 12:26:19, apavlov wrote:
> On 2014/05/29 00:25:01, eseidel (OOO until June 16) wrote:
> > I think we have a ton of CSSSelector objects... I worry this could be bad
for
> > memory?  Ojan would know.
> 
> This is RareData. Consequently, it will be found in a small fraction of all
> CSSSelectors...

Yes, hopefully they are indeed "rare". Disregarding that though there's (at
least) two ways to pack this differently:

1) Move the field to the bitfield in CSSSelector (it's only 1 bit right now, and
there seems to be 10 bits left there).
2) Make a union of this and m_a/m_b.

Both of those will cause some "collateral damage" though
(renaming/initializer-lists/etc.)

Any preference there? ((2) sketched out in [1])

Powered by Google App Engine
This is Rietveld 408576698