Bug 95490 - [CSS Exclusions] add support for the basic shapes
Summary: [CSS Exclusions] add support for the basic shapes
Status: RESOLVED DUPLICATE of bug 95625
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hans Muller
URL:
Keywords:
Depends on:
Blocks: 89707
  Show dependency treegraph
 
Reported: 2012-08-30 13:01 PDT by Hans Muller
Modified: 2012-08-31 16:53 PDT (History)
10 users (show)

See Also:


Attachments
Patch (56.45 KB, patch)
2012-08-30 13:28 PDT, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (61.39 KB, patch)
2012-08-30 15:31 PDT, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (60.26 KB, patch)
2012-08-31 10:25 PDT, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (59.79 KB, patch)
2012-08-31 11:50 PDT, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (59.78 KB, patch)
2012-08-31 13:50 PDT, Hans Muller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Muller 2012-08-30 13:01:57 PDT
Initial support for the shapes listed in the "Basic Shapes" section of the CSS Exclusions spec - http://dev.w3.org/csswg/css3-exclusions/#basic-shapes-from-svg-syntax.
Comment 1 Hans Muller 2012-08-30 13:28:44 PDT
Created attachment 161541 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-30 13:46:53 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13680864
Comment 3 Early Warning System Bot 2012-08-30 13:49:26 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/13682855
Comment 4 Gyuyoung Kim 2012-08-30 13:50:37 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13680863
Comment 5 Early Warning System Bot 2012-08-30 14:53:22 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/13681854
Comment 6 Build Bot 2012-08-30 14:56:08 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13694823
Comment 7 Peter Beverloo (cr-android ews) 2012-08-30 15:24:57 PDT
Comment on attachment 161541 [details]
Patch

Attachment 161541 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/13699008
Comment 8 Hans Muller 2012-08-30 15:31:14 PDT
Created attachment 161573 [details]
Patch
Comment 9 Hans Muller 2012-08-30 15:37:48 PDT
(In reply to comment #8)
Added the new  filenames to five WebCore build files (they'd already been added to the XCode project).  Hopefully that's all of them.
Comment 10 Build Bot 2012-08-30 16:00:35 PDT
Comment on attachment 161573 [details]
Patch

Attachment 161573 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13683938
Comment 11 Bear Travis 2012-08-30 17:04:35 PDT
Here's a first pass over the code. I have not yet taken a really good look at the geometry algorithms, so comments on those will follow later.

> Source/WebCore/ChangeLog:31
> +        (WebCore::IntervalX1Comparator::operator()):

For a patch this large, you will probably need to write function-level comments (full-sentences) for each of the ChangeLog entries. You may be able to hold off a while if you anticipate large-scale architecture changes during the review process.

> Source/WebCore/platform/graphics/XSInterval.cpp:1
> +/*

I think XS is not the most descriptive prefix. ExclusionShape is probably a little too long. BasicShape, or just Shape? What classes are we most worried about naming collisions with?

> Source/WebCore/platform/graphics/XSInterval.cpp:37
> +struct IntervalX1Comparator {

Would the name XSIntervalComparator be more appropriate?

> Source/WebCore/platform/graphics/XSInterval.cpp:45
> +{  

WebKit code leans towards full-word variable names:
http://www.webkit.org/coding/coding-style.html#names-full-words
Perhaps other and result?

> Source/WebCore/platform/graphics/XSInterval.cpp:70
> +        for (size_t i = 0; i < v.size(); i++) {

Think I'm reading this right. Since interval is only null on the first pass, and v is guaranteed to have at least one element, I think this can change to:
ASSERT(v.size());
interval = &v[0];
for (size_t i = 1; ... ; ... )

> Source/WebCore/platform/graphics/XSInterval.cpp:71
> +            if (!interval)

If the above is correct, you can remove this case

> Source/WebCore/platform/graphics/XSInterval.cpp:81
> +        if (interval)

And this null-check, and just append the interval.

> Source/WebCore/platform/graphics/XSPolygon.h:1
> +/*

Because the patch is already large, and we aren't testing Polygons yet, I would recommend removing the Polygon files and add them in a subsequent patch.

> Source/WebCore/platform/graphics/XSRectangle.cpp:35
> +// See http://hansmuller-webkit.blogspot.com/2012/07/computing-horizonal-rounded-rectangle.html

I would remove the blog reference in the file, and place it in the bug or the ChangeLog.

> Source/WebCore/platform/graphics/XShape.cpp:103
> +    case BasicShape::BASIC_SHAPE_POLYGON: {

If you remove Polygon, this can be changed to notImplemented()

> Source/WebCore/platform/graphics/XShape.cpp:115
> +    default:

Removing the default case adds a compile-time check that each shape case is covered. The ASSERT_NOT_REACHED can then be below the switch statement.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1325
> +        if (wrapShapeInfo) {

I would change this back to the original form (no lineHeight), and add that in a subsequent patch.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1327
> +            LayoutUnit lineBottom = lineTop + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);

"true" should be replaced with layoutState.lineInfo().isFirstLine()

> Source/WebCore/rendering/WrapShapeInfo.cpp:-108
> -

Whitespace removed

> Source/WebCore/rendering/WrapShapeInfo.cpp:114
> +bool WrapShapeInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineBottom)

Leave the signature on this as just lineTop, until you use lineBottom

> Source/WebCore/rendering/WrapShapeInfo.h:81
> +    bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineBottom);

Ditto
Comment 12 Hans Muller 2012-08-31 07:58:48 PDT
(In reply to comment #11)
> > Source/WebCore/platform/graphics/XSInterval.cpp:1
> > +/*
> 
> I think XS is not the most descriptive prefix. ExclusionShape is probably a little too long. BasicShape, or just Shape? What classes are we most worried about naming collisions with?

Since the classes are intended to (just) support operations required by CSS Exclusions, I don't 
think a generic prefix like "Shape" would make sense.  BasicShape (nee WrapShape) has already 
been used as the name of the class that just encodes the CSS information.  ExclusionShape is 
what "XS" is short for.  I was reluctant replace the abbreviation because names like 
ExclusionShapeIntervalX1Comparator are pretty clunky.

> 
> > Source/WebCore/platform/graphics/XSInterval.cpp:37
> > +struct IntervalX1Comparator {
> 
> Would the name XSIntervalComparator be more appropriate?

No, that would obscure the important fact that XSInterval's "x1" field is what's being compared.


> > Source/WebCore/platform/graphics/XSInterval.cpp:45
> > +{  
> 
> WebKit code leans towards full-word variable names:
> http://www.webkit.org/coding/coding-style.html#names-full-words
> Perhaps other and result?

Yes, that would probably be more coding-style compliant.


> > Source/WebCore/platform/graphics/XSInterval.cpp:70
> > +        for (size_t i = 0; i < v.size(); i++) {
> 
> Think I'm reading this right. Since interval is only null on the first pass, and v is guaranteed to have at least one element, I think this can change to:
> ASSERT(v.size());
> interval = &v[0];
> for (size_t i = 1; ... ; ... )

What you mean is that v is guaranteed to have two elements.  In that case, yes the code could be refactored as you've suggested.
Comment 13 Hans Muller 2012-08-31 10:25:39 PDT
Created attachment 161726 [details]
Patch
Comment 14 Build Bot 2012-08-31 10:46:41 PDT
Comment on attachment 161726 [details]
Patch

Attachment 161726 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13719249
Comment 15 Hans Muller 2012-08-31 11:50:08 PDT
Created attachment 161744 [details]
Patch

Fixed an uninitialized variable problem that the windows compiler was complaining about; removed extraneous trailing white space in the new files.
Comment 16 Build Bot 2012-08-31 12:22:08 PDT
Comment on attachment 161744 [details]
Patch

Attachment 161744 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13698022
Comment 17 Hans Muller 2012-08-31 13:50:43 PDT
Created attachment 161764 [details]
Patch

Eliminated a dead code path in XShape::createXShape() that caused an error in the Windows build.
Comment 18 Hans Muller 2012-08-31 16:53:19 PDT

*** This bug has been marked as a duplicate of bug 95625 ***