HTMLObjectElement.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibCore/Forward.h>
  8. #include <LibGfx/Forward.h>
  9. #include <LibWeb/HTML/FormAssociatedElement.h>
  10. #include <LibWeb/Loader/ImageLoader.h>
  11. namespace Web::HTML {
  12. class HTMLObjectElement final
  13. : public FormAssociatedElement
  14. , public ResourceClient {
  15. public:
  16. using WrapperType = Bindings::HTMLObjectElementWrapper;
  17. HTMLObjectElement(DOM::Document&, DOM::QualifiedName);
  18. virtual ~HTMLObjectElement() override;
  19. virtual void parse_attribute(const FlyString& name, const String& value) override;
  20. String data() const;
  21. void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); }
  22. String type() const { return attribute(HTML::AttributeNames::type); }
  23. // ^FormAssociatedElement
  24. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  25. virtual bool is_listed() const override { return true; }
  26. private:
  27. virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  28. void queue_element_task_to_run_object_representation_steps();
  29. void run_object_representation_handler_steps(StringView resource_type);
  30. void run_object_representation_completed_steps();
  31. void run_object_representation_fallback_steps();
  32. void convert_resource_to_image();
  33. // ^ResourceClient
  34. virtual void resource_did_load() override;
  35. virtual void resource_did_fail() override;
  36. Optional<ImageLoader> m_image_loader;
  37. bool m_should_show_fallback_content { false };
  38. };
  39. }