Commit 5c147780 authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

[css-pseudo] Fix text autosizer for non-normal legacy list markers

This patch fixes legacy list markers so that they are autosized even if
their 'content' property is set to something different than 'normal'.

Bug: 457718

TEST=fast/text-autosizing/list-marker-numbered-with-content-and-autosizing.html

Change-Id: I32360a2868b41cfd4d055b3b7efcd73fb9b5adee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2258732
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786065}
parent aff9e4c8
......@@ -45,7 +45,6 @@
#include "third_party/blink/renderer/core/layout/layout_block.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_list_item.h"
#include "third_party/blink/renderer/core/layout/layout_list_marker.h"
#include "third_party/blink/renderer/core/layout/layout_multi_column_flow_thread.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_run.h"
#include "third_party/blink/renderer/core/layout/layout_table.h"
......@@ -444,6 +443,9 @@ float TextAutosizer::Inflate(LayoutObject* parent,
child = ToLayoutRubyRun(run)->FirstChild();
behavior = kDescendToInnerBlocks;
}
} else if (parent->IsListMarker()) {
// The list item already applied the multiplier to the marker, keep it.
return multiplier;
} else if (parent->IsLayoutBlock() &&
(parent->ChildrenInline() || behavior == kDescendToInnerBlocks)) {
child = To<LayoutBlock>(parent)->FirstChild();
......
<!DOCTYPE html>
<html style="font-size: 16px">
<head>
<meta name="viewport" content="width=800">
<style>
body {
width: 800px;
margin: 0;
overflow-y: hidden;
overflow-x: hidden;
}
li {
font-size: 2.5rem;
}
</style>
</head>
<body>
<div style="font-size: 2.5rem">
The below list markers should be autosized to 40px computed font-size (16 * 800/320).
</div>
<ol>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>plain text</li>
<li><a href='#'>hyperlinked</a></li>
<li><a href='#'>hyperlinked</a> example</li>
<li><em>emphasized</em></li>
<li><em>emphasized</em> example</li>
<li><b>bold</b></li>
<li><b>bold</b> example</li>
<li><i>italic</i></li>
<li><i>italic</i> example</li>
<li><del>strikethrough</del></li>
<li><del>strikethrough</del> example</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html style="font-size: 16px">
<head>
<meta name="viewport" content="width=800">
<style>
body {
width: 800px;
margin: 0;
overflow-y: hidden;
overflow-x: hidden;
}
::marker {
content: counter(list-item) '. ';
}
</style>
<script src="resources/autosizingTest.js"></script>
</head>
<body>
<div>
The below list markers should be autosized to 40px computed font-size (16 * 800/320).
</div>
<ol>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>plain text</li>
<li><a href='#'>hyperlinked</a></li>
<li><a href='#'>hyperlinked</a> example</li>
<li><em>emphasized</em></li>
<li><em>emphasized</em> example</li>
<li><b>bold</b></li>
<li><b>bold</b> example</li>
<li><i>italic</i></li>
<li><i>italic</i> example</li>
<li><del>strikethrough</del></li>
<li><del>strikethrough</del> example</li>
</ol>
</body>
</html>
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