Commit 60fb096b authored by cathiechen's avatar cathiechen Committed by Commit Bot

List marker_container should be a self-collapsing block.

Marker_container is a zero height anonymous block and marker is its
only child. Marker_container positioned at the side of list content,
it shouldn't break margin collapse.

Gecko already do this.

Change-Id: I8a47605e80eb927165c359a4bfcd66da0f847e4d
Reviewed-on: https://chromium-review.googlesource.com/773766
Commit-Queue: cathie chen <cathiechen@tencent.com>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521290}
parent fb1b81a2
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<ul id="target" style="margin-top:100px;">
<li>
<div style="overflow:hidden; margin-top:100px; height:25px;"><a href="#">xxx</a></div>
</li>
</ul>
<div id="log"></div>
<script>
test(function() {
var height = document.getElementById("target").clientHeight;
assert_equals(height, 25, "the height of ul should be 25px")
}, "list and margin collapse");
</script>
...@@ -387,6 +387,16 @@ bool LayoutBlockFlow::CheckIfIsSelfCollapsingBlock() const { ...@@ -387,6 +387,16 @@ bool LayoutBlockFlow::CheckIfIsSelfCollapsingBlock() const {
if (has_auto_height || ((logical_height_length.IsFixed() || if (has_auto_height || ((logical_height_length.IsFixed() ||
logical_height_length.IsPercentOrCalc()) && logical_height_length.IsPercentOrCalc()) &&
logical_height_length.IsZero())) { logical_height_length.IsZero())) {
// Marker_container should be a self-collapsing block. Marker_container is a
// zero height anonymous block and marker is its only child.
if (logical_height_length.IsFixed() && logical_height_length.IsZero() &&
IsAnonymous() && Parent() && Parent()->IsListItem()) {
LayoutObject* first_child = FirstChild();
if (first_child && first_child->IsListMarker() &&
!first_child->NextSibling())
return true;
}
// If the block has inline children, see if we generated any line boxes. // If the block has inline children, see if we generated any line boxes.
// If we have any line boxes, then we can't be self-collapsing, since we // If we have any line boxes, then we can't be self-collapsing, since we
// have content. // have content.
......
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