LibWeb: Add plumbing for new "text-overflow" CSS property
This patch adds the new "text-overflow" CSS property to all the relevant places.
This commit is contained in:
parent
a8d3c077ea
commit
794069b3cf
Notes:
github-actions[bot]
2024-08-03 09:05:42 +00:00
Author: https://github.com/TobyAsE Commit: https://github.com/LadybirdBrowser/ladybird/commit/794069b3cfb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/813 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/kalenikaliaksandr ✅
4 changed files with 14 additions and 0 deletions
|
@ -111,6 +111,7 @@ public:
|
|||
static CSS::Length text_decoration_thickness() { return Length::make_auto(); }
|
||||
static CSS::TextDecorationStyle text_decoration_style() { return CSS::TextDecorationStyle::Solid; }
|
||||
static CSS::TextTransform text_transform() { return CSS::TextTransform::None; }
|
||||
static CSS::TextOverflow text_overflow() { return CSS::TextOverflow::Clip; }
|
||||
static CSS::LengthPercentage text_indent() { return CSS::Length::make_px(0); }
|
||||
static CSS::Display display() { return CSS::Display { CSS::DisplayOutside::Inline, CSS::DisplayInside::Flow }; }
|
||||
static Color color() { return Color::Black; }
|
||||
|
@ -374,6 +375,7 @@ public:
|
|||
CSS::TextDecorationStyle text_decoration_style() const { return m_noninherited.text_decoration_style; }
|
||||
Color text_decoration_color() const { return m_noninherited.text_decoration_color; }
|
||||
CSS::TextTransform text_transform() const { return m_inherited.text_transform; }
|
||||
CSS::TextOverflow text_overflow() const { return m_noninherited.text_overflow; }
|
||||
Vector<ShadowData> const& text_shadow() const { return m_inherited.text_shadow; }
|
||||
CSS::Positioning position() const { return m_noninherited.position; }
|
||||
CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
|
||||
|
@ -558,6 +560,7 @@ protected:
|
|||
CSS::LengthPercentage text_decoration_thickness { InitialValues::text_decoration_thickness() };
|
||||
CSS::TextDecorationStyle text_decoration_style { InitialValues::text_decoration_style() };
|
||||
Color text_decoration_color { InitialValues::color() };
|
||||
CSS::TextOverflow text_overflow { InitialValues::text_overflow() };
|
||||
CSS::Positioning position { InitialValues::position() };
|
||||
CSS::Size width { InitialValues::width() };
|
||||
CSS::Size min_width { InitialValues::min_width() };
|
||||
|
@ -685,6 +688,7 @@ public:
|
|||
void set_text_transform(CSS::TextTransform value) { m_inherited.text_transform = value; }
|
||||
void set_text_shadow(Vector<ShadowData>&& value) { m_inherited.text_shadow = move(value); }
|
||||
void set_text_indent(CSS::LengthPercentage value) { m_inherited.text_indent = move(value); }
|
||||
void set_text_overflow(CSS::TextOverflow value) { m_noninherited.text_overflow = value; }
|
||||
void set_webkit_text_fill_color(Color value) { m_inherited.webkit_text_fill_color = value; }
|
||||
void set_position(CSS::Positioning position) { m_noninherited.position = position; }
|
||||
void set_white_space(CSS::WhiteSpace value) { m_inherited.white_space = value; }
|
||||
|
|
|
@ -643,6 +643,12 @@ Optional<CSS::TextJustify> StyleProperties::text_justify() const
|
|||
return value_id_to_text_justify(value->to_identifier());
|
||||
}
|
||||
|
||||
Optional<CSS::TextOverflow> StyleProperties::text_overflow() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::TextOverflow);
|
||||
return value_id_to_text_overflow(value->to_identifier());
|
||||
}
|
||||
|
||||
Optional<CSS::PointerEvents> StyleProperties::pointer_events() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::PointerEvents);
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
Optional<CSS::TextAnchor> text_anchor() const;
|
||||
Optional<CSS::TextAlign> text_align() const;
|
||||
Optional<CSS::TextJustify> text_justify() const;
|
||||
Optional<CSS::TextOverflow> text_overflow() const;
|
||||
CSS::Length border_spacing_horizontal() const;
|
||||
CSS::Length border_spacing_vertical() const;
|
||||
Optional<CSS::CaptionSide> caption_side() const;
|
||||
|
|
|
@ -586,6 +586,9 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
if (auto text_indent = computed_style.length_percentage(CSS::PropertyID::TextIndent); text_indent.has_value())
|
||||
computed_values.set_text_indent(text_indent.release_value());
|
||||
|
||||
if (auto text_overflow = computed_style.text_overflow(); text_overflow.has_value())
|
||||
computed_values.set_text_overflow(text_overflow.release_value());
|
||||
|
||||
auto white_space = computed_style.white_space();
|
||||
if (white_space.has_value())
|
||||
computed_values.set_white_space(white_space.value());
|
||||
|
|
Loading…
Add table
Reference in a new issue