mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong in the DOM directory/namespace - not even DOMException, despite the name :^)
This commit is contained in:
parent
c0eda77928
commit
ad04d7ac9b
Notes:
sideshowbarker
2024-07-17 06:38:13 +09:00
Author: https://github.com/linusg
Commit: ad04d7ac9b
Pull-request: https://github.com/SerenityOS/serenity/pull/15357
Reviewed-by: https://github.com/awesomekling ✅
107 changed files with 441 additions and 440 deletions
|
@ -31,7 +31,7 @@ void CharacterData::set_data(String data)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-cd-substring
|
||||
ExceptionOr<String> CharacterData::substring_data(size_t offset, size_t count) const
|
||||
WebIDL::ExceptionOr<String> CharacterData::substring_data(size_t offset, size_t count) const
|
||||
{
|
||||
// 1. Let length be node’s length.
|
||||
auto length = this->length();
|
||||
|
@ -50,7 +50,7 @@ ExceptionOr<String> CharacterData::substring_data(size_t offset, size_t count) c
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-cd-replace
|
||||
ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t count, String const& data)
|
||||
WebIDL::ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t count, String const& data)
|
||||
{
|
||||
// 1. Let length be node’s length.
|
||||
auto length = this->length();
|
||||
|
@ -109,21 +109,21 @@ ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t count, Strin
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-appenddata
|
||||
ExceptionOr<void> CharacterData::append_data(String const& data)
|
||||
WebIDL::ExceptionOr<void> CharacterData::append_data(String const& data)
|
||||
{
|
||||
// The appendData(data) method steps are to replace data with node this, offset this’s length, count 0, and data data.
|
||||
return replace_data(m_data.length(), 0, data);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-insertdata
|
||||
ExceptionOr<void> CharacterData::insert_data(size_t offset, String const& data)
|
||||
WebIDL::ExceptionOr<void> CharacterData::insert_data(size_t offset, String const& data)
|
||||
{
|
||||
// The insertData(offset, data) method steps are to replace data with node this, offset offset, count 0, and data data.
|
||||
return replace_data(offset, 0, data);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-deletedata
|
||||
ExceptionOr<void> CharacterData::delete_data(size_t offset, size_t count)
|
||||
WebIDL::ExceptionOr<void> CharacterData::delete_data(size_t offset, size_t count)
|
||||
{
|
||||
// The deleteData(offset, count) method steps are to replace data with node this, offset offset, count count, and data the empty string.
|
||||
return replace_data(offset, count, String::empty());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue