Commit 9f214e08 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Non-"inline" abspos needs to ignore floats and text-indent.

This fixes two tests, but will also eventually benefit
floats-wrap-inside-inline-00[1234].htm in fast/block/float/, which are
currently passing because the absolutely positioned box in the test forces
its container to have block children. There's special-code for NG (which we
should remove) in LayoutBlockFlow::AddChild() that forces this (and causes
other problems).

Added a new test, to make it clear what this fix is about.

Bug: 734554
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ia2c0e0b2ab61999207114fdf935880fabc2e677c
Reviewed-on: https://chromium-review.googlesource.com/1116959Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571054}
parent e5c9261b
......@@ -4,10 +4,6 @@
# Non-interoperable behavior not worth to fix.
crbug.com/591099 fast/text/apply-start-width-after-skipped-text.html [ Skip ]
# Failures due to 'bad' tests. These tests should be removed/change once we've landed LayoutNG.
crbug.com/591099 fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html [ Failure ]
crbug.com/591099 fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html [ Failure ]
# Ref does not match because ref uses tables (old layout) while test does not (NG)
crbug.com/714962 external/wpt/css/css-transforms/transform-abspos-006.html [ Skip ]
crbug.com/714962 external/wpt/css/css-transforms/transform-abspos-007.html [ Skip ]
......
<!DOCTYPE html>
<title>Auto-positioned abspos after text, before float</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="line-height:20px; margin-top:-20px;">
&nbsp;
<div style="position:absolute; width:200px; height:200px; background:green;"></div>
<div style="float:left; margin-top:20px; width:200px; height:200px; background:red;"></div>
</div>
......@@ -449,10 +449,25 @@ bool NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects(
// If a block-level box appears in the middle of a line, move the static
// position to where the next block will be placed.
if (static_offset.inline_offset &&
!box->StyleRef().IsOriginalDisplayInlineType()) {
static_offset.inline_offset = LayoutUnit();
if (!line_box_metrics.IsEmpty())
if (!box->StyleRef().IsOriginalDisplayInlineType()) {
LayoutUnit line_offset;
if (!line_info.IsEmptyLine()) {
line_offset = line_info.LineBfcOffset().line_offset -
ConstraintSpace().BfcOffset().line_offset;
}
if (IsRtl(Style().Direction())) {
LayoutUnit container_inline_size =
ConstraintSpace().AvailableSize().inline_size;
LayoutUnit line_end_offset = line_offset + line_info.AvailableWidth();
line_offset = container_inline_size - line_end_offset;
}
line_offset += line_info.TextIndent();
// We need to subtract the line offset, in order to ignore
// floats and text-indent.
static_offset.inline_offset = -line_offset;
if (child.offset.inline_offset && !line_box_metrics.IsEmpty())
static_offset.block_offset = line_box_metrics.LineHeight();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment