Commit 335bf870 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

[css-typed-om] Add tests for font-size.

Pretty standard test apart from font-size can't be negative.

Bug: 774887
Change-Id: Ieae05dc71c68b5f777d6078e4c9daec0b6eebee4
Reviewed-on: https://chromium-review.googlesource.com/936961
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: default avatarnainar <nainar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542985}
parent be8f7b09
<!doctype html>
<meta charset="utf-8">
<title>'font-size' 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('font-size', [
{
syntax: 'xx-small',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'x-small',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'small',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'medium',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'large',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'x-large',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'xx-large',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'larger',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: 'smaller',
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unit('px', result)
},
]);
</script>
...@@ -494,6 +494,8 @@ ...@@ -494,6 +494,8 @@
getter: "GetSize", getter: "GetSize",
converter: "ConvertFontSize", converter: "ConvertFontSize",
priority: "High", priority: "High",
keywords: ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"],
typedom_types: ["Length", "Percentage"]
}, },
{ {
name: "font-size-adjust", name: "font-size-adjust",
......
...@@ -44,6 +44,8 @@ bool IsValueOutOfRangeForProperty(CSSPropertyID property_id, double value) { ...@@ -44,6 +44,8 @@ bool IsValueOutOfRangeForProperty(CSSPropertyID property_id, double value) {
// For non-length properties and special cases. // For non-length properties and special cases.
switch (property_id) { switch (property_id) {
case CSSPropertyFontSize:
return value < 0;
case CSSPropertyFontWeight: case CSSPropertyFontWeight:
return value < 0 || value > 1000; return value < 0 || value > 1000;
default: default:
......
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