[New Block-Inside-Inline Model] Make sure line breaks occur before and after the...
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 17:42:24 +0000 (17:42 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 17:42:24 +0000 (17:42 +0000)
commit36990d04a9c59180fa4e16b98f9112eb7b99c3a2
treee86cfe85c39a5709a41c015b8d33da073ad0d438
parente5e11433d13708110092b39a06793585ebdddf5d
[New Block-Inside-Inline Model] Make sure line breaks occur before and after the anonymous inline-block.
https://bugs.webkit.org/show_bug.cgi?id=143238.

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/blocks/inside-inlines/breaking-behavior.html (and new-model equivalent).

* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::InlineFlowBox):
(WebCore::InlineFlowBox::hasAnonymousInlineBlock):
(WebCore::InlineFlowBox::setHasAnonymousInlineBlock):
Add a bit to root line boxes (stored in the InlineFlowBox since it has free bits) that indicates whether
or not a line is an anonymous inline-block line.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
Patch the preferred logical width computation to break both before and after an anonymous inline-block.
Also make sure to strip trailing spaces from the line before the anonymous inline-block.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::constructLine):
Patch line construction so that no intermediate boxes are constructed between the InlineBox for the anonymous
inline-block and the root line box.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox):
The height of a "line" that holds an anonymous inline-block should ignore line-box-contain and also make sure
that the margins of the replaced element are "outside" the line, since those margins will collapse.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleReplaced):
Patch handleReplaced to make sure breaks occur both before and after an anonymous inline-block. In the case of
a break after the block, we setPreviousLineBrokeCleanly to true so that <br>s that follow the anonymous inline-block
are respected.

LayoutTests:

* fast/block/inside-inlines/breaking-behavior-expected.html: Added.
* fast/block/inside-inlines/breaking-behavior.html: Added.
* fast/block/inside-inlines/new-model/breaking-behavior-expected.html: Added.
* fast/block/inside-inlines/new-model/breaking-behavior.html: Added.
* fast/block/inside-inlines/new-model/empty-block.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/inside-inlines/breaking-behavior-expected.html [new file with mode: 0644]
LayoutTests/fast/block/inside-inlines/breaking-behavior.html [new file with mode: 0644]
LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior-expected.html [new file with mode: 0644]
LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior.html [new file with mode: 0644]
LayoutTests/fast/block/inside-inlines/new-model/empty-block.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/line/BreakingContext.h