mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb: Improve support for white-space CSS property (#2348)
Add reasonable support for all values of white-space CSS property. Values of the property are translated into a 3-tuple of rules: do_collapse: whether whitespace is to be collapsed do_wrap_lines: whether to wrap on word boundaries when lines get too long do_wrap_breaks: whether to wrap on linebreaks The previously separate handling of per-line splitting and per-word splitting have been unified. The Word structure is now a more general Chunk, which represents different amounts of text depending on splitting rules.
This commit is contained in:
parent
3f2158bbfe
commit
58480a510f
2 changed files with 114 additions and 98 deletions
|
@ -53,10 +53,10 @@ public:
|
|||
const StyleProperties& style() const { return parent()->style(); }
|
||||
|
||||
private:
|
||||
void split_preformatted_into_lines(LayoutBlock& container);
|
||||
void split_into_lines_by_rules(LayoutBlock& container, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks);
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_word(Callback) const;
|
||||
void for_each_chunk(Callback, bool do_wrap_lines, bool do_wrap_breaks) const;
|
||||
|
||||
String m_text_for_rendering;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue