mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibGfx: Use CSS sRGB serialization for canvas fill styles
This commit is contained in:
parent
ebd802f6fc
commit
8854bb62c6
Notes:
github-actions[bot]
2025-10-26 17:56:31 +00:00
Author: https://github.com/tcl3
Commit: 8854bb62c6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6593
Reviewed-by: https://github.com/gmta ✅
3 changed files with 35 additions and 3 deletions
|
|
@ -112,9 +112,7 @@ String Color::to_string(HTMLCompatibleSerialization html_compatible_serializatio
|
|||
}
|
||||
|
||||
// Otherwise, for sRGB the CSS serialization of sRGB values is used and for other color spaces, the relevant serialization of the <color> value.
|
||||
if (alpha() < 255)
|
||||
return MUST(String::formatted("rgba({}, {}, {}, {})", red(), green(), blue(), alpha() / 255.0));
|
||||
return MUST(String::formatted("rgb({}, {}, {})", red(), green(), blue()));
|
||||
return serialize_a_srgb_value();
|
||||
}
|
||||
|
||||
String Color::to_string_without_alpha() const
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.fillStyle.get.halftransparent
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas test: 2d.fillStyle.get.halftransparent</title>
|
||||
<script src="../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../../html/canvas/resources/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="../../../../html/canvas/resources/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.fillStyle.get.halftransparent</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
||||
_assertSame(ctx.fillStyle, 'rgba(255, 255, 255, 0.5)', "ctx.fillStyle", "'rgba(255, 255, 255, 0.5)'");
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue