Bug 121708 - [CSS Shapes] Determining if a line is inside of a shape should only happen in one place
Summary: [CSS Shapes] Determining if a line is inside of a shape should only happen in...
Status: RESOLVED FIXED
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:
 
Reported: 2013-09-20 13:24 PDT by Bem Jones-Bey
Modified: 2013-11-13 09:45 PST (History)
5 users (show)

See Also:


Attachments
Patch (4.17 KB, patch)
2013-11-12 13:03 PST, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (4.13 KB, patch)
2013-11-12 13:10 PST, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (4.17 KB, patch)
2013-11-13 09:09 PST, 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 Bem Jones-Bey 2013-09-20 13:24:09 PDT
Right now, we are checking if a line is inside a shape both in the ShapeInfo classes and in the Shape classes. And right now, they're not doing is the same thing all the time.

The expected behavior is that both lines and shapes are closed on the top and open on the bottom.

Also, for the purposes of shape-outside, a zero height shape should still affect a line that it intersects. (eg. shapeTop == lineTop).
Comment 1 Hans Muller 2013-11-12 13:03:01 PST
Created attachment 216710 [details]
Patch

The ShapeInfo::lineOverlapsShapeBounds() methods now delegate to the Shape object. The logic for the Shape overlap test is now the same for ShapeInsideInfo and ShapeOutsideInfo.
Comment 2 Hans Muller 2013-11-12 13:10:37 PST
Created attachment 216711 [details]
Patch

Resync'd
Comment 3 Zoltan Horvath 2013-11-13 01:05:01 PST
Comment on attachment 216711 [details]
Patch

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

I like the change. 2 comments from me:

> Source/WebCore/rendering/shapes/Shape.h:90
> +    bool lineOverlapsLayoutRect(LayoutUnit lineTop, LayoutUnit lineHeight, const LayoutRect& rect) const

The naming of this function is a bit confusing to me, because we usually don't include the typename in the function, but rather the functionality. What do you think about lineOverlapsRectangle or lineOverlapsBoundingBox?

> Source/WebCore/rendering/shapes/Shape.h:92
> +        return !rect.isEmpty() && ((lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!lineHeight && lineTop == rect.y()));

I would early return false for rect.isEmpty then the second part of the condition would be more straightforward in its own line.
Comment 4 Hans Muller 2013-11-13 09:09:17 PST
Created attachment 216809 [details]
Patch

Made the suggested changes.
Comment 5 WebKit Commit Bot 2013-11-13 09:45:28 PST
Comment on attachment 216809 [details]
Patch

Clearing flags on attachment: 216809

Committed r159205: <http://trac.webkit.org/changeset/159205>
Comment 6 WebKit Commit Bot 2013-11-13 09:45:30 PST
All reviewed patches have been landed.  Closing bug.