Commit 3f388f1c authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Allow column-width:0.

The spec recently changed from disallowing this to allowing it.
Removed a test that expected it to be disallowed, and wrote new
tests for the new expected behavior.

Bug: 832085
Change-Id: Id6fa0a311fe3f50414c68658d807b99e92acc226
Reviewed-on: https://chromium-review.googlesource.com/1023409Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552770}
parent a5af34fb
<!DOCTYPE html>
<title>column-width:0</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cw" title="3.1. column-width">
<div id="longhand" style="column-width:0;"></div>
<div id="shorthand" style="columns:0;"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_equals(getComputedStyle(longhand).columnWidth, "0px");
assert_equals(getComputedStyle(shorthand).columnWidth, "0px");
}, "column-width:0 is a valid CSS declaration");
</script>
<!DOCTYPE html>
<title>column-width:0</title>
<meta name="assert" content="column-width:0 is valid as specified and computed value, but its used value may never be less than 1px">
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cw" title="3.1. column-width">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<div style="float:left; width:50px; height:100px; column-width:0; column-gap:0;">
<div style="height:5000px; background:green;"></div>
</div>
<div style="float:left; width:50px; height:100px; columns:0; column-gap:0;">
<div style="height:5000px; background:green;"></div>
</div>
Test for column-width property with zero value
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS getComputedStyle(divElement).webkitColumnWidth is "auto"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<style>
#multicolumn
{
display: block;
-moz-column-width: 0;
-o-column-width: 0;
-webkit-column-width: 0;
column-width: 0;
}
</style>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
</head>
<body>
<div id="multicolumn"></div>
</body>
<script>
description("Test for column-width property with zero value");
var divElement = document.getElementById("multicolumn");
shouldBe('getComputedStyle(divElement).webkitColumnWidth', '"auto"');
</script>
</html>
...@@ -1320,8 +1320,7 @@ CSSValue* ConsumeColumnWidth(CSSParserTokenRange& range) { ...@@ -1320,8 +1320,7 @@ CSSValue* ConsumeColumnWidth(CSSParserTokenRange& range) {
// otherwise when used in the 'columns' shorthand property. // otherwise when used in the 'columns' shorthand property.
CSSPrimitiveValue* column_width = CSSPropertyParserHelpers::ConsumeLength( CSSPrimitiveValue* column_width = CSSPropertyParserHelpers::ConsumeLength(
range, kHTMLStandardMode, kValueRangeNonNegative); range, kHTMLStandardMode, kValueRangeNonNegative);
if (!column_width || if (!column_width)
(!column_width->IsCalculated() && column_width->GetDoubleValue() == 0))
return nullptr; return nullptr;
return column_width; return column_width;
} }
......
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