Browse Source

LibWeb: Stop lying about string types

Hendiadyoin1 2 years ago
parent
commit
eeb15fc10b

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

@@ -722,7 +722,7 @@ Parser::ParseErrorOr<Optional<Selector::SimpleSelector>> Parser::parse_simple_se
         return Selector::SimpleSelector {
         return Selector::SimpleSelector {
             .type = Selector::SimpleSelector::Type::TagName,
             .type = Selector::SimpleSelector::Type::TagName,
             // FIXME: XML requires case-sensitivity for identifiers, while HTML does not. As such, this should be reworked if XML support is added.
             // FIXME: XML requires case-sensitivity for identifiers, while HTML does not. As such, this should be reworked if XML support is added.
-            .value = Selector::SimpleSelector::Name { FlyString::from_utf8(first_value.token().ident().to_lowercase_string()).release_value_but_fixme_should_propagate_errors() }
+            .value = Selector::SimpleSelector::Name { FlyString::from_deprecated_fly_string(first_value.token().ident().to_lowercase_string()).release_value_but_fixme_should_propagate_errors() }
         };
         };
     }
     }
     if (first_value.is_block() && first_value.block().is_square())
     if (first_value.is_block() && first_value.block().is_square())

+ 1 - 1
Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

@@ -1971,7 +1971,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
         default:
         default:
             return {};
             return {};
         }
         }
-        return find_font(String::from_utf8(Platform::FontPlugin::the().generic_font_name(generic_font)).release_value_but_fixme_should_propagate_errors());
+        return find_font(String::from_deprecated_string(Platform::FontPlugin::the().generic_font_name(generic_font)).release_value_but_fixme_should_propagate_errors());
     };
     };
 
 
     RefPtr<Gfx::Font const> found_font;
     RefPtr<Gfx::Font const> found_font;

+ 3 - 3
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -1323,7 +1323,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(Deprecat
     if (options.has<ElementCreationOptions>()) {
     if (options.has<ElementCreationOptions>()) {
         auto const& element_creation_options = options.get<ElementCreationOptions>();
         auto const& element_creation_options = options.get<ElementCreationOptions>();
         if (!element_creation_options.is.is_null())
         if (!element_creation_options.is.is_null())
-            is_value = TRY_OR_THROW_OOM(vm, String::from_utf8(element_creation_options.is));
+            is_value = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(element_creation_options.is));
     }
     }
 
 
     // 5. Let namespace be the HTML namespace, if this is an HTML document or this’s content type is "application/xhtml+xml"; otherwise null.
     // 5. Let namespace be the HTML namespace, if this is an HTML document or this’s content type is "application/xhtml+xml"; otherwise null.
@@ -1351,7 +1351,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element_ns(Depre
     if (options.has<ElementCreationOptions>()) {
     if (options.has<ElementCreationOptions>()) {
         auto const& element_creation_options = options.get<ElementCreationOptions>();
         auto const& element_creation_options = options.get<ElementCreationOptions>();
         if (!element_creation_options.is.is_null())
         if (!element_creation_options.is.is_null())
-            is_value = TRY_OR_THROW_OOM(vm, String::from_utf8(element_creation_options.is));
+            is_value = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(element_creation_options.is));
     }
     }
 
 
     // 4. Return the result of creating an element given document, localName, namespace, prefix, is, and with the synchronous custom elements flag set.
     // 4. Return the result of creating an element given document, localName, namespace, prefix, is, and with the synchronous custom elements flag set.
@@ -2237,7 +2237,7 @@ JS::GCPtr<HTML::CustomElementDefinition> Document::lookup_custom_element_definit
     auto registry = window().custom_elements().release_value_but_fixme_should_propagate_errors();
     auto registry = window().custom_elements().release_value_but_fixme_should_propagate_errors();
 
 
     // 4. If there is custom element definition in registry with name and local name both equal to localName, return that custom element definition.
     // 4. If there is custom element definition in registry with name and local name both equal to localName, return that custom element definition.
-    auto converted_local_name = String::from_utf8(local_name).release_value_but_fixme_should_propagate_errors();
+    auto converted_local_name = String::from_deprecated_string(local_name).release_value_but_fixme_should_propagate_errors();
     auto maybe_definition = registry->get_definition_with_name_and_local_name(converted_local_name, converted_local_name);
     auto maybe_definition = registry->get_definition_with_name_and_local_name(converted_local_name, converted_local_name);
     if (maybe_definition)
     if (maybe_definition)
         return maybe_definition;
         return maybe_definition;

+ 1 - 1
Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp

@@ -957,7 +957,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
 
 
             // 6. If name is not an ASCII case-insensitive match for "_blank", then set chosen's name to name.
             // 6. If name is not an ASCII case-insensitive match for "_blank", then set chosen's name to name.
             if (!Infra::is_ascii_case_insensitive_match(name, "_blank"sv))
             if (!Infra::is_ascii_case_insensitive_match(name, "_blank"sv))
-                chosen->set_name(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors());
+                chosen->set_name(String::from_utf8(name).release_value_but_fixme_should_propagate_errors());
         }
         }
 
 
         // --> If the user agent has been configured such that in this instance t will reuse current
         // --> If the user agent has been configured such that in this instance t will reuse current

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp

@@ -463,7 +463,7 @@ public:
         //    empty string, then end the synchronous section, and jump down to the failed with elements step below.
         //    empty string, then end the synchronous section, and jump down to the failed with elements step below.
         String candiate_src;
         String candiate_src;
         if (m_candidate->has_attribute(HTML::AttributeNames::src))
         if (m_candidate->has_attribute(HTML::AttributeNames::src))
-            candiate_src = TRY_OR_THROW_OOM(vm, String::from_utf8(m_candidate->attribute(HTML::AttributeNames::src)));
+            candiate_src = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_candidate->attribute(HTML::AttributeNames::src)));
 
 
         if (candiate_src.is_empty()) {
         if (candiate_src.is_empty()) {
             TRY(failed_with_elements());
             TRY(failed_with_elements());