mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Return the correct computed value for opacity properties
Some checks are pending
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
269d5bb40e
commit
07b3b70a10
Notes:
github-actions[bot]
2025-06-19 08:28:40 +00:00
Author: https://github.com/tcl3
Commit: 07b3b70a10
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5137
Reviewed-by: https://github.com/gmta ✅
4 changed files with 62 additions and 8 deletions
|
@ -1071,6 +1071,22 @@ RefPtr<CSSStyleValue const> CSSStyleProperties::style_value_for_computed_propert
|
|||
|
||||
return get_computed_value(property_id);
|
||||
}
|
||||
case PropertyID::Opacity: {
|
||||
auto opacity = layout_node.computed_values().opacity();
|
||||
return NumberStyleValue::create(opacity);
|
||||
}
|
||||
case PropertyID::FillOpacity: {
|
||||
auto opacity = layout_node.computed_values().fill_opacity();
|
||||
return NumberStyleValue::create(opacity);
|
||||
}
|
||||
case PropertyID::StopOpacity: {
|
||||
auto opacity = layout_node.computed_values().stop_opacity();
|
||||
return NumberStyleValue::create(opacity);
|
||||
}
|
||||
case PropertyID::StrokeOpacity: {
|
||||
auto opacity = layout_node.computed_values().stroke_opacity();
|
||||
return NumberStyleValue::create(opacity);
|
||||
}
|
||||
case PropertyID::OutlineWidth: {
|
||||
auto outline_width = layout_node.computed_values().outline_width();
|
||||
return LengthStyleValue::create(outline_width);
|
||||
|
|
|
@ -54,8 +54,8 @@ cx: 'calc(2px)' -> '2px'
|
|||
cx: 'calc(2px * var(--n))' -> '4px'
|
||||
cy: 'calc(2%)' -> '2%'
|
||||
cy: 'calc(2% * var(--n))' -> 'calc(2 * 2%)'
|
||||
fill-opacity: 'calc(2)' -> '2'
|
||||
fill-opacity: 'calc(2 * var(--n))' -> '4'
|
||||
fill-opacity: 'calc(2)' -> '1'
|
||||
fill-opacity: 'calc(2 * var(--n))' -> '1'
|
||||
filter: 'grayscale(calc(2%))' -> 'grayscale(calc(2%))'
|
||||
filter: 'grayscale(calc(2% * var(--n)))' -> 'grayscale(calc(4%))'
|
||||
filter: 'grayscale(calc(0.02))' -> 'grayscale(calc(0.02))'
|
||||
|
@ -110,8 +110,8 @@ min-height: 'calc(2px)' -> '2px'
|
|||
min-height: 'calc(2px * var(--n))' -> '4px'
|
||||
min-width: 'calc(2%)' -> '2%'
|
||||
min-width: 'calc(2% * var(--n))' -> 'calc(2 * 2%)'
|
||||
opacity: 'calc(2)' -> '2'
|
||||
opacity: 'calc(2 * var(--n))' -> '4'
|
||||
opacity: 'calc(2)' -> '1'
|
||||
opacity: 'calc(2 * var(--n))' -> '1'
|
||||
order: 'calc(2)' -> '2'
|
||||
order: 'calc(2 * var(--n))' -> '4'
|
||||
outline-offset: 'calc(2px)' -> '2px'
|
||||
|
@ -136,10 +136,10 @@ rx: 'calc(2px)' -> '2px'
|
|||
rx: 'calc(2px * var(--n))' -> '4px'
|
||||
ry: 'calc(2%)' -> '2%'
|
||||
ry: 'calc(2% * var(--n))' -> 'calc(2 * 2%)'
|
||||
stop-opacity: 'calc(2)' -> '2'
|
||||
stop-opacity: 'calc(2 * var(--n))' -> '4'
|
||||
stroke-opacity: 'calc(2%)' -> '0.02'
|
||||
stroke-opacity: 'calc(2% * var(--n))' -> '0.04'
|
||||
stop-opacity: 'calc(2)' -> '1'
|
||||
stop-opacity: 'calc(2 * var(--n))' -> '1'
|
||||
stroke-opacity: 'calc(2%)' -> '1'
|
||||
stroke-opacity: 'calc(2% * var(--n))' -> '1'
|
||||
stroke-width: 'calc(2px)' -> '2px'
|
||||
stroke-width: 'calc(2px * var(--n))' -> '4px'
|
||||
tab-size: 'calc(2px)' -> '2px'
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 8 tests
|
||||
|
||||
8 Pass
|
||||
Pass Property opacity value '1'
|
||||
Pass Property opacity value '0.5'
|
||||
Pass Property opacity value '0'
|
||||
Pass Property opacity value '-2'
|
||||
Pass Property opacity value '3'
|
||||
Pass Property opacity value '-100%'
|
||||
Pass Property opacity value '50%'
|
||||
Pass Property opacity value '300%'
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Color Level 3: getComputedStyle().opacity</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/css-color-3/#opacity">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("opacity", "1");
|
||||
test_computed_value("opacity", "0.5");
|
||||
test_computed_value("opacity", "0");
|
||||
test_computed_value("opacity", "-2", "0");
|
||||
test_computed_value("opacity", "3", "1");
|
||||
test_computed_value("opacity", "-100%", "0");
|
||||
test_computed_value("opacity", "50%", "0.5");
|
||||
test_computed_value("opacity", "300%", "1");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue