mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:17:46 +00:00
LibWeb: Port Element::attribute_changed from DeprecatedString to String
Which as you would expect has a bunch of fallout, but also results in a whole lot of awkward conversions falling away.
This commit is contained in:
parent
6a2a7cad61
commit
eca9874e56
77 changed files with 178 additions and 193 deletions
|
@ -27,7 +27,7 @@ void HTMLAnchorElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAnchorElementPrototype>(realm, "HTMLAnchorElement"));
|
||||
}
|
||||
|
||||
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (name == HTML::AttributeNames::href) {
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
void run_activation_behavior(Web::DOM::Event const&);
|
||||
|
||||
// ^DOM::Element
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// ^HTML::HTMLHyperlinkElementUtils
|
||||
|
|
|
@ -23,7 +23,7 @@ void HTMLAreaElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAreaElementPrototype>(realm, "HTMLAreaElement"));
|
||||
}
|
||||
|
||||
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (name == HTML::AttributeNames::href) {
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
// ^DOM::Element
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// ^HTML::HTMLHyperlinkElementUtils
|
||||
|
|
|
@ -43,7 +43,7 @@ void HTMLBaseElement::removed_from(Node* parent)
|
|||
document().update_base_element({});
|
||||
}
|
||||
|
||||
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
virtual void inserted() override;
|
||||
virtual void removed_from(Node*) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
private:
|
||||
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -55,26 +55,26 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (name.equals_ignoring_ascii_case("link"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-3
|
||||
auto color = parse_legacy_color_value(value.value_or(""));
|
||||
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
|
||||
if (color.has_value())
|
||||
document().set_link_color(color.value());
|
||||
} else if (name.equals_ignoring_ascii_case("alink"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-5
|
||||
auto color = parse_legacy_color_value(value.value_or(""));
|
||||
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
|
||||
if (color.has_value())
|
||||
document().set_active_link_color(color.value());
|
||||
} else if (name.equals_ignoring_ascii_case("vlink"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-4
|
||||
auto color = parse_legacy_color_value(value.value_or(""));
|
||||
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
|
||||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value.value_or("")));
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value.value_or(String {})));
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (layout_node()) {
|
||||
layout_node()->set_needs_display();
|
||||
|
@ -83,9 +83,9 @@ void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<Deprecat
|
|||
}
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value.map([](auto& v) { return MUST(String::from_deprecated_string(v)); })); \
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value); \
|
||||
}
|
||||
ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
|
|
|
@ -20,7 +20,7 @@ class HTMLBodyElement final
|
|||
public:
|
||||
virtual ~HTMLBodyElement() override;
|
||||
|
||||
virtual void attribute_changed(FlyString const&, Optional<DeprecatedString> const&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
// https://www.w3.org/TR/html-aria/#el-body
|
||||
|
|
|
@ -41,7 +41,7 @@ void HTMLDetailsElement::initialize(JS::Realm& realm)
|
|||
create_shadow_tree(realm).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void children_changed() override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
void queue_a_details_toggle_event_task(String old_state, String new_state);
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ bool HTMLElement::cannot_navigate() const
|
|||
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
|
||||
}
|
||||
|
||||
void HTMLElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
Element::attribute_changed(name, value);
|
||||
|
||||
|
@ -248,9 +248,9 @@ void HTMLElement::attribute_changed(FlyString const& name, Optional<DeprecatedSt
|
|||
// 1. If namespace is not null, or localName is not the name of an event handler content attribute on element, then return.
|
||||
// FIXME: Add the namespace part once we support attribute namespaces.
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value.map([](auto& v) { return MUST(String::from_deprecated_string(v)); })); \
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value); \
|
||||
}
|
||||
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ void HTMLFrameSetElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameSetElementPrototype>(realm, "HTMLFrameSetElement"));
|
||||
}
|
||||
|
||||
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value.map([](auto& v) { return MUST(String::from_deprecated_string(v)); })); \
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
if (name == HTML::AttributeNames::attribute_name) { \
|
||||
element_event_handler_attribute_changed(event_name, value); \
|
||||
}
|
||||
ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
|
|
|
@ -24,7 +24,7 @@ private:
|
|||
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<DeprecatedString> const&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
|
||||
// ^HTML::GlobalEventHandlers
|
||||
virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override;
|
||||
|
|
|
@ -33,7 +33,7 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
|
|||
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (m_content_navigable)
|
||||
|
|
|
@ -36,7 +36,7 @@ private:
|
|||
// ^DOM::Element
|
||||
virtual void inserted() override;
|
||||
virtual void removed_from(Node*) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
|
||||
|
|
|
@ -95,16 +95,12 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLImageElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLImageElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
|
||||
if (name == HTML::AttributeNames::crossorigin) {
|
||||
if (!value.has_value()) {
|
||||
m_cors_setting = CORSSettingAttribute::NoCORS;
|
||||
} else {
|
||||
m_cors_setting = cors_setting_attribute_from_keyword(String::from_deprecated_string(*value).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
m_cors_setting = cors_setting_attribute_from_keyword(value);
|
||||
}
|
||||
|
||||
if (name.is_one_of(HTML::AttributeNames::src, HTML::AttributeNames::srcset)) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class HTMLImageElement final
|
|||
public:
|
||||
virtual ~HTMLImageElement() override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
DeprecatedString alt() const { return deprecated_attribute(HTML::AttributeNames::alt); }
|
||||
DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); }
|
||||
|
|
|
@ -627,7 +627,7 @@ void HTMLInputElement::did_lose_focus()
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLInputElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLInputElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (name == HTML::AttributeNames::checked) {
|
||||
|
@ -643,7 +643,7 @@ void HTMLInputElement::attribute_changed(FlyString const& name, Optional<Depreca
|
|||
set_checked(true, ChangeSource::Programmatic);
|
||||
}
|
||||
} else if (name == HTML::AttributeNames::type) {
|
||||
m_type = parse_type_attribute(value.value_or(""));
|
||||
m_type = parse_type_attribute(value.value_or(String {}));
|
||||
} else if (name == HTML::AttributeNames::value) {
|
||||
if (!value.has_value()) {
|
||||
if (!m_dirty_value) {
|
||||
|
@ -655,7 +655,7 @@ void HTMLInputElement::attribute_changed(FlyString const& name, Optional<Depreca
|
|||
}
|
||||
} else {
|
||||
if (!m_dirty_value) {
|
||||
m_value = value_sanitization_algorithm(*value);
|
||||
m_value = value_sanitization_algorithm(value->to_deprecated_string());
|
||||
update_placeholder_visibility();
|
||||
|
||||
if (type_state() == TypeAttributeState::Color && m_color_well_element)
|
||||
|
@ -664,12 +664,9 @@ void HTMLInputElement::attribute_changed(FlyString const& name, Optional<Depreca
|
|||
}
|
||||
} else if (name == HTML::AttributeNames::placeholder) {
|
||||
if (m_placeholder_text_node)
|
||||
m_placeholder_text_node->set_data(MUST(String::from_deprecated_string(value.value_or(""))));
|
||||
m_placeholder_text_node->set_data(value.value_or(String {}));
|
||||
} else if (name == HTML::AttributeNames::readonly) {
|
||||
if (value.has_value())
|
||||
handle_readonly_attribute(MUST(String::from_deprecated_string(*value)));
|
||||
else
|
||||
handle_readonly_attribute({});
|
||||
handle_readonly_attribute(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
|
||||
|
||||
// ^HTMLElement
|
||||
virtual void attribute_changed(FlyString const&, Optional<DeprecatedString> const&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Platform/ImageCodecPlugin.h>
|
||||
|
@ -77,7 +78,7 @@ bool HTMLLinkElement::has_loaded_icon() const
|
|||
return m_relationship & Relationship::Icon && resource() && resource()->is_loaded() && resource()->has_encoded_data();
|
||||
}
|
||||
|
||||
void HTMLLinkElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLLinkElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
|
||||
|
@ -85,11 +86,11 @@ void HTMLLinkElement::attribute_changed(FlyString const& name, Optional<Deprecat
|
|||
if (name == HTML::AttributeNames::rel) {
|
||||
m_relationship = 0;
|
||||
// Keywords are always ASCII case-insensitive, and must be compared as such.
|
||||
auto lowercased_value = value.value_or("").to_lowercase();
|
||||
auto lowercased_value = MUST(Infra::to_ascii_lowercase(value.value_or(String {})));
|
||||
// To determine which link types apply to a link, a, area, or form element,
|
||||
// the element's rel attribute must be split on ASCII whitespace.
|
||||
// The resulting tokens are the keywords for the link types that apply to that element.
|
||||
auto parts = lowercased_value.split_view(Infra::is_ascii_whitespace);
|
||||
auto parts = lowercased_value.bytes_as_string_view().split_view_if(Infra::is_ascii_whitespace);
|
||||
for (auto& part : parts) {
|
||||
if (part == "stylesheet"sv)
|
||||
m_relationship |= Relationship::Stylesheet;
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
void attribute_changed(FlyString const&, Optional<DeprecatedString> const&) override;
|
||||
void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
|
||||
// ^ResourceClient
|
||||
virtual void resource_did_fail() override;
|
||||
|
|
|
@ -83,17 +83,14 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_fetch_controller);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
|
||||
if (name == HTML::AttributeNames::src) {
|
||||
load_element().release_value_but_fixme_should_propagate_errors();
|
||||
} else if (name == HTML::AttributeNames::crossorigin) {
|
||||
if (!value.has_value())
|
||||
m_crossorigin = cors_setting_attribute_from_keyword({});
|
||||
else
|
||||
m_crossorigin = cors_setting_attribute_from_keyword(String::from_deprecated_string(*value).release_value_but_fixme_should_propagate_errors());
|
||||
m_crossorigin = cors_setting_attribute_from_keyword(value);
|
||||
} else if (name == HTML::AttributeNames::muted) {
|
||||
set_muted(true);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ protected:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void removed_from(DOM::Node*) override;
|
||||
virtual void children_changed() override;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void HTMLObjectElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_image_request);
|
||||
}
|
||||
|
||||
void HTMLObjectElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLObjectElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
NavigableContainer::attribute_changed(name, value);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class HTMLObjectElement final
|
|||
public:
|
||||
virtual ~HTMLObjectElement() override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
String data() const;
|
||||
void set_data(String const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }
|
||||
|
|
|
@ -31,7 +31,7 @@ void HTMLOptionElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement"));
|
||||
}
|
||||
|
||||
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
void ask_for_a_reset();
|
||||
|
||||
|
|
|
@ -45,15 +45,12 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_preparation_time_document);
|
||||
}
|
||||
|
||||
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
|
||||
if (name == HTML::AttributeNames::crossorigin) {
|
||||
if (!value.has_value())
|
||||
m_crossorigin = cors_setting_attribute_from_keyword({});
|
||||
else
|
||||
m_crossorigin = cors_setting_attribute_from_keyword(String::from_deprecated_string(*value).release_value_but_fixme_should_propagate_errors());
|
||||
m_crossorigin = cors_setting_attribute_from_keyword(value);
|
||||
} else if (name == HTML::AttributeNames::referrerpolicy) {
|
||||
if (!value.has_value())
|
||||
m_referrer_policy.clear();
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
|
||||
void prepare_script();
|
||||
|
|
|
@ -24,11 +24,11 @@ HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qua
|
|||
return;
|
||||
|
||||
// 2. If value is null and oldValue is the empty string, then return.
|
||||
if (!value.has_value() && old_value == DeprecatedString::empty())
|
||||
if (!value.has_value() && old_value == String {})
|
||||
return;
|
||||
|
||||
// 3. If value is the empty string and oldValue is null, then return.
|
||||
if (value == DeprecatedString::empty() && !old_value.has_value())
|
||||
if (value == String {} && !old_value.has_value())
|
||||
return;
|
||||
|
||||
// 4. If value is null or the empty string, then set element’s name to the empty string.
|
||||
|
@ -36,7 +36,7 @@ HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qua
|
|||
set_slot_name({});
|
||||
// 5. Otherwise, set element’s name to value.
|
||||
else
|
||||
set_slot_name(MUST(String::from_deprecated_string(*value)));
|
||||
set_slot_name(*value);
|
||||
|
||||
// 6. Run assign slottables for a tree with element’s root.
|
||||
DOM::assign_slottables_for_a_tree(root());
|
||||
|
|
|
@ -40,15 +40,12 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_fetch_controller);
|
||||
}
|
||||
|
||||
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
|
||||
if (name == HTML::AttributeNames::poster) {
|
||||
if (!value.has_value())
|
||||
determine_element_poster_frame({}).release_value_but_fixme_should_propagate_errors();
|
||||
else
|
||||
determine_element_poster_frame(*value).release_value_but_fixme_should_propagate_errors();
|
||||
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +123,7 @@ void HTMLVideoElement::on_seek(double position, MediaSeekMode seek_mode)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#attr-video-poster
|
||||
WebIDL::ExceptionOr<void> HTMLVideoElement::determine_element_poster_frame(Optional<StringView> const& poster)
|
||||
WebIDL::ExceptionOr<void> HTMLVideoElement::determine_element_poster_frame(Optional<String> const& poster)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
auto& vm = realm.vm();
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
virtual void on_paused() override;
|
||||
virtual void on_seek(double, MediaSeekMode) override;
|
||||
|
||||
WebIDL::ExceptionOr<void> determine_element_poster_frame(Optional<StringView> const& poster);
|
||||
WebIDL::ExceptionOr<void> determine_element_poster_frame(Optional<String> const& poster);
|
||||
|
||||
JS::GCPtr<HTML::VideoTrack> m_video_track;
|
||||
VideoFrame m_current_frame;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue