mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-22 10:11:54 +00:00
LibWeb/CSS: Implement the caret-color
property
This commit is contained in:
parent
bf15b7ac12
commit
88d35c547c
Notes:
github-actions[bot]
2025-03-09 18:37:22 +00:00
Author: https://github.com/tcl3
Commit: 88d35c547c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3876
16 changed files with 381 additions and 218 deletions
|
@ -832,6 +832,18 @@ Float ComputedProperties::float_() const
|
|||
return keyword_to_float(value.to_keyword()).release_value();
|
||||
}
|
||||
|
||||
Color ComputedProperties::caret_color(Layout::NodeWithStyle const& node) const
|
||||
{
|
||||
auto const& value = property(PropertyID::CaretColor);
|
||||
if (value.is_keyword() && value.to_keyword() == Keyword::Auto)
|
||||
return node.computed_values().color();
|
||||
|
||||
if (value.has_color())
|
||||
return value.to_color(node);
|
||||
|
||||
return InitialValues::caret_color();
|
||||
}
|
||||
|
||||
Clear ComputedProperties::clear() const
|
||||
{
|
||||
auto const& value = property(PropertyID::Clear);
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
Clip clip() const;
|
||||
Display display() const;
|
||||
Float float_() const;
|
||||
Color caret_color(Layout::NodeWithStyle const&) const;
|
||||
Clear clear() const;
|
||||
ColumnSpan column_span() const;
|
||||
struct ContentDataAndQuoteNestingLevel {
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
static CSS::Float float_() { return CSS::Float::None; }
|
||||
static CSS::Length border_spacing() { return CSS::Length::make_px(0); }
|
||||
static CSS::CaptionSide caption_side() { return CSS::CaptionSide::Top; }
|
||||
static Color caret_color() { return Color::Black; }
|
||||
static CSS::Clear clear() { return CSS::Clear::None; }
|
||||
static CSS::Clip clip() { return CSS::Clip::make_auto(); }
|
||||
static CSS::PreferredColorScheme color_scheme() { return CSS::PreferredColorScheme::Auto; }
|
||||
|
@ -374,6 +375,7 @@ public:
|
|||
CSS::Length border_spacing_horizontal() const { return m_inherited.border_spacing_horizontal; }
|
||||
CSS::Length border_spacing_vertical() const { return m_inherited.border_spacing_vertical; }
|
||||
CSS::CaptionSide caption_side() const { return m_inherited.caption_side; }
|
||||
Color caret_color() const { return m_inherited.caret_color; }
|
||||
CSS::Clear clear() const { return m_noninherited.clear; }
|
||||
CSS::Clip clip() const { return m_noninherited.clip; }
|
||||
CSS::PreferredColorScheme color_scheme() const { return m_inherited.color_scheme; }
|
||||
|
@ -555,6 +557,7 @@ public:
|
|||
|
||||
protected:
|
||||
struct {
|
||||
Color caret_color { InitialValues::caret_color() };
|
||||
RefPtr<Gfx::FontCascadeList> font_list {};
|
||||
CSSPixels font_size { InitialValues::font_size() };
|
||||
int font_weight { InitialValues::font_weight() };
|
||||
|
@ -744,6 +747,7 @@ public:
|
|||
}
|
||||
|
||||
void set_aspect_ratio(AspectRatio aspect_ratio) { m_noninherited.aspect_ratio = move(aspect_ratio); }
|
||||
void set_caret_color(Color caret_color) { m_inherited.caret_color = caret_color; }
|
||||
void set_font_list(NonnullRefPtr<Gfx::FontCascadeList> font_list) { m_inherited.font_list = move(font_list); }
|
||||
void set_font_size(CSSPixels font_size) { m_inherited.font_size = font_size; }
|
||||
void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }
|
||||
|
|
|
@ -818,6 +818,18 @@
|
|||
"caption-side"
|
||||
]
|
||||
},
|
||||
"caret-color": {
|
||||
"affects-layout": false,
|
||||
"animation-type": "by-computed-value",
|
||||
"inherited": true,
|
||||
"initial": "auto",
|
||||
"valid-identifiers": [
|
||||
"auto"
|
||||
],
|
||||
"valid-types": [
|
||||
"color"
|
||||
]
|
||||
},
|
||||
"clear": {
|
||||
"animation-type": "discrete",
|
||||
"inherited": false,
|
||||
|
|
|
@ -203,7 +203,7 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
|
|||
// -> border-right-color
|
||||
// -> border-top-color
|
||||
// -> box-shadow
|
||||
// FIXME: -> caret-color
|
||||
// -> caret-color
|
||||
// -> color
|
||||
// -> outline-color
|
||||
// -> A resolved value special case property like color defined in another specification
|
||||
|
@ -220,6 +220,8 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
|
|||
return CSSColorValue::create_from_color(layout_node.computed_values().border_top().color, ColorSyntax::Modern);
|
||||
case PropertyID::BoxShadow:
|
||||
return style_value_for_shadow(layout_node.computed_values().box_shadow());
|
||||
case PropertyID::CaretColor:
|
||||
return CSSColorValue::create_from_color(layout_node.computed_values().caret_color(), ColorSyntax::Modern);
|
||||
case PropertyID::Color:
|
||||
return CSSColorValue::create_from_color(layout_node.computed_values().color(), ColorSyntax::Modern);
|
||||
case PropertyID::OutlineColor:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue