Bug 130369

Summary: [CSS Shapes] shape-margin in percentage units always computes to 0px
Product: WebKit Reporter: Rebecca Hauck <rhauck>
Component: CSSAssignee: Bem Jones-Bey <bjonesbe>
Status: RESOLVED FIXED    
Severity: Normal CC: bjonesbe, commit-queue, esprehn+autocc, glenn, gyuyoung.kim, kondapallykalyan, macpherson, menard, zoltan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 98664    
Attachments:
Description Flags
Test case for bug
none
ref file #1 for test - uses shape-margin in px units on the same exact shape
none
ref file #2 for test - uses simple green square
none
Patch none

Description Rebecca Hauck 2014-03-17 16:48:51 PDT
The following shape definition results in at shape-margin: 0px:

-webkit-shape-margin: 10%;
-webkit-shape-outside: inset(40px 100px 40px 0px);

I've attached two ref files to go with the test file - one is with just a simple green square element, the other is with the same shape defined with the shape-margin: 20px, which should be the computed value of the 10% in the test file (containing block is 200px x 200px)
Comment 1 Rebecca Hauck 2014-03-17 16:49:45 PDT
Created attachment 226979 [details]
Test case for bug
Comment 2 Rebecca Hauck 2014-03-17 16:50:41 PDT
Created attachment 226980 [details]
ref file #1 for test - uses shape-margin in px units on the same exact shape
Comment 3 Rebecca Hauck 2014-03-17 16:51:21 PDT
Created attachment 226981 [details]
ref file #2 for test - uses simple green square
Comment 4 Bem Jones-Bey 2014-04-03 16:27:22 PDT
Created attachment 228556 [details]
Patch
Comment 5 Zoltan Horvath 2014-04-03 16:51:46 PDT
Comment on attachment 228556 [details]
Patch

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

> Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:163
> +    float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit());

I like this change! The floatValueForLength will present only here, not in every shape types.
Also, Shape class stores a float, so we won't be passing Length all around!

Looks good to me.
Comment 6 Andreas Kling 2014-04-04 09:41:00 PDT
Comment on attachment 228556 [details]
Patch

r=me
Comment 7 WebKit Commit Bot 2014-04-04 10:14:53 PDT
Comment on attachment 228556 [details]
Patch

Clearing flags on attachment: 228556

Committed r166787: <http://trac.webkit.org/changeset/166787>
Comment 8 WebKit Commit Bot 2014-04-04 10:14:57 PDT
All reviewed patches have been landed.  Closing bug.