diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp index 0b8cc2bfdb..f2cc4cf384 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp @@ -38,11 +38,11 @@ PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(JS::Realm& { } -DeprecatedString PropertyOwningCSSStyleDeclaration::item(size_t index) const +String PropertyOwningCSSStyleDeclaration::item(size_t index) const { if (index >= m_properties.size()) return {}; - return CSS::string_from_property_id(m_properties[index].property_id); + return MUST(String::from_utf8(CSS::string_from_property_id(m_properties[index].property_id))); } JS::NonnullGCPtr ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector properties, HashMap custom_properties) @@ -128,7 +128,7 @@ WebIDL::ExceptionOr PropertyOwningCSSStyleDeclaration::set_property(Proper } // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty -WebIDL::ExceptionOr PropertyOwningCSSStyleDeclaration::remove_property(PropertyID property_id) +WebIDL::ExceptionOr PropertyOwningCSSStyleDeclaration::remove_property(PropertyID property_id) { // 1. If the computed flag is set, then throw a NoModificationAllowedError exception. // NOTE: This is handled by the virtual override in ResolvedCSSStyleDeclaration. @@ -202,7 +202,7 @@ bool PropertyOwningCSSStyleDeclaration::set_a_css_declaration(PropertyID propert return true; } -DeprecatedString CSSStyleDeclaration::get_property_value(StringView property_name) const +String CSSStyleDeclaration::get_property_value(StringView property_name) const { auto property_id = property_id_from_string(property_name); if (!property_id.has_value()) @@ -210,11 +210,11 @@ DeprecatedString CSSStyleDeclaration::get_property_value(StringView property_nam auto maybe_property = property(property_id.value()); if (!maybe_property.has_value()) return {}; - return maybe_property->value->to_string().to_deprecated_string(); + return maybe_property->value->to_string(); } // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority -DeprecatedString CSSStyleDeclaration::get_property_priority(StringView property_name) const +StringView CSSStyleDeclaration::get_property_priority(StringView property_name) const { auto property_id = property_id_from_string(property_name); if (!property_id.has_value()) @@ -222,7 +222,7 @@ DeprecatedString CSSStyleDeclaration::get_property_priority(StringView property_ auto maybe_property = property(property_id.value()); if (!maybe_property.has_value()) return {}; - return maybe_property->important == Important::Yes ? "important" : ""; + return maybe_property->important == Important::Yes ? "important"sv : ""sv; } WebIDL::ExceptionOr CSSStyleDeclaration::set_property(StringView property_name, StringView css_text, StringView priority) @@ -233,11 +233,11 @@ WebIDL::ExceptionOr CSSStyleDeclaration::set_property(StringView property_ return set_property(property_id.value(), css_text, priority); } -WebIDL::ExceptionOr CSSStyleDeclaration::remove_property(StringView property_name) +WebIDL::ExceptionOr CSSStyleDeclaration::remove_property(StringView property_name) { auto property_id = property_id_from_string(property_name); if (!property_id.has_value()) - return DeprecatedString::empty(); + return String {}; return remove_property(property_id.value()); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h index 1766738932..b3b0802cbc 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h @@ -22,18 +22,18 @@ public: virtual void initialize(JS::Realm&) override; virtual size_t length() const = 0; - virtual DeprecatedString item(size_t index) const = 0; + virtual String item(size_t index) const = 0; virtual Optional property(PropertyID) const = 0; virtual WebIDL::ExceptionOr set_property(PropertyID, StringView css_text, StringView priority = ""sv) = 0; - virtual WebIDL::ExceptionOr remove_property(PropertyID) = 0; + virtual WebIDL::ExceptionOr remove_property(PropertyID) = 0; WebIDL::ExceptionOr set_property(StringView property_name, StringView css_text, StringView priority); - WebIDL::ExceptionOr remove_property(StringView property_name); + WebIDL::ExceptionOr remove_property(StringView property_name); - DeprecatedString get_property_value(StringView property) const; - DeprecatedString get_property_priority(StringView property) const; + String get_property_value(StringView property) const; + StringView get_property_priority(StringView property) const; DeprecatedString css_text() const; virtual WebIDL::ExceptionOr set_css_text(StringView) = 0; @@ -59,12 +59,12 @@ public: virtual ~PropertyOwningCSSStyleDeclaration() override = default; virtual size_t length() const override; - virtual DeprecatedString item(size_t index) const override; + virtual String item(size_t index) const override; virtual Optional property(PropertyID) const override; virtual WebIDL::ExceptionOr set_property(PropertyID, StringView css_text, StringView priority) override; - virtual WebIDL::ExceptionOr remove_property(PropertyID) override; + virtual WebIDL::ExceptionOr remove_property(PropertyID) override; Vector const& properties() const { return m_properties; } HashMap const& custom_properties() const { return m_custom_properties; } diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl index 51a5267b06..725ca646bc 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl @@ -1,5 +1,5 @@ // https://drafts.csswg.org/cssom/#cssstyledeclaration -[Exposed=Window, UseDeprecatedAKString] +[Exposed=Window] interface CSSStyleDeclaration { [CEReactions] attribute CSSOMString cssText; diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 919d2d07a2..6734d0fd9a 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -72,7 +72,7 @@ size_t ResolvedCSSStyleDeclaration::length() const return 0; } -DeprecatedString ResolvedCSSStyleDeclaration::item(size_t index) const +String ResolvedCSSStyleDeclaration::item(size_t index) const { (void)index; return {}; @@ -944,7 +944,7 @@ WebIDL::ExceptionOr ResolvedCSSStyleDeclaration::set_property(PropertyID, } // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty -WebIDL::ExceptionOr ResolvedCSSStyleDeclaration::remove_property(PropertyID) +WebIDL::ExceptionOr ResolvedCSSStyleDeclaration::remove_property(PropertyID) { // 1. If the computed flag is set, then throw a NoModificationAllowedError exception. return WebIDL::NoModificationAllowedError::create(realm(), "Cannot remove properties from result of getComputedStyle()"_fly_string); diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h index c46851ce32..6b3d8c5222 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h @@ -19,10 +19,10 @@ public: virtual ~ResolvedCSSStyleDeclaration() override = default; virtual size_t length() const override; - virtual DeprecatedString item(size_t index) const override; + virtual String item(size_t index) const override; virtual Optional property(PropertyID) const override; virtual WebIDL::ExceptionOr set_property(PropertyID, StringView css_text, StringView priority) override; - virtual WebIDL::ExceptionOr remove_property(PropertyID) override; + virtual WebIDL::ExceptionOr remove_property(PropertyID) override; virtual DeprecatedString serialized() const override; virtual WebIDL::ExceptionOr set_css_text(StringView) override;