LibWeb: Port text segmentation to the ICU text segmenter

This commit is contained in:
Timothy Flynn 2024-06-19 09:02:21 -04:00 committed by Andreas Kling
commit 12f177e9e9
Notes: sideshowbarker 2024-07-17 03:27:40 +09:00
5 changed files with 40 additions and 20 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/String.h>
#include <LibLocale/Forward.h>
#include <LibWeb/DOM/ChildNode.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
@ -22,7 +23,7 @@ class CharacterData
JS_DECLARE_ALLOCATOR(CharacterData);
public:
virtual ~CharacterData() override = default;
virtual ~CharacterData() override;
String const& data() const { return m_data; }
void set_data(String const&);
@ -40,6 +41,8 @@ public:
WebIDL::ExceptionOr<void> delete_data(size_t offset_in_utf16_code_units, size_t count_in_utf16_code_units);
WebIDL::ExceptionOr<void> replace_data(size_t offset_in_utf16_code_units, size_t count_in_utf16_code_units, String const&);
Locale::Segmenter& segmenter();
protected:
CharacterData(Document&, NodeType, String const&);
@ -47,6 +50,8 @@ protected:
private:
String m_data;
OwnPtr<Locale::Segmenter> m_segmenter;
};
}