Bug 75841 - Extend CSSValueList to allow slash separated lists.
Summary: Extend CSSValueList to allow slash separated lists.
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: Alexis Menard (darktears)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 04:00 PST by Alexis Menard (darktears)
Modified: 2012-01-09 05:48 PST (History)
5 users (show)

See Also:


Attachments
Patch (10.34 KB, patch)
2012-01-09 04:04 PST, Alexis Menard (darktears)
no flags Details | Formatted Diff | Diff
Patch (10.34 KB, patch)
2012-01-09 04:07 PST, Alexis Menard (darktears)
no flags Details | Formatted Diff | Diff
Patch (10.79 KB, patch)
2012-01-09 04:48 PST, Alexis Menard (darktears)
no flags Details | Formatted Diff | Diff
Patch for landing (10.77 KB, patch)
2012-01-09 05:06 PST, Alexis Menard (darktears)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis Menard (darktears) 2012-01-09 04:00:01 PST
Extend CSSValueList to allow slash separated lists.
Comment 1 Alexis Menard (darktears) 2012-01-09 04:04:19 PST
Created attachment 121642 [details]
Patch
Comment 2 Alexis Menard (darktears) 2012-01-09 04:07:54 PST
Created attachment 121643 [details]
Patch
Comment 3 Andreas Kling 2012-01-09 04:29:16 PST
Comment on attachment 121643 [details]
Patch

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

Great solution to the bit shortage, just needs a bit of polish.

> Source/WebCore/css/CSSInitialValue.h:51
> +    bool m_isImplicit : 1;

No need for this to be a bitfield.

> Source/WebCore/css/CSSValue.h:161
> +        , m_valueListSeparator(CommaSeparator)

SpaceSeparator strikes me as a slightly more suitable default value here, since that would make all fields 0 in a newly constructed CSSValue.
The actual value doesn't matter anyway since all CSSValueList constructors overwrite it.

> Source/WebCore/css/CSSValue.h:184
> +    unsigned char m_valueListSeparator : ValueListSeparatorBits; // CSSValueList type

The "// CSSValueList type" comment adds nothing.

> Source/WebCore/css/CSSValueList.cpp:129
> -            if (isSpaceSeparated())
> +            switch (m_valueListSeparator) {
> +            case SpaceSeparator:
>                  result += " ";
> -            else
> +                break;
> +            case CommaSeparator:
>                  result += ", ";
> +                break;
> +            case SlashSeparator:
> +                result += " / ";
> +                break;
> +            default:
> +                ASSERT_NOT_REACHED();
> +            }

There's no need for this to be inside the loop. We can determine the right separator string beforehand and store it in a String.

> Source/WebCore/css/CSSValueList.h:45
> +    static PassRefPtr<CSSValueList> createSlashSeparated()
> +    {
> +        return adoptRef(new CSSValueList(SlashSeparator));
>      }

We shouldn't add a create*() method if we're not going to use it.
Comment 4 Alexis Menard (darktears) 2012-01-09 04:48:28 PST
Created attachment 121646 [details]
Patch
Comment 5 Andreas Kling 2012-01-09 05:00:52 PST
Comment on attachment 121646 [details]
Patch

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

r=me

> Source/WebCore/css/CSSValue.h:183
> +    unsigned char m_valueListSeparator : ValueListSeparatorBits; // CSSValueList type

Unnecessary comment.
Comment 6 Alexis Menard (darktears) 2012-01-09 05:06:01 PST
Created attachment 121648 [details]
Patch for landing
Comment 7 WebKit Review Bot 2012-01-09 05:48:53 PST
Comment on attachment 121648 [details]
Patch for landing

Clearing flags on attachment: 121648

Committed r104452: <http://trac.webkit.org/changeset/104452>
Comment 8 WebKit Review Bot 2012-01-09 05:48:58 PST
All reviewed patches have been landed.  Closing bug.