mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 07:39:16 +00:00
LibWeb: Support creating ColorResolutionContext from AbstractElement
No functionality changes.
This commit is contained in:
parent
e0e00220fe
commit
db439d224a
Notes:
github-actions[bot]
2025-08-04 10:30:29 +00:00
Author: https://github.com/Calme1709
Commit: db439d224a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5517
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
4 changed files with 31 additions and 0 deletions
|
@ -75,6 +75,20 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ColorResolutionContext ColorResolutionContext::for_element(DOM::AbstractElement const& element)
|
||||
{
|
||||
auto color_scheme = element.computed_properties()->color_scheme(element.document().page().preferred_color_scheme(), element.document().supported_color_schemes());
|
||||
|
||||
CalculationResolutionContext calculation_resolution_context { .length_resolution_context = Length::ResolutionContext::for_element(element) };
|
||||
|
||||
return {
|
||||
.color_scheme = color_scheme,
|
||||
.current_color = element.computed_properties()->color_or_fallback(PropertyID::Color, { color_scheme, CSS::InitialValues::color(), element.document(), calculation_resolution_context }, CSS::InitialValues::color()),
|
||||
.document = element.document(),
|
||||
.calculation_resolution_context = calculation_resolution_context
|
||||
};
|
||||
}
|
||||
|
||||
ColorResolutionContext ColorResolutionContext::for_layout_node_with_style(Layout::NodeWithStyle const& layout_node)
|
||||
{
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue