Skip to content

Commit d4246a8

Browse files
mstenshochromium-wpt-export-bot
authored andcommitted
Fieldset: Handle column properties correctly.
Propagate column properties correctly to the anonymous fieldset content box. If column-count or column-width is auto, ComputedStyle's ColumnCount() or ColumnWidth() are 0, respectively. So check if they are non-auto before setting the values on the anonymous content box. At the same time, there's no need to set the properties to their initial values if no multicol is going to take place. Change-Id: I8ec6d69222a9d2359a5d34a08627258362cf8592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368877 Commit-Queue: Morten Stenshorne <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/main@{#1434633}
1 parent d27df94 commit d4246a8

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<title>fieldset multicol with auto count, non-auto width</title>
3+
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<style>
7+
#test { margin: 0; padding: 0; border: none }
8+
#test, #ref { width:min-content; column-count:4; }
9+
p { margin: 0 }
10+
</style>
11+
<fieldset id="test">
12+
<p>1</p>
13+
<p>2</p>
14+
<p>3</p>
15+
<p>4</p>
16+
<p>5</p>
17+
</fieldset>
18+
<div id="ref">
19+
<p>1</p>
20+
<p>2</p>
21+
<p>3</p>
22+
<p>4</p>
23+
<p>5</p>
24+
</div>
25+
<script>
26+
test(() => {
27+
assert_equals(getComputedStyle(document.getElementById('test')).height,
28+
getComputedStyle(document.getElementById('ref')).height);
29+
});
30+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<title>fieldset multicol with auto count, non-auto width</title>
3+
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<style>
7+
#test { margin: 0; padding: 0; border: none }
8+
#test, #ref { width:500px; column-width:100px; }
9+
p { margin: 0 }
10+
</style>
11+
<fieldset id="test">
12+
<p>1</p>
13+
<p>2</p>
14+
<p>3</p>
15+
<p>4</p>
16+
<p>5</p>
17+
</fieldset>
18+
<div id="ref">
19+
<p>1</p>
20+
<p>2</p>
21+
<p>3</p>
22+
<p>4</p>
23+
<p>5</p>
24+
</div>
25+
<script>
26+
test(() => {
27+
assert_equals(getComputedStyle(document.getElementById('test')).height,
28+
getComputedStyle(document.getElementById('ref')).height);
29+
});
30+
</script>

0 commit comments

Comments
 (0)