Bug 124618

Summary: [css shapes] Parse new circle shape syntax
Product: WebKit Reporter: Bem Jones-Bey <bjonesbe>
Component: CSSAssignee: Bem Jones-Bey <bjonesbe>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, eflews.bot, esprehn+autocc, glenn, gtk-ews, gyuyoung.kim, kondapallykalyan, macpherson, menard, philn, rego+ews, rniwa, syoichi, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 124173    
Attachments:
Description Flags
Patch
none
Updated Patch
none
Patch
none
Patch none

Description Bem Jones-Bey 2013-11-19 17:00:32 PST
Implement the parsing of the new circle shape syntax.
Comment 1 Bem Jones-Bey 2013-11-20 10:16:41 PST
Created attachment 217454 [details]
Patch
Comment 2 EFL EWS Bot 2013-11-20 10:22:56 PST
Comment on attachment 217454 [details]
Patch

Attachment 217454 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/30578005
Comment 3 EFL EWS Bot 2013-11-20 10:26:13 PST
Comment on attachment 217454 [details]
Patch

Attachment 217454 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/30548002
Comment 4 Bem Jones-Bey 2013-11-20 10:46:12 PST
The build failures are all because ASSERT_UNREACHED() doesn't do anything in a release build (And I only did a debug build locally). I've fixed it locally by initializing the variable in question, and will upload a new patch with that change (and any potential review feedback) in a bit.
Comment 5 Build Bot 2013-11-20 10:46:54 PST
Comment on attachment 217454 [details]
Patch

Attachment 217454 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/30508009
Comment 6 Antti Koivisto 2013-11-20 10:50:07 PST
Comment on attachment 217454 [details]
Patch

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

ok though i don't really see how the new syntax is better

> Source/WebCore/css/BasicShapeFunctions.cpp:85
> +        return pool.createValue(center.length(), style);

Not really in this patch but we need to get rid of CSSValues that take style. The factoring is just totally wrong. CSSValues are the input for constructing RenderStyle!

> Source/WebCore/css/CSSBasicShapes.cpp:130
> +    char opening[] = "circle(";
> +    char at[] = "at";
> +    char separator[] = " ";
> +    StringBuilder result;
> +    // Compute the required capacity in advance to reduce allocations.
> +    result.reserveCapacity((sizeof(opening) - 1) + (3 * (sizeof(separator) - 1)) + 1 + radius.length() + sizeof(at) + centerX.length() + centerY.length());

There are probably some more modern ways to do this though I don't know what the recommended way is currently.
Comment 7 kov's GTK+ EWS bot 2013-11-20 11:02:30 PST
Comment on attachment 217454 [details]
Patch

Attachment 217454 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/30108016
Comment 8 Bem Jones-Bey 2013-11-20 11:25:41 PST
Created attachment 217460 [details]
Updated Patch
Comment 9 Sergio Correia (qrwteyrutiyoup) 2013-11-20 11:36:41 PST
Comment on attachment 217460 [details]
Updated Patch

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

> Source/WebCore/css/CSSBasicShapes.cpp:177
> +        m_centerY ? m_centerY->serializeResolvingVariables(variables) : String())

, (comma) instead of the last closing parenthesis.
Comment 10 EFL EWS Bot 2013-11-20 11:39:28 PST
Comment on attachment 217460 [details]
Updated Patch

Attachment 217460 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/29858025
Comment 11 kov's GTK+ EWS bot 2013-11-20 11:49:32 PST
Comment on attachment 217460 [details]
Updated Patch

Attachment 217460 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/30658011
Comment 12 Bem Jones-Bey 2013-11-20 11:56:20 PST
(In reply to comment #9)
> (From update of attachment 217460 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=217460&action=review
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:177
> > +        m_centerY ? m_centerY->serializeResolvingVariables(variables) : String())
> 
> , (comma) instead of the last closing parenthesis.

Thanks. I was about to ask why it compiled locally, then I realized that CSS_VARIABLES is turned off on the Mac port.
Comment 13 Bem Jones-Bey 2013-11-20 11:58:35 PST
Created attachment 217462 [details]
Patch

Third time's the charm?
Comment 14 EFL EWS Bot 2013-11-20 12:06:24 PST
Comment on attachment 217462 [details]
Patch

Attachment 217462 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/29708030
Comment 15 EFL EWS Bot 2013-11-20 12:21:04 PST
Comment on attachment 217462 [details]
Patch

Attachment 217462 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/30048042
Comment 16 Bem Jones-Bey 2013-11-20 13:19:42 PST
Created attachment 217471 [details]
Patch

Different warning settings on different ports make me a sad panda. Hopefully this one will pass all the EWS.
Comment 17 WebKit Commit Bot 2013-11-20 14:52:59 PST
Comment on attachment 217471 [details]
Patch

Clearing flags on attachment: 217471

Committed r159585: <http://trac.webkit.org/changeset/159585>
Comment 18 WebKit Commit Bot 2013-11-20 14:53:03 PST
All reviewed patches have been landed.  Closing bug.
Comment 19 Darin Adler 2013-11-20 15:25:04 PST
Comment on attachment 217471 [details]
Patch

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

> Source/WebCore/css/CSSBasicShapes.cpp:130
> +    result.reserveCapacity((sizeof(opening) - 1) + (3 * (sizeof(separator) - 1)) + 1 + radius.length() + sizeof(at) + centerX.length() + centerY.length());

I’m not sure this optimization actually works.

The sizeof(at) part seems wrong.

> Source/WebCore/css/CSSBasicShapes.cpp:131
> +    result.append(opening);

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:137
> +            result.append(separator);

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:138
> +        result.append(at);

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:139
> +        result.append(separator);

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:141
> +        result.append(separator);

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:144
> +    result.append(")");

This needs to use appendLiteral.

> Source/WebCore/css/CSSBasicShapes.cpp:145
> +    if (box.length()) {

This should be !box.isEmpty()

> Source/WebCore/css/CSSBasicShapes.cpp:146
> +        result.append(separator);

This needs to use appendLiteral.
Comment 20 Bem Jones-Bey 2013-11-21 09:31:29 PST
(In reply to comment #19)
> (From update of attachment 217471 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=217471&action=review
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:130
> > +    result.reserveCapacity((sizeof(opening) - 1) + (3 * (sizeof(separator) - 1)) + 1 + radius.length() + sizeof(at) + centerX.length() + centerY.length());
> 
> I’m not sure this optimization actually works.
> 
> The sizeof(at) part seems wrong.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:131
> > +    result.append(opening);
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:137
> > +            result.append(separator);
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:138
> > +        result.append(at);
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:139
> > +        result.append(separator);
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:141
> > +        result.append(separator);
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:144
> > +    result.append(")");
> 
> This needs to use appendLiteral.
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:145
> > +    if (box.length()) {
> 
> This should be !box.isEmpty()
> 
> > Source/WebCore/css/CSSBasicShapes.cpp:146
> > +        result.append(separator);
> 
> This needs to use appendLiteral.

I'm going to create a patch to implement the layout behavior. I'll make these changes in that patch.