diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 1f473b87f3..bbbdde381c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -2451,7 +2451,7 @@ static void collect_attribute_values_of_an_inheritance_stack(SourceGenerator& fu if (attribute.extended_attributes.contains("Reflect")) { if (attribute.type->name() != "boolean") { attribute_generator.append(R"~~~( - auto @attribute.return_value_name@ = impl->attribute(HTML::AttributeNames::@attribute.reflect_name@); + auto @attribute.return_value_name@ = impl->deprecated_attribute(HTML::AttributeNames::@attribute.reflect_name@); )~~~"); } else { attribute_generator.append(R"~~~( @@ -2777,7 +2777,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.getter_callback@) if (attribute.extended_attributes.contains("Reflect")) { if (attribute.type->name() != "boolean") { attribute_generator.append(R"~~~( - auto retval = impl->attribute(HTML::AttributeNames::@attribute.reflect_name@); + auto retval = impl->deprecated_attribute(HTML::AttributeNames::@attribute.reflect_name@); )~~~"); } else { attribute_generator.append(R"~~~( diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index f1b2c19df0..8e8965ee2a 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -34,7 +34,7 @@ static inline bool matches_lang_pseudo_class(DOM::Element const& element, Vector { FlyString element_language; for (auto const* e = &element; e; e = e->parent_element()) { - auto lang = e->attribute(HTML::AttributeNames::lang); + auto lang = e->deprecated_attribute(HTML::AttributeNames::lang); if (!lang.is_null()) { element_language = FlyString::from_deprecated_fly_string(lang).release_value_but_fixme_should_propagate_errors(); break; @@ -142,14 +142,14 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co switch (attribute.match_type) { case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch: return case_insensitive_match - ? Infra::is_ascii_case_insensitive_match(element.attribute(attribute_name), attribute.value) - : element.attribute(attribute_name) == attribute.value.to_deprecated_string(); + ? Infra::is_ascii_case_insensitive_match(element.deprecated_attribute(attribute_name), attribute.value) + : element.deprecated_attribute(attribute_name) == attribute.value.to_deprecated_string(); case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord: { if (attribute.value.is_empty()) { // This selector is always false is match value is empty. return false; } - auto const view = element.attribute(attribute_name).split_view(' '); + auto const view = element.deprecated_attribute(attribute_name).split_view(' '); auto const size = view.size(); for (size_t i = 0; i < size; ++i) { auto const value = view.at(i); @@ -163,9 +163,9 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co } case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString: return !attribute.value.is_empty() - && element.attribute(attribute_name).contains(attribute.value, case_sensitivity); + && element.deprecated_attribute(attribute_name).contains(attribute.value, case_sensitivity); case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: { - auto const element_attr_value = element.attribute(attribute_name); + auto const element_attr_value = element.deprecated_attribute(attribute_name); if (element_attr_value.is_empty()) { // If the attribute value on element is empty, the selector is true // if the match value is also empty and false otherwise. @@ -181,10 +181,10 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co } case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString: return !attribute.value.is_empty() - && element.attribute(attribute_name).starts_with(attribute.value, case_sensitivity); + && element.deprecated_attribute(attribute_name).starts_with(attribute.value, case_sensitivity); case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString: return !attribute.value.is_empty() - && element.attribute(attribute_name).ends_with(attribute.value, case_sensitivity); + && element.deprecated_attribute(attribute_name).ends_with(attribute.value, case_sensitivity); default: break; } @@ -255,7 +255,7 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla if (!matches_link_pseudo_class(element)) return false; auto document_url = element.document().url(); - AK::URL target_url = element.document().parse_url(element.attribute(HTML::AttributeNames::href)); + AK::URL target_url = element.document().parse_url(element.deprecated_attribute(HTML::AttributeNames::href)); if (target_url.fragment().has_value()) return document_url.equals(target_url, AK::URL::ExcludeFragment::No); return document_url.equals(target_url, AK::URL::ExcludeFragment::Yes); @@ -560,7 +560,7 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, Optio VERIFY_NOT_REACHED(); } case CSS::Selector::SimpleSelector::Type::Id: - return component.name() == element.attribute(HTML::AttributeNames::id).view(); + return component.name() == element.deprecated_attribute(HTML::AttributeNames::id).view(); case CSS::Selector::SimpleSelector::Type::Class: return element.has_class(component.name()); case CSS::Selector::SimpleSelector::Type::Attribute: diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 88bce90727..e053c8727e 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -943,7 +943,7 @@ i32 Element::default_tab_index_value() const // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex i32 Element::tab_index() const { - auto maybe_table_index = Web::HTML::parse_integer(attribute(HTML::AttributeNames::tabindex)); + auto maybe_table_index = Web::HTML::parse_integer(deprecated_attribute(HTML::AttributeNames::tabindex)); if (!maybe_table_index.has_value()) return default_tab_index_value(); diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 9a28516a23..0bf936d0ae 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -91,7 +91,7 @@ public: bool has_attribute_ns(DeprecatedFlyString namespace_, DeprecatedFlyString const& name) const; bool has_attributes() const; - DeprecatedString attribute(DeprecatedFlyString const& name) const { return get_attribute(name); } + DeprecatedString deprecated_attribute(DeprecatedFlyString const& name) const { return get_attribute(name); } DeprecatedString get_attribute(DeprecatedFlyString const& name) const; DeprecatedString get_attribute_value(DeprecatedFlyString const& local_name, DeprecatedFlyString const& namespace_ = {}) const; @@ -158,7 +158,7 @@ public: Layout::NodeWithStyle* layout_node(); Layout::NodeWithStyle const* layout_node() const; - DeprecatedString name() const { return attribute(HTML::AttributeNames::name); } + DeprecatedString name() const { return deprecated_attribute(HTML::AttributeNames::name); } CSS::StyleProperties* computed_css_values() { return m_computed_css_values.ptr(); } CSS::StyleProperties const* computed_css_values() const { return m_computed_css_values.ptr(); } diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp index 69879bd5a8..93e6fc5a60 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp @@ -87,7 +87,7 @@ Element* HTMLCollection::named_item(FlyString const& name_) const auto elements = collect_matching_elements(); // 2. Return the first element in the collection for which at least one of the following is true: // - it has an ID which is key; - if (auto it = elements.find_if([&](auto& entry) { return entry->attribute(HTML::AttributeNames::id) == name; }); it != elements.end()) + if (auto it = elements.find_if([&](auto& entry) { return entry->deprecated_attribute(HTML::AttributeNames::id) == name; }); it != elements.end()) return *it; // - it is in the HTML namespace and has a name attribute whose value is key; if (auto it = elements.find_if([&](auto& entry) { return entry->namespace_() == Namespace::HTML && entry->name() == name; }); it != elements.end()) @@ -108,7 +108,7 @@ Vector HTMLCollection::supported_property_names() const for (auto& element : elements) { // 1. If element has an ID which is not in result, append element’s ID to result. if (element->has_attribute(HTML::AttributeNames::id)) { - auto id = element->attribute(HTML::AttributeNames::id); + auto id = element->deprecated_attribute(HTML::AttributeNames::id); if (!result.contains_slow(id)) result.append(id); @@ -116,7 +116,7 @@ Vector HTMLCollection::supported_property_names() const // 2. If element is in the HTML namespace and has a name attribute whose value is neither the empty string nor is in result, append element’s name attribute value to result. if (element->namespace_() == Namespace::HTML && element->has_attribute(HTML::AttributeNames::name)) { - auto name = element->attribute(HTML::AttributeNames::name); + auto name = element->deprecated_attribute(HTML::AttributeNames::name); if (!name.is_empty() && !result.contains_slow(name)) result.append(name); diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp index 4fb6064482..be5485f95b 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp @@ -46,7 +46,7 @@ Variant> HTMLFormControlsCollection:: auto collection = collect_matching_elements(); for (auto const& element : collection) { - if (element->attribute(HTML::AttributeNames::id) != deprecated_name && element->name() != deprecated_name) + if (element->deprecated_attribute(HTML::AttributeNames::id) != deprecated_name && element->name() != deprecated_name) continue; if (matching_element) { @@ -71,7 +71,7 @@ Variant> HTMLFormControlsCollection:: return false; auto const& element = verify_cast(node); - return element.attribute(HTML::AttributeNames::id) == deprecated_name || element.name() == deprecated_name; + return element.deprecated_attribute(HTML::AttributeNames::id) == deprecated_name || element.name() == deprecated_name; })); } diff --git a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h index f4dbe1b7ce..7f6b166311 100644 --- a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h +++ b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h @@ -21,7 +21,7 @@ public: { JS::GCPtr found_element; static_cast(this)->template for_each_in_inclusive_subtree_of_type([&](auto& element) { - if (element.attribute(HTML::AttributeNames::id) == id) { + if (element.deprecated_attribute(HTML::AttributeNames::id) == id) { found_element = &element; return IterationDecision::Break; } @@ -34,7 +34,7 @@ public: { JS::GCPtr found_element; static_cast(this)->template for_each_in_inclusive_subtree_of_type([&](auto& element) { - if (element.attribute(HTML::AttributeNames::id) == id) { + if (element.deprecated_attribute(HTML::AttributeNames::id) == id) { found_element = &element; return IterationDecision::Break; } diff --git a/Userland/Libraries/LibWeb/DOM/StyleElementUtils.cpp b/Userland/Libraries/LibWeb/DOM/StyleElementUtils.cpp index 6d0e2ddd12..0f3fbb3084 100644 --- a/Userland/Libraries/LibWeb/DOM/StyleElementUtils.cpp +++ b/Userland/Libraries/LibWeb/DOM/StyleElementUtils.cpp @@ -43,7 +43,7 @@ void StyleElementUtils::update_a_style_block(DOM::Element& style_element) return; // 4. If element's type attribute is present and its value is neither the empty string nor an ASCII case-insensitive match for "text/css", then return. - auto type_attribute = style_element.attribute(HTML::AttributeNames::type); + auto type_attribute = style_element.deprecated_attribute(HTML::AttributeNames::type); if (!type_attribute.is_null() && !type_attribute.is_empty() && !Infra::is_ascii_case_insensitive_match(type_attribute, "text/css"sv)) return; @@ -63,8 +63,8 @@ void StyleElementUtils::update_a_style_block(DOM::Element& style_element) style_element.document(), "text/css"sv, &style_element, - style_element.attribute(HTML::AttributeNames::media), - style_element.in_a_document_tree() ? style_element.attribute(HTML::AttributeNames::title) : DeprecatedString::empty(), + style_element.deprecated_attribute(HTML::AttributeNames::media), + style_element.in_a_document_tree() ? style_element.deprecated_attribute(HTML::AttributeNames::title) : DeprecatedString::empty(), false, true, {}, diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 023d7468c7..3270bae11a 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -126,7 +126,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho if (layout_node.dom_node() && is(*layout_node.dom_node())) { auto& element = verify_cast(*layout_node.dom_node()); StringBuilder builder; - auto id = element.attribute(HTML::AttributeNames::id); + auto id = element.deprecated_attribute(HTML::AttributeNames::id); if (!id.is_empty()) { builder.append('#'); builder.append(id); diff --git a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp index 9fe3b371ac..039ca5c62b 100644 --- a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp @@ -102,9 +102,9 @@ void FormAssociatedElement::reset_form_owner() // 4. If element is listed, has a form content attribute, and is connected, then: if (is_listed() && html_element.has_attribute(HTML::AttributeNames::form) && html_element.is_connected()) { // 1. If the first element in element's tree, in tree order, to have an ID that is identical to element's form content attribute's value, is a form element, then associate the element with that form element. - auto form_value = html_element.attribute(HTML::AttributeNames::form); + auto form_value = html_element.deprecated_attribute(HTML::AttributeNames::form); html_element.root().for_each_in_inclusive_subtree_of_type([this, &form_value](HTMLFormElement& form_element) { - if (form_element.attribute(HTML::AttributeNames::id) == form_value) { + if (form_element.deprecated_attribute(HTML::AttributeNames::id) == form_value) { set_form(&form_element); return IterationDecision::Break; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index a49feb9d45..0f7c9d24a1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -37,7 +37,7 @@ void HTMLAnchorElement::attribute_changed(DeprecatedFlyString const& name, Depre DeprecatedString HTMLAnchorElement::hyperlink_element_utils_href() const { - return attribute(HTML::AttributeNames::href); + return deprecated_attribute(HTML::AttributeNames::href); } WebIDL::ExceptionOr HTMLAnchorElement::set_hyperlink_element_utils_href(DeprecatedString href) @@ -122,7 +122,7 @@ void HTMLAnchorElement::set_text(DeprecatedString const& text) DeprecatedString HTMLAnchorElement::referrer_policy() const { // The IDL attribute referrerPolicy must reflect the referrerpolicy content attribute, limited to only known values. - auto policy_string = attribute(HTML::AttributeNames::referrerpolicy); + auto policy_string = deprecated_attribute(HTML::AttributeNames::referrerpolicy); auto maybe_policy = ReferrerPolicy::from_string(policy_string); if (maybe_policy.has_value()) return ReferrerPolicy::to_string(maybe_policy.value()); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h index 6b1b844e6d..360d1da808 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h @@ -19,9 +19,9 @@ class HTMLAnchorElement final public: virtual ~HTMLAnchorElement() override; - DeprecatedString rel() const { return attribute(HTML::AttributeNames::rel); } - DeprecatedString target() const { return attribute(HTML::AttributeNames::target); } - DeprecatedString download() const { return attribute(HTML::AttributeNames::download); } + DeprecatedString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); } + DeprecatedString target() const { return deprecated_attribute(HTML::AttributeNames::target); } + DeprecatedString download() const { return deprecated_attribute(HTML::AttributeNames::download); } DeprecatedString text() const; void set_text(DeprecatedString const&); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index 4f372968ec..6da8b55e55 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -33,7 +33,7 @@ void HTMLAreaElement::attribute_changed(DeprecatedFlyString const& name, Depreca DeprecatedString HTMLAreaElement::hyperlink_element_utils_href() const { - return attribute(HTML::AttributeNames::href); + return deprecated_attribute(HTML::AttributeNames::href); } WebIDL::ExceptionOr HTMLAreaElement::set_hyperlink_element_utils_href(DeprecatedString href) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index 4044eb61ad..dd82ed40cb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -66,7 +66,7 @@ void HTMLBaseElement::set_the_frozen_base_url() auto& document = this->document(); // 2. Let urlRecord be the result of parsing the value of element's href content attribute with document's fallback base URL, and document's character encoding. (Thus, the base element isn't affected by itself.) - auto href = attribute(AttributeNames::href); + auto href = deprecated_attribute(AttributeNames::href); auto url_record = document.fallback_base_url().complete_url(href); // 3. Set element's frozen base URL to document's fallback base URL, if urlRecord is failure or running Is base allowed for Document? on the resulting URL record and document returns "Blocked", and to urlRecord otherwise. @@ -88,7 +88,7 @@ DeprecatedString HTMLBaseElement::href() const // 2. Let url be the value of the href attribute of this element, if it has one, and the empty string otherwise. auto url = DeprecatedString::empty(); if (has_attribute(AttributeNames::href)) - url = attribute(AttributeNames::href); + url = deprecated_attribute(AttributeNames::href); // 3. Let urlRecord be the result of parsing url with document's fallback base URL, and document's character encoding. (Thus, the base element isn't affected by other base elements or itself.) // FIXME: Pass in document's character encoding. diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index a8b60ee68d..c05dc80030 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -59,7 +59,7 @@ void HTMLButtonElement::initialize(JS::Realm& realm) DeprecatedString HTMLButtonElement::type() const { - auto value = attribute(HTML::AttributeNames::type); + auto value = deprecated_attribute(HTML::AttributeNames::type); #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \ if (value.equals_ignoring_ascii_case(#keyword##sv)) \ @@ -73,7 +73,7 @@ DeprecatedString HTMLButtonElement::type() const HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const { - auto value = attribute(HTML::AttributeNames::type); + auto value = deprecated_attribute(HTML::AttributeNames::type); #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, state) \ if (value.equals_ignoring_ascii_case(#keyword##sv)) \ @@ -110,7 +110,7 @@ DeprecatedString HTMLButtonElement::value() const { if (!has_attribute(AttributeNames::value)) return DeprecatedString::empty(); - return attribute(AttributeNames::value); + return deprecated_attribute(AttributeNames::value); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 5ba37f888c..67bcd99e67 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -64,8 +64,8 @@ void HTMLCanvasElement::apply_presentational_hints(CSS::StyleProperties& style) // https://html.spec.whatwg.org/multipage/rendering.html#map-to-the-aspect-ratio-property // if element has both attributes w and h, and parsing those attributes' values using the rules for parsing non-negative integers doesn't generate an error for either - auto w = parse_non_negative_integer(attribute(HTML::AttributeNames::width)); - auto h = parse_non_negative_integer(attribute(HTML::AttributeNames::height)); + auto w = parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::width)); + auto h = parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::height)); if (w.has_value() && h.has_value()) // then the user agent is expected to use the parsed integers as a presentational hint for the 'aspect-ratio' property of the form auto w / h. @@ -83,7 +83,7 @@ unsigned HTMLCanvasElement::width() const // The rules for parsing non-negative integers must be used to obtain their numeric values. // If an attribute is missing, or if parsing its value returns an error, then the default value must be used instead. // The width attribute defaults to 300 - return parse_non_negative_integer(attribute(HTML::AttributeNames::width)).value_or(300); + return parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::width)).value_or(300); } unsigned HTMLCanvasElement::height() const @@ -92,7 +92,7 @@ unsigned HTMLCanvasElement::height() const // The rules for parsing non-negative integers must be used to obtain their numeric values. // If an attribute is missing, or if parsing its value returns an error, then the default value must be used instead. // the height attribute defaults to 150 - return parse_non_negative_integer(attribute(HTML::AttributeNames::height)).value_or(150); + return parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::height)).value_or(150); } void HTMLCanvasElement::reset_context_to_default_state() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 7ee54e3570..f0b5887786 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -60,7 +60,7 @@ void HTMLElement::visit_edges(Cell::Visitor& visitor) // https://html.spec.whatwg.org/multipage/dom.html#dom-dir DeprecatedString HTMLElement::dir() const { - auto dir = attribute(HTML::AttributeNames::dir); + auto dir = deprecated_attribute(HTML::AttributeNames::dir); #define __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE(keyword) \ if (dir.equals_ignoring_ascii_case(#keyword##sv)) \ return #keyword##sv; @@ -427,7 +427,7 @@ DeprecatedString HTMLElement::get_an_elements_target() const // 1. If element has a target attribute, then return that attribute's value. if (has_attribute(AttributeNames::target)) - return attribute(AttributeNames::target); + return deprecated_attribute(AttributeNames::target); // FIXME: 2. If element's node document contains a base element with a // target attribute, then return the value of the target attribute of the @@ -441,7 +441,7 @@ DeprecatedString HTMLElement::get_an_elements_target() const TokenizedFeature::NoOpener HTMLElement::get_an_elements_noopener(StringView target) const { // To get an element's noopener, given an a, area, or form element element and a string target: - auto rel = attribute(HTML::AttributeNames::rel).to_lowercase(); + auto rel = deprecated_attribute(HTML::AttributeNames::rel).to_lowercase(); auto link_types = rel.view().split_view_if(Infra::is_ascii_whitespace); // 1. If element's link types include the noopener or noreferrer keyword, then return true. diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index d2050a524d..787a005227 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -27,7 +27,7 @@ class HTMLElement public: virtual ~HTMLElement() override; - DeprecatedString title() const { return attribute(HTML::AttributeNames::title); } + DeprecatedString title() const { return deprecated_attribute(HTML::AttributeNames::title); } DeprecatedString dir() const; void set_dir(DeprecatedString const&); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index eee3fdfaaa..f60b98c39d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -185,7 +185,7 @@ WebIDL::ExceptionOr HTMLFormElement::submit_form(JS::NonnullGCPtrhas_attribute(AttributeNames::formtarget)) - target = submitter->attribute(AttributeNames::formtarget); + target = submitter->deprecated_attribute(AttributeNames::formtarget); else target = get_an_elements_target(); @@ -316,10 +316,10 @@ DeprecatedString HTMLFormElement::action_from_form_element(JS::NonnullGCPtr(element.ptr()); form_associated_element && form_associated_element->is_submit_button() && element->has_attribute(AttributeNames::formaction)) - return attribute(AttributeNames::formaction); + return deprecated_attribute(AttributeNames::formaction); if (this->has_attribute(AttributeNames::action)) - return attribute(AttributeNames::action); + return deprecated_attribute(AttributeNames::action); return DeprecatedString::empty(); } @@ -346,13 +346,13 @@ HTMLFormElement::MethodAttributeState HTMLFormElement::method_state_from_form_el form_associated_element && form_associated_element->is_submit_button() && element->has_attribute(AttributeNames::formmethod)) { // NOTE: `formmethod` is the same as `method`, except that it has no missing value default. // This is handled by not calling `method_attribute_to_method_state` in the first place if there is no `formmethod` attribute. - return method_attribute_to_method_state(element->attribute(AttributeNames::formmethod)); + return method_attribute_to_method_state(element->deprecated_attribute(AttributeNames::formmethod)); } if (!this->has_attribute(AttributeNames::method)) return MethodAttributeState::GET; - return method_attribute_to_method_state(this->attribute(AttributeNames::method)); + return method_attribute_to_method_state(this->deprecated_attribute(AttributeNames::method)); } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-attributes:attr-fs-enctype-2 @@ -378,13 +378,13 @@ HTMLFormElement::EncodingTypeAttributeState HTMLFormElement::encoding_type_state // NOTE: `formenctype` is the same as `enctype`, except that it has no missing value default. // This is handled by not calling `encoding_type_attribute_to_encoding_type_state` in the first place if there is no // `formenctype` attribute. - return encoding_type_attribute_to_encoding_type_state(element->attribute(AttributeNames::formenctype)); + return encoding_type_attribute_to_encoding_type_state(element->deprecated_attribute(AttributeNames::formenctype)); } if (!this->has_attribute(AttributeNames::enctype)) return EncodingTypeAttributeState::FormUrlEncoded; - return encoding_type_attribute_to_encoding_type_state(this->attribute(AttributeNames::enctype)); + return encoding_type_attribute_to_encoding_type_state(this->deprecated_attribute(AttributeNames::enctype)); } static bool is_form_control(DOM::Element const& element) @@ -497,7 +497,7 @@ DeprecatedString HTMLFormElement::action() const if (!has_attribute(AttributeNames::action)) return document().url_string(); - auto action_attribute = attribute(AttributeNames::action); + auto action_attribute = deprecated_attribute(AttributeNames::action); if (action_attribute.is_empty()) return document().url_string(); @@ -519,7 +519,7 @@ ErrorOr HTMLFormElement::pick_an_encoding() const // 2. If the form element has an accept-charset attribute, set encoding to the return value of running these substeps: if (has_attribute(AttributeNames::accept_charset)) { // 1. Let input be the value of the form element's accept-charset attribute. - auto input = attribute(AttributeNames::accept_charset); + auto input = deprecated_attribute(AttributeNames::accept_charset); // 2. Let candidate encoding labels be the result of splitting input on ASCII whitespace. auto candidate_encoding_labels = input.split_view(Infra::is_ascii_whitespace); @@ -785,7 +785,7 @@ void HTMLFormElement::plan_to_navigate_to(Variant referrer_policy; // 2. If the form element's link types include the noreferrer keyword, then set referrerPolicy to "no-referrer". - auto rel = attribute(HTML::AttributeNames::rel).to_lowercase(); + auto rel = deprecated_attribute(HTML::AttributeNames::rel).to_lowercase(); auto link_types = rel.view().split_view_if(Infra::is_ascii_whitespace); if (link_types.contains_slow("noreferrer"sv)) referrer_policy = ReferrerPolicy::ReferrerPolicy::NoReferrer; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index e3c0ae7e03..9a9310465a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -249,7 +249,7 @@ bool HTMLImageElement::complete() const return true; // - The srcset attribute is omitted and the src attribute's value is the empty string. - if (!has_attribute(HTML::AttributeNames::srcset) && attribute(HTML::AttributeNames::src) == ""sv) + if (!has_attribute(HTML::AttributeNames::srcset) && deprecated_attribute(HTML::AttributeNames::src) == ""sv) return true; // - The img element's current request's state is completely available and its pending request is null. @@ -342,8 +342,8 @@ ErrorOr HTMLImageElement::update_the_image_data(bool restart_animations, b // and it has a src attribute specified whose value is not the empty string, // then set selected source to the value of the element's src attribute // and set selected pixel density to 1.0. - if (!uses_srcset_or_picture() && has_attribute(HTML::AttributeNames::src) && !attribute(HTML::AttributeNames::src).is_empty()) { - selected_source = TRY(String::from_deprecated_string(attribute(HTML::AttributeNames::src))); + if (!uses_srcset_or_picture() && has_attribute(HTML::AttributeNames::src) && !deprecated_attribute(HTML::AttributeNames::src).is_empty()) { + selected_source = TRY(String::from_deprecated_string(deprecated_attribute(HTML::AttributeNames::src))); selected_pixel_density = 1.0f; } @@ -542,7 +542,7 @@ after_step_7: request->set_initiator(Fetch::Infrastructure::Request::Initiator::ImageSet); // 21. Set request's referrer policy to the current state of the element's referrerpolicy attribute. - request->set_referrer_policy(ReferrerPolicy::from_string(attribute(HTML::AttributeNames::referrerpolicy))); + request->set_referrer_policy(ReferrerPolicy::from_string(deprecated_attribute(HTML::AttributeNames::referrerpolicy))); // FIXME: 22. Set request's priority to the current state of the element's fetchpriority attribute. @@ -757,7 +757,7 @@ void HTMLImageElement::react_to_changes_in_the_environment() request->set_initiator(Fetch::Infrastructure::Request::Initiator::ImageSet); // 3. Set request's referrer policy to the current state of the element's referrerpolicy attribute. - request->set_referrer_policy(ReferrerPolicy::from_string(attribute(HTML::AttributeNames::referrerpolicy))); + request->set_referrer_policy(ReferrerPolicy::from_string(deprecated_attribute(HTML::AttributeNames::referrerpolicy))); // FIXME: 4. Set request's priority to the current state of the element's fetchpriority attribute. @@ -864,37 +864,37 @@ static void update_the_source_set(DOM::Element& element) // 4. If el is an img element that has a srcset attribute, then set srcset to that attribute's value. if (is(element)) { - if (auto srcset_value = element.attribute(HTML::AttributeNames::srcset); !srcset_value.is_null()) + if (auto srcset_value = element.deprecated_attribute(HTML::AttributeNames::srcset); !srcset_value.is_null()) srcset = String::from_deprecated_string(srcset_value).release_value_but_fixme_should_propagate_errors(); } // 5. Otherwise, if el is a link element that has an imagesrcset attribute, then set srcset to that attribute's value. else if (is(element)) { - if (auto imagesrcset_value = element.attribute(HTML::AttributeNames::imagesrcset); !imagesrcset_value.is_null()) + if (auto imagesrcset_value = element.deprecated_attribute(HTML::AttributeNames::imagesrcset); !imagesrcset_value.is_null()) srcset = String::from_deprecated_string(imagesrcset_value).release_value_but_fixme_should_propagate_errors(); } // 6. If el is an img element that has a sizes attribute, then set sizes to that attribute's value. if (is(element)) { - if (auto sizes_value = element.attribute(HTML::AttributeNames::sizes); !sizes_value.is_null()) + if (auto sizes_value = element.deprecated_attribute(HTML::AttributeNames::sizes); !sizes_value.is_null()) sizes = String::from_deprecated_string(sizes_value).release_value_but_fixme_should_propagate_errors(); } // 7. Otherwise, if el is a link element that has an imagesizes attribute, then set sizes to that attribute's value. else if (is(element)) { - if (auto imagesizes_value = element.attribute(HTML::AttributeNames::imagesizes); !imagesizes_value.is_null()) + if (auto imagesizes_value = element.deprecated_attribute(HTML::AttributeNames::imagesizes); !imagesizes_value.is_null()) sizes = String::from_deprecated_string(imagesizes_value).release_value_but_fixme_should_propagate_errors(); } // 8. If el is an img element that has a src attribute, then set default source to that attribute's value. if (is(element)) { - if (auto src_value = element.attribute(HTML::AttributeNames::src); !src_value.is_null()) + if (auto src_value = element.deprecated_attribute(HTML::AttributeNames::src); !src_value.is_null()) default_source = String::from_deprecated_string(src_value).release_value_but_fixme_should_propagate_errors(); } // 9. Otherwise, if el is a link element that has an href attribute, then set default source to that attribute's value. else if (is(element)) { - if (auto href_value = element.attribute(HTML::AttributeNames::href); !href_value.is_null()) + if (auto href_value = element.deprecated_attribute(HTML::AttributeNames::href); !href_value.is_null()) default_source = String::from_deprecated_string(href_value).release_value_but_fixme_should_propagate_errors(); } @@ -914,7 +914,7 @@ static void update_the_source_set(DOM::Element& element) continue; // 4. Parse child's srcset attribute and let the returned source set be source set. - auto source_set = parse_a_srcset_attribute(child->attribute(HTML::AttributeNames::srcset)); + auto source_set = parse_a_srcset_attribute(child->deprecated_attribute(HTML::AttributeNames::srcset)); // 5. If source set has zero image sources, continue to the next child. if (source_set.is_empty()) @@ -923,14 +923,14 @@ static void update_the_source_set(DOM::Element& element) // 6. If child has a media attribute, and its value does not match the environment, continue to the next child. if (child->has_attribute(HTML::AttributeNames::media)) { auto media_query = parse_media_query(CSS::Parser::ParsingContext { element.document() }, - child->attribute(HTML::AttributeNames::media)); + child->deprecated_attribute(HTML::AttributeNames::media)); if (!media_query || !media_query->evaluate(element.document().window())) { continue; } } // 7. Parse child's sizes attribute, and let source set's source size be the returned value. - source_set.m_source_size = parse_a_sizes_attribute(element.document(), child->attribute(HTML::AttributeNames::sizes)); + source_set.m_source_size = parse_a_sizes_attribute(element.document(), child->deprecated_attribute(HTML::AttributeNames::sizes)); // FIXME: 8. If child has a type attribute, and its value is an unknown or unsupported MIME type, continue to the next child. if (child->has_attribute(HTML::AttributeNames::type)) { @@ -1000,7 +1000,7 @@ void HTMLImageElement::animate() // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#lazy-loading-attributes HTMLImageElement::LazyLoading HTMLImageElement::lazy_loading() const { - auto value = attribute(HTML::AttributeNames::loading); + auto value = deprecated_attribute(HTML::AttributeNames::loading); if (value.equals_ignoring_ascii_case("lazy"sv)) return LazyLoading::Lazy; return LazyLoading::Eager; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index c9a3c20987..c8acab6441 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -33,8 +33,8 @@ public: virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override; - DeprecatedString alt() const { return attribute(HTML::AttributeNames::alt); } - DeprecatedString src() const { return attribute(HTML::AttributeNames::src); } + DeprecatedString alt() const { return deprecated_attribute(HTML::AttributeNames::alt); } + DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); } RefPtr bitmap() const; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index c1af4942e0..aba863724b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -442,7 +442,7 @@ Optional HTMLInputElement::placeholder_value() const if (!has_attribute(HTML::AttributeNames::placeholder)) return {}; - auto placeholder = attribute(HTML::AttributeNames::placeholder); + auto placeholder = deprecated_attribute(HTML::AttributeNames::placeholder); if (placeholder.contains('\r') || placeholder.contains('\n')) { StringBuilder builder; @@ -503,7 +503,7 @@ void HTMLInputElement::create_shadow_tree_if_needed() MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Height, "1lh"sv)); m_placeholder_text_node = heap().allocate(realm(), document(), initial_value); - m_placeholder_text_node->set_data(attribute(HTML::AttributeNames::placeholder)); + m_placeholder_text_node->set_data(deprecated_attribute(HTML::AttributeNames::placeholder)); m_placeholder_text_node->set_owner_input_element({}, *this); MUST(m_placeholder_element->append_child(*m_placeholder_text_node)); MUST(element->append_child(*m_placeholder_element)); @@ -516,7 +516,7 @@ void HTMLInputElement::create_shadow_tree_if_needed() // NOTE: file upload state is mutable, but we don't allow the text node to be modifed m_text_node->set_always_editable(false); } else { - handle_readonly_attribute(attribute(HTML::AttributeNames::readonly)); + handle_readonly_attribute(deprecated_attribute(HTML::AttributeNames::readonly)); } m_text_node->set_owner_input_element({}, *this); @@ -1087,7 +1087,7 @@ Optional HTMLInputElement::default_role() const if (type_state() == TypeAttributeState::Checkbox) return ARIA::Role::checkbox; // https://www.w3.org/TR/html-aria/#el-input-email - if (type_state() == TypeAttributeState::Email && attribute("list").is_null()) + if (type_state() == TypeAttributeState::Email && deprecated_attribute("list").is_null()) return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-image if (type_state() == TypeAttributeState::ImageButton) @@ -1110,10 +1110,10 @@ Optional HTMLInputElement::default_role() const || type_state() == TypeAttributeState::Telephone || type_state() == TypeAttributeState::URL || type_state() == TypeAttributeState::Email) - && !attribute("list").is_null()) + && !deprecated_attribute("list").is_null()) return ARIA::Role::combobox; // https://www.w3.org/TR/html-aria/#el-input-search - if (type_state() == TypeAttributeState::Search && attribute("list").is_null()) + if (type_state() == TypeAttributeState::Search && deprecated_attribute("list").is_null()) return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-submit if (type_state() == TypeAttributeState::SubmitButton) @@ -1122,10 +1122,10 @@ Optional HTMLInputElement::default_role() const if (type_state() == TypeAttributeState::Telephone) return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-text - if (type_state() == TypeAttributeState::Text && attribute("list").is_null()) + if (type_state() == TypeAttributeState::Text && deprecated_attribute("list").is_null()) return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-url - if (type_state() == TypeAttributeState::URL && attribute("list").is_null()) + if (type_state() == TypeAttributeState::URL && deprecated_attribute("list").is_null()) return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-color diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 251f2242c3..4f650659c9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -60,8 +60,8 @@ public: TypeAttributeState type_state() const { return m_type; } WebIDL::ExceptionOr set_type(DeprecatedString const&); - DeprecatedString default_value() const { return attribute(HTML::AttributeNames::value); } - DeprecatedString name() const { return attribute(HTML::AttributeNames::name); } + DeprecatedString default_value() const { return deprecated_attribute(HTML::AttributeNames::value); } + DeprecatedString name() const { return deprecated_attribute(HTML::AttributeNames::name); } virtual DeprecatedString value() const override; WebIDL::ExceptionOr set_value(DeprecatedString); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h index 489ab4db4b..b4e539d186 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h @@ -18,7 +18,7 @@ public: virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; - DeprecatedString for_() const { return attribute(HTML::AttributeNames::for_); } + DeprecatedString for_() const { return deprecated_attribute(HTML::AttributeNames::for_); } private: HTMLLabelElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index e15182e072..10d0b4d052 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -58,12 +58,12 @@ void HTMLLinkElement::inserted() if (m_relationship & Relationship::Preload) { // FIXME: Respect the "as" attribute. LoadRequest request; - request.set_url(document().parse_url(attribute(HTML::AttributeNames::href))); + request.set_url(document().parse_url(deprecated_attribute(HTML::AttributeNames::href))); set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request)); } else if (m_relationship & Relationship::DNSPrefetch) { - ResourceLoader::the().prefetch_dns(document().parse_url(attribute(HTML::AttributeNames::href))); + ResourceLoader::the().prefetch_dns(document().parse_url(deprecated_attribute(HTML::AttributeNames::href))); } else if (m_relationship & Relationship::Preconnect) { - ResourceLoader::the().preconnect(document().parse_url(attribute(HTML::AttributeNames::href))); + ResourceLoader::the().preconnect(document().parse_url(deprecated_attribute(HTML::AttributeNames::href))); } else if (m_relationship & Relationship::Icon) { auto favicon_url = document().parse_url(href()); auto favicon_request = LoadRequest::create_for_url_on_page(favicon_url, document().page()); @@ -343,7 +343,7 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru // 2. Otherwise, return the document's character encoding. [DOM] DeprecatedString encoding; - if (auto charset = attribute(HTML::AttributeNames::charset); !charset.is_null()) + if (auto charset = deprecated_attribute(HTML::AttributeNames::charset); !charset.is_null()) encoding = charset; else encoding = document().encoding_or_default(); @@ -366,7 +366,7 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru if (m_loaded_style_sheet) { m_loaded_style_sheet->set_owner_node(this); - m_loaded_style_sheet->set_media(attribute(HTML::AttributeNames::media)); + m_loaded_style_sheet->set_media(deprecated_attribute(HTML::AttributeNames::media)); document().style_sheets().add_sheet(*m_loaded_style_sheet); } else { dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Failed to parse stylesheet: {}", resource()->url()); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index ae137d288d..6e7f1602e3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -28,9 +28,9 @@ public: virtual void inserted() override; - DeprecatedString rel() const { return attribute(HTML::AttributeNames::rel); } - DeprecatedString type() const { return attribute(HTML::AttributeNames::type); } - DeprecatedString href() const { return attribute(HTML::AttributeNames::href); } + DeprecatedString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); } + DeprecatedString type() const { return deprecated_attribute(HTML::AttributeNames::type); } + DeprecatedString href() const { return deprecated_attribute(HTML::AttributeNames::href); } bool has_loaded_icon() const; bool load_favicon_and_use_if_window_is_active(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 1726c459ea..048e1373d9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -580,7 +580,7 @@ public: // empty string, then end the synchronous section, and jump down to the failed with elements step below. String candiate_src; if (m_candidate->has_attribute(HTML::AttributeNames::src)) - candiate_src = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_candidate->attribute(HTML::AttributeNames::src))); + candiate_src = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_candidate->deprecated_attribute(HTML::AttributeNames::src))); if (candiate_src.is_empty()) { TRY(failed_with_elements()); @@ -825,7 +825,7 @@ WebIDL::ExceptionOr HTMLMediaElement::select_resource() }; // 1. ⌛ If the src attribute's value is the empty string, then end the synchronous section, and jump down to the failed with attribute step below. - auto source = attribute(HTML::AttributeNames::src); + auto source = deprecated_attribute(HTML::AttributeNames::src); if (source.is_empty()) { failed_with_attribute("The 'src' attribute is empty"_string); return {}; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index 9b85a37a51..4208760bf5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -26,7 +26,7 @@ void HTMLMetaElement::initialize(JS::Realm& realm) Optional HTMLMetaElement::http_equiv_state() const { - auto value = attribute(HTML::AttributeNames::http_equiv); + auto value = deprecated_attribute(HTML::AttributeNames::http_equiv); #define __ENUMERATE_HTML_META_HTTP_EQUIV_ATTRIBUTE(keyword, state) \ if (value.equals_ignoring_ascii_case(#keyword##sv)) \ @@ -55,7 +55,7 @@ void HTMLMetaElement::inserted() if (!has_attribute(AttributeNames::content)) break; - auto input = attribute(AttributeNames::content); + auto input = deprecated_attribute(AttributeNames::content); if (input.is_empty()) break; @@ -64,7 +64,7 @@ void HTMLMetaElement::inserted() break; } default: - dbgln("FIXME: Implement '{}' http-equiv state", attribute(AttributeNames::http_equiv)); + dbgln("FIXME: Implement '{}' http-equiv state", deprecated_attribute(AttributeNames::http_equiv)); break; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index e437189aa4..d37e12ad28 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -69,7 +69,7 @@ void HTMLObjectElement::attribute_changed(DeprecatedFlyString const& name, Depre // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-data DeprecatedString HTMLObjectElement::data() const { - auto data = attribute(HTML::AttributeNames::data); + auto data = deprecated_attribute(HTML::AttributeNames::data); return document().parse_url(data).to_deprecated_string(); } @@ -123,7 +123,7 @@ void HTMLObjectElement::queue_element_task_to_run_object_representation_steps() // FIXME: 3. If the classid attribute is present, and has a value that isn't the empty string, then: if the user agent can find a plugin suitable according to the value of the classid attribute, and plugins aren't being sandboxed, then that plugin should be used, and the value of the data attribute, if any, should be passed to the plugin. If no suitable plugin can be found, or if the plugin reports an error, jump to the step below labeled fallback. // 4. If the data attribute is present and its value is not the empty string, then: - if (auto data = attribute(HTML::AttributeNames::data); !data.is_empty()) { + if (auto data = deprecated_attribute(HTML::AttributeNames::data); !data.is_empty()) { // 1. If the type attribute is present and its value is not a type that the user agent supports, and is not a type that the user agent can find a plugin for, then the user agent may jump to the step below labeled fallback without fetching the content to examine its real type. // 2. Parse a URL given the data attribute, relative to the element's node document. @@ -320,7 +320,7 @@ void HTMLObjectElement::run_object_representation_fallback_steps() void HTMLObjectElement::load_image() { // NOTE: This currently reloads the image instead of reusing the resource we've already downloaded. - auto data = attribute(HTML::AttributeNames::data); + auto data = deprecated_attribute(HTML::AttributeNames::data); auto url = document().parse_url(data); m_image_request = HTML::SharedImageRequest::get_or_create(realm(), *document().page(), url); m_image_request->add_callbacks( diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index 24f8220fa2..d4c8db284c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -39,7 +39,7 @@ public: DeprecatedString data() const; void set_data(DeprecatedString const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); } - DeprecatedString type() const { return attribute(HTML::AttributeNames::type); } + DeprecatedString type() const { return deprecated_attribute(HTML::AttributeNames::type); } // ^FormAssociatedElement // https://html.spec.whatwg.org/multipage/forms.html#category-listed diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index 1e16e708ed..7e20078957 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -51,7 +51,7 @@ void HTMLProgressElement::progress_position_updated() double HTMLProgressElement::value() const { - auto const& value_characters = attribute(HTML::AttributeNames::value); + auto const& value_characters = deprecated_attribute(HTML::AttributeNames::value); if (value_characters == nullptr) return 0; @@ -78,7 +78,7 @@ WebIDL::ExceptionOr HTMLProgressElement::set_value(double value) double HTMLProgressElement::max() const { - auto const& max_characters = attribute(HTML::AttributeNames::max); + auto const& max_characters = deprecated_attribute(HTML::AttributeNames::max); if (max_characters == nullptr) return 1; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 3dc7328624..817adda7b7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -109,7 +109,7 @@ void HTMLScriptElement::execute_script() document->set_current_script({}, nullptr); if (m_from_an_external_file) - dbgln_if(HTML_SCRIPT_DEBUG, "HTMLScriptElement: Running script {}", attribute(HTML::AttributeNames::src)); + dbgln_if(HTML_SCRIPT_DEBUG, "HTMLScriptElement: Running script {}", deprecated_attribute(HTML::AttributeNames::src)); else dbgln_if(HTML_SCRIPT_DEBUG, "HTMLScriptElement: Running inline script"); @@ -181,8 +181,8 @@ void HTMLScriptElement::prepare_script() DeprecatedString script_block_type; bool has_type_attribute = has_attribute(HTML::AttributeNames::type); bool has_language_attribute = has_attribute(HTML::AttributeNames::language); - if ((has_type_attribute && attribute(HTML::AttributeNames::type).is_empty()) - || (!has_type_attribute && has_language_attribute && attribute(HTML::AttributeNames::language).is_empty()) + if ((has_type_attribute && deprecated_attribute(HTML::AttributeNames::type).is_empty()) + || (!has_type_attribute && has_language_attribute && deprecated_attribute(HTML::AttributeNames::language).is_empty()) || (!has_type_attribute && !has_language_attribute)) { // then let the script block's type string for this script element be "text/javascript". script_block_type = "text/javascript"; @@ -190,12 +190,12 @@ void HTMLScriptElement::prepare_script() // Otherwise, if el has a type attribute, else if (has_type_attribute) { // then let the script block's type string be the value of that attribute with leading and trailing ASCII whitespace stripped. - script_block_type = attribute(HTML::AttributeNames::type).trim(Infra::ASCII_WHITESPACE); + script_block_type = deprecated_attribute(HTML::AttributeNames::type).trim(Infra::ASCII_WHITESPACE); } // Otherwise, el has a non-empty language attribute; - else if (!attribute(HTML::AttributeNames::language).is_empty()) { + else if (!deprecated_attribute(HTML::AttributeNames::language).is_empty()) { // let the script block's type string be the concatenation of "text/" and the value of el's language attribute. - script_block_type = DeprecatedString::formatted("text/{}", attribute(HTML::AttributeNames::language)); + script_block_type = DeprecatedString::formatted("text/{}", deprecated_attribute(HTML::AttributeNames::language)); } // 9. If the script block's type string is a JavaScript MIME type essence match, @@ -256,10 +256,10 @@ void HTMLScriptElement::prepare_script() // 20. If el has an event attribute and a for attribute, and el's type is "classic", then: if (m_script_type == ScriptType::Classic && has_attribute(HTML::AttributeNames::event) && has_attribute(HTML::AttributeNames::for_)) { // 1. Let for be the value of el's' for attribute. - auto for_ = attribute(HTML::AttributeNames::for_); + auto for_ = deprecated_attribute(HTML::AttributeNames::for_); // 2. Let event be the value of el's event attribute. - auto event = attribute(HTML::AttributeNames::event); + auto event = deprecated_attribute(HTML::AttributeNames::event); // 3. Strip leading and trailing ASCII whitespace from event and for. for_ = for_.trim(Infra::ASCII_WHITESPACE); @@ -284,7 +284,7 @@ void HTMLScriptElement::prepare_script() Optional encoding; if (has_attribute(HTML::AttributeNames::charset)) { - auto charset = TextCodec::get_standardized_encoding(attribute(HTML::AttributeNames::charset)); + auto charset = TextCodec::get_standardized_encoding(deprecated_attribute(HTML::AttributeNames::charset)); if (charset.has_value()) encoding = String::from_utf8(*charset).release_value_but_fixme_should_propagate_errors(); } @@ -308,7 +308,7 @@ void HTMLScriptElement::prepare_script() // Otherwise, let integrity metadata be the empty string. String integrity_metadata; if (has_attribute(HTML::AttributeNames::integrity)) { - auto integrity = attribute(HTML::AttributeNames::integrity); + auto integrity = deprecated_attribute(HTML::AttributeNames::integrity); integrity_metadata = String::from_deprecated_string(integrity).release_value_but_fixme_should_propagate_errors(); } @@ -346,7 +346,7 @@ void HTMLScriptElement::prepare_script() } // 2. Let src be the value of el's src attribute. - auto src = attribute(HTML::AttributeNames::src); + auto src = deprecated_attribute(HTML::AttributeNames::src); // 3. If src is the empty string, then queue an element task on the DOM manipulation task source given el to fire an event named error at el, and return. if (src.is_empty()) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 7d7b681e26..86a036be79 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -167,7 +167,7 @@ Optional HTMLSelectElement::default_role() const if (has_attribute("multiple")) return ARIA::Role::listbox; if (has_attribute("size")) { - auto size_attribute = attribute("size").to_int(); + auto size_attribute = deprecated_attribute("size").to_int(); if (size_attribute.has_value() && size_attribute.value() > 1) return ARIA::Role::listbox; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index c5f23ae551..0fb700cb5f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -97,7 +97,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl // https://html.spec.whatwg.org/multipage/tables.html#algorithm-for-processing-rows unsigned int HTMLTableCellElement::col_span() const { - auto optional_value = Web::HTML::parse_non_negative_integer(attribute(HTML::AttributeNames::colspan)); + auto optional_value = Web::HTML::parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::colspan)); // If parsing that value failed, or returned zero, or if the attribute is absent, then let colspan be 1, instead. if (!optional_value.has_value() || optional_value.value() == 0) { @@ -124,7 +124,7 @@ WebIDL::ExceptionOr HTMLTableCellElement::set_col_span(unsigned int value) unsigned int HTMLTableCellElement::row_span() const { // If parsing that value failed or if the attribute is absent, then let rowspan be 1, instead. - auto value = Web::HTML::parse_non_negative_integer(attribute(HTML::AttributeNames::rowspan)).value_or(1); + auto value = Web::HTML::parse_non_negative_integer(deprecated_attribute(HTML::AttributeNames::rowspan)).value_or(1); // If rowspan is greater than 65534, let it be 65534 instead. if (value > 65534) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index f661835ac3..957b3852f5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -410,7 +410,7 @@ WebIDL::ExceptionOr HTMLTableElement::delete_row(long index) unsigned int HTMLTableElement::border() const { - return parse_border(attribute(HTML::AttributeNames::border)); + return parse_border(deprecated_attribute(HTML::AttributeNames::border)); } } diff --git a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp index 542b9550ad..e60de73591 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp @@ -77,7 +77,7 @@ WebIDL::ExceptionOr NavigableContainer::create_new_child_navigable() Optional target_name; // 5. If element has a name content attribute, then set targetName to the value of that attribute. - if (auto value = attribute(HTML::AttributeNames::name); !value.is_null()) + if (auto value = deprecated_attribute(HTML::AttributeNames::name); !value.is_null()) target_name = String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors(); // 6. Let documentState be a new document state, with @@ -152,7 +152,7 @@ void NavigableContainer::create_new_nested_browsing_context() m_nested_browsing_context->register_frame_nesting(document().url()); // 4. If element has a name attribute, then set browsingContext's name to the value of this attribute. - if (auto name = attribute(HTML::AttributeNames::name); !name.is_empty()) + if (auto name = deprecated_attribute(HTML::AttributeNames::name); !name.is_empty()) m_nested_browsing_context->set_name(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors()); } @@ -220,7 +220,7 @@ void NavigableContainer::shared_attribute_processing_steps_for_iframe_and_frame( // 2. If element has a src attribute specified, and its value is not the empty string, // then parse the value of that attribute relative to element's node document. // If this is successful, then set url to the resulting URL record. - auto src_attribute_value = attribute(HTML::AttributeNames::src); + auto src_attribute_value = deprecated_attribute(HTML::AttributeNames::src); if (!src_attribute_value.is_null() && !src_attribute_value.is_empty()) { auto parsed_src = document().parse_url(src_attribute_value); if (parsed_src.is_valid()) diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp index c3af216ff1..f9a468c385 100644 --- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp @@ -24,8 +24,8 @@ void FrameBox::prepare_for_replaced_layout() VERIFY(dom_node().nested_browsing_context()); // FIXME: Do proper error checking, etc. - set_natural_width(dom_node().attribute(HTML::AttributeNames::width).to_int().value_or(300)); - set_natural_height(dom_node().attribute(HTML::AttributeNames::height).to_int().value_or(150)); + set_natural_width(dom_node().deprecated_attribute(HTML::AttributeNames::width).to_int().value_or(300)); + set_natural_height(dom_node().deprecated_attribute(HTML::AttributeNames::height).to_int().value_or(150)); } void FrameBox::did_set_content_size() diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp index 4476f06362..519f511352 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.cpp +++ b/Userland/Libraries/LibWeb/Layout/Label.cpp @@ -93,7 +93,7 @@ Label const* Label::label_for_control_node(LabelableNode const& control) // same tree as the label element. If the attribute is specified and there is an element in the tree // whose ID is equal to the value of the for attribute, and the first such element in tree order is // a labelable element, then that element is the label element's labeled control. - if (auto id = control.dom_node().attribute(HTML::AttributeNames::id); !id.is_empty()) { + if (auto id = control.dom_node().deprecated_attribute(HTML::AttributeNames::id); !id.is_empty()) { Label const* label = nullptr; control.document().layout_node()->for_each_in_inclusive_subtree_of_type