mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Stop passing Realm unnecessarily to parse CSS properties
Also use the parse_css_value() helper in cases where we previously constructed a Parser manually.
This commit is contained in:
parent
ee9db99961
commit
bc77f84359
Notes:
github-actions[bot]
2024-12-05 19:00:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: bc77f84359
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2783
11 changed files with 20 additions and 46 deletions
|
@ -806,14 +806,10 @@ String CanvasRenderingContext2D::shadow_color() const
|
|||
|
||||
void CanvasRenderingContext2D::set_shadow_color(String color)
|
||||
{
|
||||
auto& realm = static_cast<CanvasRenderingContext2D&>(*this).realm();
|
||||
|
||||
// 1. Let context be this's canvas attribute's value, if that is an element; otherwise null.
|
||||
auto parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), color);
|
||||
|
||||
auto style_value = parser.parse_as_css_value(CSS::PropertyID::Color);
|
||||
|
||||
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
|
||||
auto style_value = parse_css_value(CSS::Parser::ParsingContext(), color, CSS::PropertyID::Color);
|
||||
if (style_value && style_value->has_color()) {
|
||||
auto parsedValue = style_value->to_color(OptionalNone());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue