Bug 139013 - Fix the parsing and re-serialization of :lang pseudo class selector when it has multiple arguments with same value
Summary: Fix the parsing and re-serialization of :lang pseudo class selector when it h...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dhi Aurrahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-23 00:53 PST by Dhi Aurrahman
Modified: 2014-11-24 21:26 PST (History)
3 users (show)

See Also:


Attachments
Patch (8.33 KB, patch)
2014-11-23 01:03 PST, Dhi Aurrahman
no flags Details | Formatted Diff | Diff
Patch for landing (7.97 KB, patch)
2014-11-24 19:33 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (7.97 KB, patch)
2014-11-24 19:51 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.