Commit 5bd654a7 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

[css-typed-om] Add support for flex properties.

This patch adds support for flex properties. Failing test because Blink
doesn't support 'content' for flex-basis yet.

Bug: 820299
Change-Id: Ie2df3fcaecda16d52ded1f90aab9f1df82e9e283
Reviewed-on: https://chromium-review.googlesource.com/963865Reviewed-by: default avatarnainar <nainar@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543305}
parent 7ca17c22
This is a testharness.js-based test.
PASS Can set 'flex-basis' to CSS-wide keywords
PASS Can set 'flex-basis' to var() references
PASS Can set 'flex-basis' to the 'auto' keyword
FAIL Can set 'flex-basis' to the 'content' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Can set 'flex-basis' to a length
PASS Can set 'flex-basis' to a percent
PASS Setting 'flex-basis' to a time throws TypeError
PASS Setting 'flex-basis' to a number throws TypeError
PASS Setting 'flex-basis' to a position throws TypeError
PASS Setting 'flex-basis' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'flex-basis' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('flex-basis', [
{ syntax: 'auto' },
{ syntax: 'content' },
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
},
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex-direction' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('flex-direction', [
{ syntax: 'row' },
{ syntax: 'row-reverse' },
{ syntax: 'column' },
{ syntax: 'column-reverse' },
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex-flow' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runUnsupportedPropertyTests('flex-flow', [
'row', 'column wrap', 'row-reverse wrap-reverse'
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex-grow' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('flex-grow', [
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
},
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex-shrink' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('flex-shrink', [
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
},
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex-wrap' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('flex-wrap', [
{ syntax: 'nowrap' },
{ syntax: 'wrap' },
{ syntax: 'wrap-reverse' },
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'flex' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runUnsupportedPropertyTests('flex', [
'auto', '2', '1 30px', '2 2 10%'
]);
</script>
......@@ -1378,12 +1378,15 @@
field_template: "<length>",
default_value: "Length(kAuto)",
converter: "ConvertLengthOrAuto",
typedom_types: ["Keyword", "Length", "Percentage"],
keywords: ["auto"]
},
{
name: "flex-direction",
property_methods: ["CSSValueFromComputedStyleInternal"],
field_group: "*",
field_template: "keyword",
typedom_types: ["Keyword"],
keywords: ["row", "row-reverse", "column", "column-reverse"],
default_value: "row",
},
......@@ -1395,6 +1398,7 @@
field_template: "primitive",
default_value: "0.0f",
type_name: "float",
typedom_types: ["Number"],
},
{
name: "flex-shrink",
......@@ -1404,12 +1408,14 @@
field_template: "primitive",
default_value: "1.0f",
type_name: "float",
typedom_types: ["Number"],
},
{
name: "flex-wrap",
property_methods: ["CSSValueFromComputedStyleInternal"],
field_group: "*",
field_template: "keyword",
typedom_types: ["Keyword"],
keywords: ["nowrap", "wrap", "wrap-reverse"],
default_value: "nowrap",
},
......
......@@ -44,6 +44,8 @@ bool IsValueOutOfRangeForProperty(CSSPropertyID property_id, double value) {
// For non-length properties and special cases.
switch (property_id) {
case CSSPropertyFlexGrow:
case CSSPropertyFlexShrink:
case CSSPropertyFontSize:
return value < 0;
case CSSPropertyFontWeight:
......
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