mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 07:39:16 +00:00
LibWeb: Take a ColorResolutionContext in color_or_fallback
Taking a ColorResolutionContext directly instead of creating one from a layout node allows us to call this from places where we don't have a layout node.
This commit is contained in:
parent
46153910ec
commit
a19a6deaa4
Notes:
github-actions[bot]
2025-08-04 10:30:45 +00:00
Author: https://github.com/Calme1709
Commit: a19a6deaa4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5517
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
3 changed files with 8 additions and 8 deletions
|
@ -224,12 +224,12 @@ LengthBox ComputedProperties::length_box(PropertyID left_id, PropertyID top_id,
|
|||
return box;
|
||||
}
|
||||
|
||||
Color ComputedProperties::color_or_fallback(PropertyID id, Layout::NodeWithStyle const& node, Color fallback) const
|
||||
Color ComputedProperties::color_or_fallback(PropertyID id, ColorResolutionContext color_resolution_context, Color fallback) const
|
||||
{
|
||||
auto const& value = property(id);
|
||||
if (!value.has_color())
|
||||
return fallback;
|
||||
return value.to_color(ColorResolutionContext::for_layout_node_with_style(node)).value();
|
||||
return value.to_color(color_resolution_context).value();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-color-adjust-1/#determine-the-used-color-scheme
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue