1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

LibWeb: Port HTMLTextAreaElement from DeprecatedString

This commit is contained in:
Shannon Booth 2023-11-26 10:59:52 +13:00 committed by Andreas Kling
parent a7b8828db2
commit cc43dbf56e
2 changed files with 5 additions and 6 deletions

View file

@ -20,7 +20,6 @@ namespace Web::HTML {
HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name) HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name)) : HTMLElement(document, move(qualified_name))
, m_raw_value(DeprecatedString::empty())
{ {
} }
@ -111,7 +110,7 @@ void HTMLTextAreaElement::create_shadow_tree_if_needed()
m_text_node->set_editable_text_node_owner(Badge<HTMLTextAreaElement> {}, *this); m_text_node->set_editable_text_node_owner(Badge<HTMLTextAreaElement> {}, *this);
// NOTE: If `children_changed()` was called before now, `m_raw_value` will hold the text content. // NOTE: If `children_changed()` was called before now, `m_raw_value` will hold the text content.
// Otherwise, it will get filled in whenever that does get called. // Otherwise, it will get filled in whenever that does get called.
m_text_node->set_text_content(MUST(String::from_deprecated_string(m_raw_value))); m_text_node->set_text_content(m_raw_value);
MUST(m_inner_text_element->append_child(*m_text_node)); MUST(m_inner_text_element->append_child(*m_text_node));
MUST(element->append_child(*m_inner_text_element)); MUST(element->append_child(*m_inner_text_element));
@ -127,7 +126,7 @@ void HTMLTextAreaElement::children_changed()
if (!m_dirty) { if (!m_dirty) {
m_raw_value = child_text_content(); m_raw_value = child_text_content();
if (m_text_node) if (m_text_node)
m_text_node->set_text_content(MUST(String::from_deprecated_string(m_raw_value))); m_text_node->set_text_content(m_raw_value);
} }
} }

View file

@ -27,9 +27,9 @@ public:
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
DeprecatedString const& type() const String const& type() const
{ {
static DeprecatedString textarea = "textarea"; static String const textarea = "textarea"_string;
return textarea; return textarea;
} }
@ -84,7 +84,7 @@ private:
JS::GCPtr<DOM::Text> m_text_node; JS::GCPtr<DOM::Text> m_text_node;
bool m_dirty { false }; bool m_dirty { false };
DeprecatedString m_raw_value; String m_raw_value;
}; };
} }