Bug 127785

Summary: [CSS Shapes] Adjust inset sizing syntax to the latest spec
Product: WebKit Reporter: Zoltan Horvath <zoltan>
Component: CSSAssignee: Zoltan Horvath <zoltan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, gyuyoung.kim, macpherson, menard
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 124173    
Attachments:
Description Flags
Patch
none
Patch
none
Patch - linear parsing logic and less variable assignments
none
Patch - linear parsing logic and less variable assignments none

Description Zoltan Horvath 2014-01-28 11:31:02 PST
According to the latest CSS Shapes specification [1], the width arguments of inset should follow the syntax of the margin shorthand, which let us set all four insets with one, two or four values.
This patch updates the behavior and updates the affected tests.

[1] http://dev.w3.org/csswg/css-shapes/#funcdef-inset
Comment 1 Zoltan Horvath 2014-01-28 11:35:23 PST
Created attachment 222469 [details]
Patch
Comment 2 Bem Jones-Bey 2014-01-28 11:47:07 PST
Comment on attachment 222469 [details]
Patch

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

> Source/WebCore/css/CSSParser.cpp:5409
> +    if (widthArguments.size() == 1) {

I think a switch would be more readable here.

> Source/WebCore/css/CSSParser.cpp:5422
> +        shape->setBottom(widthArguments[2]);

You need to set Left here, and double check your tests, if this passed, you missed a test.
Comment 3 Bem Jones-Bey 2014-01-28 11:48:27 PST
Comment on attachment 222469 [details]
Patch

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

> LayoutTests/fast/shapes/parsing/parsing-test-utils.js:19
>      ["inset(10px 9px 8px)", "inset(10px 9px 8px)", "inset(10px 9px 8px 0px round 0px 0px 0px 0px / 0px 0px 0px 0px)"],

Here's the wrong test!
Comment 4 Zoltan Horvath 2014-01-28 14:01:32 PST
Created attachment 222483 [details]
Patch

(In reply to comment #2)
> (From update of attachment 222469 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=222469&action=review
> 
> > Source/WebCore/css/CSSParser.cpp:5409
> > +    if (widthArguments.size() == 1) {
> 
> I think a switch would be more readable here.

I modified to use switch.

> > Source/WebCore/css/CSSParser.cpp:5422
> > +        shape->setBottom(widthArguments[2]);
> 
> You need to set Left here, and double check your tests, if this passed, you missed a test.

That behavior was the expected in my mind. :( I added the corrected case and I modified the affected test.
Comment 5 Zoltan Horvath 2014-01-28 15:20:54 PST
Created attachment 222505 [details]
Patch - linear parsing logic and less variable assignments
Comment 6 Zoltan Horvath 2014-01-28 16:10:15 PST
Created attachment 222526 [details]
Patch - linear parsing logic and less variable assignments
Comment 7 Bem Jones-Bey 2014-01-28 16:23:09 PST
Comment on attachment 222526 [details]
Patch - linear parsing logic and less variable assignments

r=me
Comment 8 WebKit Commit Bot 2014-01-28 17:17:43 PST
Comment on attachment 222526 [details]
Patch - linear parsing logic and less variable assignments

Clearing flags on attachment: 222526

Committed r162989: <http://trac.webkit.org/changeset/162989>
Comment 9 WebKit Commit Bot 2014-01-28 17:17:45 PST
All reviewed patches have been landed.  Closing bug.