diff --git a/Userland/Libraries/LibWeb/DOM/Position.cpp b/Userland/Libraries/LibWeb/DOM/Position.cpp index 6c1cc31cef..67b2a7168e 100644 --- a/Userland/Libraries/LibWeb/DOM/Position.cpp +++ b/Userland/Libraries/LibWeb/DOM/Position.cpp @@ -18,11 +18,11 @@ Position::Position(Node& node, unsigned offset) { } -DeprecatedString Position::to_deprecated_string() const +ErrorOr Position::to_string() const { if (!node()) - return DeprecatedString::formatted("DOM::Position(nullptr, {})", offset()); - return DeprecatedString::formatted("DOM::Position({} ({})), {})", node()->node_name(), node(), offset()); + return String::formatted("DOM::Position(nullptr, {})", offset()); + return String::formatted("DOM::Position({} ({})), {})", node()->node_name(), node(), offset()); } bool Position::increment_offset() diff --git a/Userland/Libraries/LibWeb/DOM/Position.h b/Userland/Libraries/LibWeb/DOM/Position.h index ee7fe84eaa..c20147f543 100644 --- a/Userland/Libraries/LibWeb/DOM/Position.h +++ b/Userland/Libraries/LibWeb/DOM/Position.h @@ -7,7 +7,9 @@ #pragma once +#include #include +#include #include #include #include @@ -35,7 +37,7 @@ public: return m_node.ptr() == other.m_node.ptr() && m_offset == other.m_offset; } - DeprecatedString to_deprecated_string() const; + ErrorOr to_string() const; private: JS::Handle m_node; @@ -44,13 +46,10 @@ private: } -namespace AK { template<> -struct Formatter : Formatter { +struct AK::Formatter : Formatter { ErrorOr format(FormatBuilder& builder, Web::DOM::Position const& value) { - return Formatter::format(builder, value.to_deprecated_string()); + return Formatter::format(builder, TRY(value.to_string())); } }; - -}