Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=249814 #37659

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions css/css-typed-om/the-stylepropertymap/properties/stop-opacity.html
Expand Up @@ -13,7 +13,7 @@
<script>
'use strict';

function assert_is_equal_with_clamping(input, result) {
function assert_is_equal_with_clamping_number(input, result) {
const number = input.to('number');

if (number.value < 0)
Expand All @@ -24,10 +24,25 @@
assert_style_value_equals(result, input);
}

function assert_is_equal_with_clamping_percentage(input, result) {
const number = input.to('percent').value / 100.;

if (number < 0)
assert_style_value_equals(result, new CSSUnitValue(0, 'number'));
else if (number > 1)
assert_style_value_equals(result, new CSSUnitValue(1, 'number'));
else
assert_style_value_equals(result, new CSSUnitValue(number, 'number'));
}

runPropertyTests('stop-opacity', [
{
syntax: '<number>',
computed: assert_is_equal_with_clamping
computed: assert_is_equal_with_clamping_number
},
{
syntax: '<percentage>',
computed: assert_is_equal_with_clamping_percentage
},
]);

Expand Down