mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00: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:
parent
285bc005cb
commit
e2d0d8e2b9
Notes:
github-actions[bot]
2025-06-01 22:18:57 +00:00
Author: https://github.com/tcl3
Commit: e2d0d8e2b9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4893
24 changed files with 212 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue