Bug 139013

Summary: Fix the parsing and re-serialization of :lang pseudo class selector when it has multiple arguments with same value
Product: WebKit Reporter: Dhi Aurrahman <diorahman>
Component: New BugsAssignee: Dhi Aurrahman <diorahman>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, diorahman
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing
none
Patch none

Description Dhi Aurrahman 2014-11-23 00:53:03 PST
Fix the parsing and re-serialization of :lang pseudo class css selector when it has multiple arguments with same value
Comment 1 Dhi Aurrahman 2014-11-23 01:03:01 PST
Created attachment 242131 [details]
Patch
Comment 2 Benjamin Poulain 2014-11-24 19:25:03 PST
Comment on attachment 242131 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=242131&action=review

Great catch + great test.

I'll change the loop to an enumerated loop for landing. I think that will make such cases clearer.

> Source/WebCore/css/CSSSelector.cpp:347
> -    const AtomicString& lastArgument = argumentList.last();
> -    for (const AtomicString argument : argumentList) {
> +    const AtomicString* lastArgument = &argumentList.last();
> +    for (const AtomicString& argument : argumentList) {
>          str.append(argument);
> -        if (argument != lastArgument)
> +        if (&argument != lastArgument)
>              str.appendLiteral(", ");
>      }

Great catch, I did not think of this while reviewing.
Comment 3 Benjamin Poulain 2014-11-24 19:33:44 PST
Created attachment 242185 [details]
Patch for landing
Comment 4 Benjamin Poulain 2014-11-24 19:45:17 PST
Comment on attachment 242185 [details]
Patch for landing

Arg, of course I had to mess up the edit :(
Comment 5 Benjamin Poulain 2014-11-24 19:51:31 PST
Created attachment 242186 [details]
Patch
Comment 6 WebKit Commit Bot 2014-11-24 21:26:16 PST
Comment on attachment 242186 [details]
Patch

Clearing flags on attachment: 242186

Committed r176535: <http://trac.webkit.org/changeset/176535>
Comment 7 WebKit Commit Bot 2014-11-24 21:26:19 PST
All reviewed patches have been landed.  Closing bug.