Revision b5b3c1f0c2c224e863e50ad3f78ed5af0d73981e authored by Morten Stenshorne on 13 March 2018, 11:29:55 UTC, committed by Blink WPT Bot on 13 March 2018, 11:37:14 UTC
If clear is specified on an element whose first piece of content is inside a child (so that the element's BFC offset cannot be determined at the beginning of layout), we need this child to know about the clearance offset on the parent, or it will not be pushed below adjacent floats as it should. Just pushing the parent, but leaving the children unaffected by clearance won't do. We need this in order to be able to lay out in a single pass (and apply clearance when we detect it, rather than doing it on the element with 'clear' and relayout the children if something moved). Since a constraint space's clearance offset is now "inherited" down the tree, as long as we're within the same block formatting context, we now also need to propagate the "is pushed by floats" flag upwards, or we won't detect class C break points correctly. Without this the unit test ClassCBreakPointBeforeBlockMarginCollapsing in NGColumnLayoutAlgorithmTest would regress, because it would incorrectly detect a class C break point before the break-inside:avoid block. We must make sure that class C break points are only detected on the outermost block that got pushed by floats, because it's there that we'll get the gap between the inner edge of the container and the outer edge of the child. Added some tests. One of them fails in legacy (but not in NG). One of the tests, clear-on-child-with-margins.html, passes both with and without this code change, but I started to wonder if we'd suddenly could end up pulling the parent of the box with 'clear' downwards, so thought I better add it, to make sure we don't regress in this regard. The test NoClassCBreakPointBeforeBfc in NGColumnLayoutAlgorithmTest no longer needs its workaround, because the display:flow-root child of #container now sets its position correctly (past the float) right away. Acid2 also looks slightly better now! Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng Change-Id: I732b19398bd43b9874f6bb8c57ce435d1c510754 Reviewed-on: https://chromium-review.googlesource.com/957045 Commit-Queue: Morten Stenshorne <mstensho@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/master@{#542769}
1 parent c7a4bd8
2d.shadow.attributes.shadowOffset.valid.html
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.shadow.attributes.shadowOffset.valid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.shadow.attributes.shadowOffset.valid</h1>
<p class="desc"></p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("");
_addTest(function(canvas, ctx) {
ctx.shadowOffsetX = 1;
ctx.shadowOffsetY = 2;
_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1");
_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2");
ctx.shadowOffsetX = 0.5;
ctx.shadowOffsetY = 0.25;
_assertSame(ctx.shadowOffsetX, 0.5, "ctx.shadowOffsetX", "0.5");
_assertSame(ctx.shadowOffsetY, 0.25, "ctx.shadowOffsetY", "0.25");
ctx.shadowOffsetX = -0.5;
ctx.shadowOffsetY = -0.25;
_assertSame(ctx.shadowOffsetX, -0.5, "ctx.shadowOffsetX", "-0.5");
_assertSame(ctx.shadowOffsetY, -0.25, "ctx.shadowOffsetY", "-0.25");
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
_assertSame(ctx.shadowOffsetX, 0, "ctx.shadowOffsetX", "0");
_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0");
ctx.shadowOffsetX = 1e6;
ctx.shadowOffsetY = 1e6;
_assertSame(ctx.shadowOffsetX, 1e6, "ctx.shadowOffsetX", "1e6");
_assertSame(ctx.shadowOffsetY, 1e6, "ctx.shadowOffsetY", "1e6");
});
</script>
Computing file changes ...