1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 13:24:58 +00:00

LibWeb: Implement HTMLObjectElement's data URL according to the spec

There are a long list of conditions under which the HTMLObjectElement is
to queue an element task to load / determine an object's representation.
This handles the case where the data attribute has changed.

Much of the spec for determining the object's representation is not
implemented here. Namely, anything to do with XML documents or browser
plugins are left as FIXMEs.
This commit is contained in:
Timothy Flynn 2022-03-23 08:24:11 -04:00 committed by Andreas Kling
parent 90829fe880
commit bf7b51a569
3 changed files with 213 additions and 23 deletions

View file

@ -13,7 +13,9 @@
namespace Web::HTML {
class HTMLObjectElement final : public FormAssociatedElement {
class HTMLObjectElement final
: public FormAssociatedElement
, public ResourceClient {
public:
using WrapperType = Bindings::HTMLObjectElementWrapper;
@ -22,7 +24,9 @@ public:
virtual void parse_attribute(const FlyString& name, const String& value) override;
String data() const { return attribute(HTML::AttributeNames::data); }
String data() const;
void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); }
String type() const { return attribute(HTML::AttributeNames::type); }
// ^FormAssociatedElement
@ -32,7 +36,18 @@ public:
private:
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
ImageLoader m_image_loader;
void queue_element_task_to_run_object_representation_steps();
void run_object_representation_handler_steps(StringView resource_type);
void run_object_representation_completed_steps();
void run_object_representation_fallback_steps();
void convert_resource_to_image();
// ^ResourceClient
virtual void resource_did_load() override;
virtual void resource_did_fail() override;
Optional<ImageLoader> m_image_loader;
bool m_should_show_fallback_content { false };
};