Commit 892c5f8a authored by Joonghun Park's avatar Joonghun Park Committed by Commit Bot

Make font-style's specified unit type to be considered in ComputedStyle.

Before this CL, the number specified as font-style's value
is just passed not considering its unit type.

R=ericwilligers@chromium.org

Bug: 889277
Change-Id: Ifb5be52be5342390c27c4d4905f7d5e424bc2023
Reviewed-on: https://chromium-review.googlesource.com/c/1484958
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635854}
parent 19fa43b6
......@@ -426,7 +426,7 @@ FontSelectionValue StyleBuilderConverterBase::ConvertFontStyle(
CHECK_LT(values->length(), 2u);
if (values->length()) {
return FontSelectionValue(
ToCSSPrimitiveValue(values->Item(0)).GetFloatValue());
ToCSSPrimitiveValue(values->Item(0)).ComputeDegrees());
} else {
const CSSIdentifierValue* identifier_value =
style_range_value.GetFontStyleValue();
......
<!doctype html>
<title>Testing font-style angle's unit type consideration</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-style-prop" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
font-style: oblique 0.785398165rad;
}
</style>
<script>
var test_description = "font-style angle's unit type must be considered";
promise_test(
t => {
return new Promise(test => addEventListener('load', () => test()))
.then(test => assert_equals(getComputedStyle(document.querySelector("body"))['font-style'], "oblique 45deg", "Invalid gCS($(\"body\"))['font-style'];"))
},
test_description
);
</script>
......@@ -30,9 +30,9 @@ PASS Font-style (computed): 'italic' is valid
FAIL Font-style (computed): 'oblique' is valid assert_equals: Font-style computed style: 'oblique' is valid expected "oblique" but got "italic"
FAIL Font-style (computed): 'oblique' followed by zero degrees is valid assert_equals: Font-style computed style: 'oblique' followed by zero degrees is valid expected "oblique 0deg" but got "normal"
FAIL Font-style (computed): 'oblique' followed by positive angle in degrees is valid assert_equals: Font-style computed style: 'oblique' followed by positive angle in degrees is valid expected "oblique 20deg" but got "italic"
FAIL Font-style (computed): 'oblique' followed by positive angle in radians is valid assert_equals: Font-style computed style: 'oblique' followed by positive angle in radians is valid expected "oblique 28.6479deg" but got "oblique 0.5deg"
FAIL Font-style (computed): 'oblique' followed by positive angle in gradians is valid assert_equals: Font-style computed style: 'oblique' followed by positive angle in gradians is valid expected "oblique 18deg" but got "italic"
FAIL Font-style (computed): 'oblique' followed by positive angle in turns is valid assert_equals: Font-style computed style: 'oblique' followed by positive angle in turns is valid expected "oblique 36deg" but got "normal"
FAIL Font-style (computed): 'oblique' followed by positive angle in radians is valid assert_equals: Font-style computed style: 'oblique' followed by positive angle in radians is valid expected "oblique 28.6479deg" but got "oblique 28.5deg"
PASS Font-style (computed): 'oblique' followed by positive angle in gradians is valid
PASS Font-style (computed): 'oblique' followed by positive angle in turns is valid
PASS Font-style (computed): 'oblique' followed by negative angle is valid
PASS Font-style (computed): 'oblique' followed by fractional angle is valid
PASS Font-style (computed): 'oblique' followed by maxumum 90 degree angle is valid
......
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