Bug 130369 - [CSS Shapes] shape-margin in percentage units always computes to 0px
Summary: [CSS Shapes] shape-margin in percentage units always computes to 0px
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Bem Jones-Bey
URL:
Keywords:
Depends on:
Blocks: 98664
  Show dependency treegraph
 
Reported: 2014-03-17 16:48 PDT by Rebecca Hauck
Modified: 2014-04-04 10:14 PDT (History)
9 users (show)

See Also:


Attachments
Test case for bug (1.13 KB, text/html)
2014-03-17 16:49 PDT, Rebecca Hauck
no flags Details
ref file #1 for test - uses shape-margin in px units on the same exact shape (1.13 KB, text/html)
2014-03-17 16:50 PDT, Rebecca Hauck
no flags Details
ref file #2 for test - uses simple green square (457 bytes, text/html)
2014-03-17 16:51 PDT, Rebecca Hauck
no flags Details
Patch (11.99 KB, patch)
2014-04-03 16:27 PDT, Bem Jones-Bey
no flags Details | Formatted Diff | Diff

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