Commit 80b32be8 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] getComputedStyle("top") percentage on abspos inside inline.

We incorrectly thought that we had no lines, because we looked for
legacy line boxes.

Changed the test to a testharness test, because the text dump has some
space differences between NG and legacy.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ic2ff3b44e222475fcb07700e99f2f0a965fb72ad
Reviewed-on: https://chromium-review.googlesource.com/c/1280546Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599692}
parent e164870c
......@@ -277,7 +277,6 @@ crbug.com/807708 fast/css-intrinsic-dimensions/width-avoid-floats.html [ Failure
crbug.com/591099 fast/css/absolute-inline-alignment-2.html [ Pass ]
crbug.com/591099 fast/css/case-transform.html [ Failure ]
crbug.com/835484 fast/css/focus-ring-recursive-continuations.html [ Failure ]
crbug.com/591099 fast/css/getComputedStyle/computed-style-percentage-top-with-position-inline.html [ Failure ]
crbug.com/835484 fast/css/outline-narrowLine.html [ Failure ]
crbug.com/591099 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under.html [ Failure ]
crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
......
PASS computedStyle.getPropertyValue('top') is "40px"
PASS successfullyParsed is true
TEST COMPLETE
outer inner
......@@ -3,9 +3,12 @@
outer
<div id='inner' style="position:absolute; top:50%; background:blue">inner</div>
</span>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
test(()=> {
var inner = document.querySelector("#inner");
var computedStyle = window.getComputedStyle(inner, null);
shouldBeEqualToString("computedStyle.getPropertyValue('top')", "40px");
assert_equals(computedStyle.getPropertyValue('top'), "40px");
}, "Percentages should be resolved");
</script>
......@@ -4031,11 +4031,8 @@ LayoutUnit LayoutBox::ContainingBlockLogicalHeightForPositioned(
StyleRef().GetPosition()));
const LayoutInline* flow = ToLayoutInline(containing_block);
InlineFlowBox* first = flow->FirstLineBox();
InlineFlowBox* last = flow->LastLineBox();
// If the containing block is empty, return a height of 0.
if (!first || !last)
if (flow->IsEmpty())
return LayoutUnit();
LayoutUnit height_result;
......
......@@ -185,6 +185,10 @@ class CORE_EXPORT LayoutInline : public LayoutBoxModelObject {
NGPaintFragment* FirstInlineFragment() const final;
void SetFirstInlineFragment(NGPaintFragment*) final;
// Return true if this inline doesn't occur on any lines, i.e. when it creates
// no fragments.
bool IsEmpty() const { return !FirstLineBox() && !FirstInlineFragment(); }
LayoutBoxModelObject* VirtualContinuation() const final {
return Continuation();
}
......
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