mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Parse drop-shadow filter with missing or starting color
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
This commit is contained in:
parent
0e9c865805
commit
bd25d0b1b4
Notes:
github-actions[bot]
2024-10-30 11:42:20 +00:00
Author: https://github.com/Gingeh Commit: https://github.com/LadybirdBrowser/ladybird/commit/bd25d0b1b42 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2053 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/gmta ✅
4 changed files with 38 additions and 1 deletions
22
Tests/LibWeb/Screenshot/css-filter-drop-shadow.html
Normal file
22
Tests/LibWeb/Screenshot/css-filter-drop-shadow.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<link rel="match" href="reference/css-filter-drop-shadow-ref.html" />
|
||||
<style>
|
||||
div {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
margin: 10px;
|
||||
background-color: black;
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
<div style="filter: drop-shadow(5px 5px)"></div>
|
||||
<div style="filter: drop-shadow(5px 5px red)"></div>
|
||||
<div style="filter: drop-shadow(red 5px 5px)"></div>
|
||||
<div style="filter: drop-shadow(-5px -5px red)"></div>
|
||||
<div style="filter: drop-shadow(16px)"></div>
|
||||
<div style="filter: drop-shadow()"></div>
|
||||
<div style="filter: drop-shadow(red)"></div>
|
||||
<div style="filter: drop-shadow(5px 5px 5px)"></div>
|
||||
<div style="filter: drop-shadow(red 5px 5px 5px)"></div>
|
||||
<div style="filter: drop-shadow(5px 5px 5px red)"></div>
|
BIN
Tests/LibWeb/Screenshot/images/css-filter-drop-shadow-ref.png
Normal file
BIN
Tests/LibWeb/Screenshot/images/css-filter-drop-shadow-ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,10 @@
|
|||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<img src="../images/css-filter-drop-shadow-ref.png">
|
|
@ -5455,6 +5455,7 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
|||
// Note: The following code is a little awkward to allow the color to be before or after the lengths.
|
||||
Optional<LengthOrCalculated> maybe_radius = {};
|
||||
auto maybe_color = parse_color_value(tokens);
|
||||
tokens.discard_whitespace();
|
||||
auto x_offset = parse_length(tokens);
|
||||
tokens.discard_whitespace();
|
||||
if (!x_offset.has_value() || !tokens.has_next_token())
|
||||
|
@ -5476,8 +5477,12 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
|||
return {};
|
||||
}
|
||||
}
|
||||
Optional<Color> color = {};
|
||||
if (maybe_color)
|
||||
color = maybe_color->to_color({});
|
||||
|
||||
// FIXME: Support calculated offsets and radius
|
||||
return if_no_more_tokens_return(FilterOperation::DropShadow { x_offset->value(), y_offset->value(), maybe_radius.map([](auto& it) { return it.value(); }), maybe_color->to_color({}) });
|
||||
return if_no_more_tokens_return(FilterOperation::DropShadow { x_offset->value(), y_offset->value(), maybe_radius.map([](auto& it) { return it.value(); }), color });
|
||||
} else if (filter_token == FilterToken::HueRotate) {
|
||||
// hue-rotate( [ <angle> | <zero> ]? )
|
||||
if (!tokens.has_next_token())
|
||||
|
|
Loading…
Reference in a new issue