mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
LibWeb: Parse the word-break css property
This commit is contained in:
parent
124bd115a1
commit
44b1c4f2b5
Notes:
github-actions[bot]
2024-10-25 22:18:52 +00:00
Author: https://github.com/kostyafarber Commit: https://github.com/LadybirdBrowser/ladybird/commit/44b1c4f2b59 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1965
8 changed files with 35 additions and 1 deletions
|
@ -44,6 +44,7 @@ text-shadow: none
|
|||
text-transform: none
|
||||
visibility: visible
|
||||
white-space: normal
|
||||
word-break: normal
|
||||
word-spacing: normal
|
||||
word-wrap: normal
|
||||
align-content: normal
|
||||
|
@ -119,7 +120,7 @@ grid-row-start: auto
|
|||
grid-template-areas: none
|
||||
grid-template-columns: auto
|
||||
grid-template-rows: auto
|
||||
height: 2057px
|
||||
height: 2074px
|
||||
inline-size: auto
|
||||
inset-block-end: auto
|
||||
inset-block-start: auto
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
static CSS::ContentVisibility content_visibility() { return CSS::ContentVisibility::Visible; }
|
||||
static CSS::Cursor cursor() { return CSS::Cursor::Auto; }
|
||||
static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; }
|
||||
static CSS::WordBreak word_break() { return CSS::WordBreak::Normal; }
|
||||
static CSS::LengthOrCalculated word_spacing() { return CSS::Length::make_px(0); }
|
||||
static LengthOrCalculated letter_spacing() { return CSS::Length::make_px(0); }
|
||||
static Variant<LengthOrCalculated, NumberOrCalculated> tab_size() { return NumberOrCalculated(8.0f); }
|
||||
|
@ -551,6 +552,7 @@ protected:
|
|||
CSS::TextTransform text_transform { InitialValues::text_transform() };
|
||||
CSS::LengthPercentage text_indent { InitialValues::text_indent() };
|
||||
CSS::WhiteSpace white_space { InitialValues::white_space() };
|
||||
CSS::WordBreak word_break { InitialValues::word_break() };
|
||||
CSS::LengthOrCalculated word_spacing { InitialValues::word_spacing() };
|
||||
LengthOrCalculated letter_spacing { InitialValues::letter_spacing() };
|
||||
CSS::ListStyleType list_style_type { InitialValues::list_style_type() };
|
||||
|
@ -728,6 +730,7 @@ public:
|
|||
void set_position(CSS::Positioning position) { m_noninherited.position = position; }
|
||||
void set_white_space(CSS::WhiteSpace value) { m_inherited.white_space = value; }
|
||||
void set_word_spacing(CSS::LengthOrCalculated value) { m_inherited.word_spacing = value; }
|
||||
void set_word_break(CSS::WordBreak value) { m_inherited.word_break = value; }
|
||||
void set_letter_spacing(CSS::LengthOrCalculated value) { m_inherited.letter_spacing = value; }
|
||||
void set_width(CSS::Size const& width) { m_noninherited.width = width; }
|
||||
void set_min_width(CSS::Size const& width) { m_noninherited.min_width = width; }
|
||||
|
|
|
@ -499,5 +499,11 @@
|
|||
"pre",
|
||||
"pre-line",
|
||||
"pre-wrap"
|
||||
],
|
||||
"word-break": [
|
||||
"normal",
|
||||
"keep-all",
|
||||
"break-all",
|
||||
"break-word"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
"both",
|
||||
"both-edges",
|
||||
"bottom",
|
||||
"break-all",
|
||||
"break-word",
|
||||
"browser",
|
||||
"butt",
|
||||
|
@ -215,6 +216,7 @@
|
|||
"jump-none",
|
||||
"jump-start",
|
||||
"justify",
|
||||
"keep-all",
|
||||
"landscape",
|
||||
"large",
|
||||
"larger",
|
||||
|
|
|
@ -2723,6 +2723,17 @@
|
|||
"unitless-length"
|
||||
]
|
||||
},
|
||||
"word-break": {
|
||||
"animation-type": "discrete",
|
||||
"initial": "normal",
|
||||
"inherited": true,
|
||||
"valid-identifiers": [
|
||||
"normal",
|
||||
"keep-all",
|
||||
"break-all",
|
||||
"break-word"
|
||||
]
|
||||
},
|
||||
"word-spacing": {
|
||||
"animation-type": "by-computed-value",
|
||||
"inherited": true,
|
||||
|
|
|
@ -702,6 +702,12 @@ Variant<LengthOrCalculated, NumberOrCalculated> StyleProperties::tab_size() cons
|
|||
return NumberOrCalculated { value->as_number().number() };
|
||||
}
|
||||
|
||||
Optional<CSS::WordBreak> StyleProperties::word_break() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::WordBreak);
|
||||
return keyword_to_word_break(value->to_keyword());
|
||||
}
|
||||
|
||||
Optional<CSS::LengthOrCalculated> StyleProperties::word_spacing() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::WordSpacing);
|
||||
|
|
|
@ -115,6 +115,7 @@ public:
|
|||
Optional<CSS::Cursor> cursor() const;
|
||||
Variant<LengthOrCalculated, NumberOrCalculated> tab_size() const;
|
||||
Optional<CSS::WhiteSpace> white_space() const;
|
||||
Optional<CSS::WordBreak> word_break() const;
|
||||
Optional<CSS::LengthOrCalculated> word_spacing() const;
|
||||
Optional<LengthOrCalculated> letter_spacing() const;
|
||||
Optional<CSS::LineStyle> line_style(CSS::PropertyID) const;
|
||||
|
|
|
@ -598,6 +598,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
if (white_space.has_value())
|
||||
computed_values.set_white_space(white_space.value());
|
||||
|
||||
auto word_break = computed_style.word_break();
|
||||
if (word_break.has_value())
|
||||
computed_values.set_word_break(word_break.value());
|
||||
|
||||
auto word_spacing = computed_style.word_spacing();
|
||||
if (word_spacing.has_value())
|
||||
computed_values.set_word_spacing(word_spacing.value());
|
||||
|
|
Loading…
Reference in a new issue