LibWeb: Add Document helpers to move its cursor to word boundaries

This implementation is based on the same feature I added to Serenity's
TextEditor:

https://github.com/SerenityOS/serenity/pull/17477
This commit is contained in:
Timothy Flynn 2024-09-05 12:10:25 -04:00 committed by Andreas Kling
commit ecf2cc600b
Notes: github-actions[bot] 2024-09-06 05:44:05 +00:00
6 changed files with 92 additions and 0 deletions

View file

@ -41,6 +41,7 @@ public:
WebIDL::ExceptionOr<void> replace_data(size_t offset_in_utf16_code_units, size_t count_in_utf16_code_units, String const&);
Unicode::Segmenter& grapheme_segmenter();
Unicode::Segmenter& word_segmenter();
protected:
CharacterData(Document&, NodeType, String const&);
@ -51,6 +52,7 @@ private:
String m_data;
OwnPtr<Unicode::Segmenter> m_grapheme_segmenter;
OwnPtr<Unicode::Segmenter> m_word_segmenter;
};
}