1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +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:
Linus Groh 2022-09-25 17:03:42 +01:00
parent c0eda77928
commit ad04d7ac9b
107 changed files with 441 additions and 440 deletions

View file

@ -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 nodes 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 nodes 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 thiss 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());