2020-06-13 22:24:49 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-13 22:24:49 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibCore/Forward.h>
|
|
|
|
#include <LibGfx/Forward.h>
|
2021-10-14 16:18:49 +01:00
|
|
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
2020-06-13 22:24:49 +02:00
|
|
|
#include <LibWeb/Loader/ImageLoader.h>
|
|
|
|
|
2020-07-28 18:20:36 +02:00
|
|
|
namespace Web::HTML {
|
2020-06-13 22:24:49 +02:00
|
|
|
|
2022-03-23 08:24:11 -04:00
|
|
|
class HTMLObjectElement final
|
|
|
|
: public FormAssociatedElement
|
|
|
|
, public ResourceClient {
|
2020-06-13 22:24:49 +02:00
|
|
|
public:
|
2020-07-27 05:04:26 +01:00
|
|
|
using WrapperType = Bindings::HTMLObjectElementWrapper;
|
|
|
|
|
2022-02-18 21:00:52 +01:00
|
|
|
HTMLObjectElement(DOM::Document&, DOM::QualifiedName);
|
2020-06-13 22:24:49 +02:00
|
|
|
virtual ~HTMLObjectElement() override;
|
|
|
|
|
|
|
|
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
|
|
|
|
2022-03-23 08:24:11 -04:00
|
|
|
String data() const;
|
|
|
|
void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); }
|
|
|
|
|
2020-06-13 22:24:49 +02:00
|
|
|
String type() const { return attribute(HTML::AttributeNames::type); }
|
|
|
|
|
2022-03-01 21:03:30 +00:00
|
|
|
// ^FormAssociatedElement
|
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
|
|
|
virtual bool is_listed() const override { return true; }
|
|
|
|
|
2020-06-13 22:24:49 +02:00
|
|
|
private:
|
2022-02-05 13:17:01 +01:00
|
|
|
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
2020-06-13 22:24:49 +02:00
|
|
|
|
2022-03-23 08:24:11 -04:00
|
|
|
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;
|
2020-06-13 22:24:49 +02:00
|
|
|
bool m_should_show_fallback_content { false };
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|