mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibWeb: Port Attr interface from DeprecatedString to String
There are an unfortunate number of DeprecatedString conversions required here, but these should all fall away and look much more pretty again when other places are also ported away from DeprecatedString. Leaves only the Element IDL interface left :^)
This commit is contained in:
parent
a41f23a0fc
commit
3bd04d2c58
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/shannonbooth
Commit: 3bd04d2c58
Pull-request: https://github.com/SerenityOS/serenity/pull/21174
Reviewed-by: https://github.com/awesomekling
15 changed files with 172 additions and 117 deletions
|
@ -166,7 +166,7 @@ Optional<String> Node::text_content() const
|
|||
|
||||
// If Attr node, return this's value.
|
||||
if (is<Attr>(*this))
|
||||
return MUST(String::from_deprecated_string(static_cast<Attr const&>(*this).value()));
|
||||
return static_cast<Attr const&>(*this).value();
|
||||
|
||||
// Otherwise, return null
|
||||
return {};
|
||||
|
@ -196,7 +196,7 @@ void Node::set_text_content(Optional<String> const& maybe_content)
|
|||
|
||||
// If Attr, set an existing attribute value with this and the given value.
|
||||
if (is<Attr>(*this)) {
|
||||
static_cast<Attr&>(*this).set_value(content);
|
||||
static_cast<Attr&>(*this).set_value(MUST(String::from_deprecated_string(content)));
|
||||
}
|
||||
|
||||
// Otherwise, do nothing.
|
||||
|
@ -212,7 +212,7 @@ Optional<String> Node::node_value() const
|
|||
|
||||
// If Attr, return this’s value.
|
||||
if (is<Attr>(this)) {
|
||||
return MUST(String::from_deprecated_string(verify_cast<Attr>(this)->value()));
|
||||
return verify_cast<Attr>(this)->value();
|
||||
}
|
||||
|
||||
// If CharacterData, return this’s data.
|
||||
|
@ -233,7 +233,7 @@ void Node::set_node_value(Optional<String> const& maybe_value)
|
|||
|
||||
// If Attr, set an existing attribute value with this and the given value.
|
||||
if (is<Attr>(this)) {
|
||||
verify_cast<Attr>(this)->set_value(value.to_deprecated_string());
|
||||
verify_cast<Attr>(this)->set_value(move(value));
|
||||
} else if (is<CharacterData>(this)) {
|
||||
// If CharacterData, replace data with node this, offset 0, count this’s length, and data the given value.
|
||||
verify_cast<CharacterData>(this)->set_data(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue