[CSS Exclusions] shape-inside line segment layout should be based on line position and height
https://bugs.webkit.org/show_bug.cgi?id=95479

Patch by Bear Travis <betravis@adobe.com> on 2012-09-25
Reviewed by Levi Weintraub.

Source/WebCore:

This patch adds line height to line top to calculate line segments using the line's upper
and lower logical edges. The last line in a shape is allowed to overflow the shape,
using line top and shape bottom to calculate the available line segments. Overflow
behavior will develop in greater detail as the specification advances. For more on
overflow, see:
- http://dev.w3.org/csswg/css3-exclusions/#shape-inside-property and
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=16460

As more shapes are added, line positions within a shape are no longer guaranteed to
have segments (eg, the first line in a circular shape inside), and so many instances
of lineState were replaced with hasSegments. Layout code also uses lineOverlapsShapeBounds
rather than lineState, now that lines may partially overlap a shape without being
completely contained by it. Because layout begins at the shape's logical top, however,
we only run into this edge case laying out the last line within a shape-inside.

Test: fast/exclusions/shape-inside/shape-inside-rounded-rectangle.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::LineWidth): Use WrapShapeInfo::hasSegments rather than
WrapShapeInfo::lineState, as line positions within a shape are no longer
guaranteed to always have line segments.
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): Ditto.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange): Pass lineBottom as well as lineTop
to computeSegmentsForLine.
* rendering/WrapShapeInfo.cpp:
(WebCore::WrapShapeInfo::computeSegmentsForLine): Pass lineBottom as well as lineTop
to ExclusionShape::getInsideIntervals.
* rendering/WrapShapeInfo.h:
(WrapShapeInfo):
(WebCore::WrapShapeInfo::shapeLogicalBottom): Calculate the logical bottom of an
Exclusion Shape.
(WebCore::WrapShapeInfo::hasSegments): Allow hasSegments to be called even when
a line does not overlap a shape.
(WebCore::WrapShapeInfo::lineOverlapsShapeBounds): Test whether a line's top/bottom
overlap a shape's top/bottom. This includes lines that begin before or end after
a shape but still overlap it.

LayoutTests:

Test that line bottom as well as line top is used when calculating line segments
for a rounded rectangle.

* fast/exclusions/shape-inside/shape-inside-rounded-rectangle-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-rounded-rectangle.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Forms] We should disconnect DateTimeEditElement and DateTimeFieldElement on layout()
https://bugs.webkit.org/show_bug.cgi?id=97438

Reviewed by Kent Tamura.

This patch is for code cleanup. It is better to disconnect DateTimeFieldElement
from DateTimeEditElement when DateTimeEditElement doesn't have
pointers to DateTimeFieldElement.

No new tests. This patch doesn't change behavior.

* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditElement::resetFields): Changed to call DateTimeFieldElement::removeEventHandler()
for existing fields to disconnect DateTimeEditElement and DateTimeFieldElement.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129591 268f45cc-cd09-0410-ab3c-d52691b4dbfc