mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb/CSS: Implement the scrollbar-color property
This allows the user to set the scrollbar thumb and track colors.
This commit is contained in:
committed by
Alexander Kalenik
parent
285bc005cb
commit
e2d0d8e2b9
Notes:
github-actions[bot]
2025-06-01 22:18:57 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/e2d0d8e2b9a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4893
@@ -31,6 +31,7 @@
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ScrollbarColorStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
@@ -1852,6 +1853,22 @@ Vector<CounterData> ComputedProperties::counter_data(PropertyID property_id) con
|
||||
return {};
|
||||
}
|
||||
|
||||
ScrollbarColorData ComputedProperties::scrollbar_color(Layout::NodeWithStyle const& layout_node) const
|
||||
{
|
||||
auto const& value = property(PropertyID::ScrollbarColor);
|
||||
if (value.is_keyword() && value.as_keyword().keyword() == Keyword::Auto)
|
||||
return InitialValues::scrollbar_color();
|
||||
|
||||
if (value.is_scrollbar_color()) {
|
||||
auto& scrollbar_color_value = value.as_scrollbar_color();
|
||||
auto thumb_color = scrollbar_color_value.thumb_color()->to_color(layout_node);
|
||||
auto track_color = scrollbar_color_value.track_color()->to_color(layout_node);
|
||||
return { thumb_color, track_color };
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ScrollbarWidth ComputedProperties::scrollbar_width() const
|
||||
{
|
||||
auto const& value = property(PropertyID::ScrollbarWidth);
|
||||
|
||||
Reference in New Issue
Block a user