Commit 34dd20dc authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

[css-lists] Fix marker not correctly updated in legacy layout

If a list item contains a block box, the layout tree is initially like:

  LayoutListItem {LI}
    LayoutBlockFlow (anonymous)
      LayoutListMarker {::marker}
    LayoutBlockFlow {P}
      LayoutText #text

However, an outside ::marker should appear in the same line as the first
non-marker text of the list item. Therefore, it's changed into:

  LayoutListItem {LI}
    LayoutBlockFlow (anonymous)
    LayoutBlockFlow {P}
      LayoutListMarker {::marker}
      LayoutText {#text}

But this was not happening when dynamically toggling list-style-type
between 'none' and some other value. The reason was that there was a
'NormalChildNeedsLayout()' condition, which would hold the 1st time, but
in following layouts it would be false.

This patch just removes that condition.

Bug: 1107783

TEST=external/wpt/css/css-lists/change-list-style-type-002.html

Change-Id: Ic82f1a474b0a0ddf2f2aab8a60afac299aa6e2d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2310359Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#791857}
parent 80e78e5a
......@@ -305,8 +305,7 @@ bool LayoutListItem::UpdateMarkerLocation() {
}
}
if (!marker_parent ||
(marker_parent != line_box_parent && NormalChildNeedsLayout())) {
if (!marker_parent || marker_parent != line_box_parent) {
marker->Remove();
line_box_parent->AddChild(marker, FirstNonMarkerChild(line_box_parent));
// TODO(rhogan): line_box_parent and marker_parent may be deleted by
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Lists: test the change of list-style-type</title>
<link rel="match" href="change-list-style-type-001-ref.html">
<link rel=help href="https://www.w3.org/TR/CSS22/generate.html#lists">
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=966750">
<style type="text/css">
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Lists: test the change of list-style-type</title>
<ol>
<li>text</li>
<li><p>text</p></li>
<li>
<p>text</p>
</li>
<li>
<p></p>
<p>text</p>
</li>
<li>
<div>
<p>text</p>
</div>
</li>
</ol>
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Lists: test the change of list-style-type</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="match" href="change-list-style-type-002-ref.html">
<link rel="help" href="https://www.w3.org/TR/CSS22/generate.html#lists">
<style>
.no-marker li {
list-style-type: none;
}
</style>
<ol>
<li>text</li>
<li><p>text</p></li>
<li>
<p>text</p>
</li>
<li>
<p></p>
<p>text</p>
</li>
<li>
<div>
<p>text</p>
</div>
</li>
</ol>
<script>
// Force layout
document.body.offsetHeight;
// Remove list markers
document.body.className = "no-marker";
// Force layout
document.body.offsetHeight;
// Recover list markers
document.body.className = "";
</script>
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