Skip to content

Commit

Permalink
[LayoutNG] Auto top/bottom margins may resolve to negative values.
Browse files Browse the repository at this point in the history
The spec doesn't say that auto margin-top or margin-bottom need to
resolve to something non-negative, so just allow negative values as
well. They don't cause over-constrainedness.

Also, when distributing the space to margin-top and margin-bottom, make
sure that everything gets distributed. Set margin-top to the half, and
set margin-bottom to total space MINUS margin-top. Just dividing both by
two might cause us to lose a tiny fraction of the total, due to rounding.

Bug: 888270
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ia10577851e60707a0e2d67857a1c43a12e28b9d2
Reviewed-on: https://chromium-review.googlesource.com/c/1269855
Commit-Queue: Morten Stenshorne <[email protected]>
Reviewed-by: Emil A Eklund <[email protected]>
Reviewed-by: Christian Biesinger <[email protected]>
Reviewed-by: Aleks Totic <[email protected]>
Cr-Commit-Position: refs/heads/master@{#598052}
  • Loading branch information
mstensho authored and chromium-wpt-export-bot committed Oct 9, 2018
1 parent caff176 commit 600cd35
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions css/CSS2/positioning/absolute-non-replaced-height-013.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Auto margin-top and margin-bottom, non-auto everything else</title>
<link rel="author" title="Morten Stenshorne" href="[email protected]">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="position:relative; width:100px; height:100px; background:red;">
<div style="position:absolute; top:50%; bottom:50%; width:100px; height:100px; margin:auto; background:green;"></div>
</div>

0 comments on commit 600cd35

Please sign in to comment.