HTMLObjectElement.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/HTML/HTMLElement.h>
  11. #include <LibWeb/Loader/ImageLoader.h>
  12. namespace Web::HTML {
  13. class HTMLObjectElement final
  14. : public HTMLElement
  15. , public FormAssociatedElement
  16. , public ResourceClient {
  17. FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLObjectElement)
  18. public:
  19. using WrapperType = Bindings::HTMLObjectElementWrapper;
  20. HTMLObjectElement(DOM::Document&, DOM::QualifiedName);
  21. virtual ~HTMLObjectElement() override;
  22. virtual void parse_attribute(const FlyString& name, const String& value) override;
  23. String data() const;
  24. void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); }
  25. String type() const { return attribute(HTML::AttributeNames::type); }
  26. // ^FormAssociatedElement
  27. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  28. virtual bool is_listed() const override { return true; }
  29. private:
  30. virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  31. void queue_element_task_to_run_object_representation_steps();
  32. void run_object_representation_handler_steps(StringView resource_type);
  33. void run_object_representation_completed_steps();
  34. void run_object_representation_fallback_steps();
  35. void convert_resource_to_image();
  36. void update_layout_and_child_objects();
  37. // ^ResourceClient
  38. virtual void resource_did_load() override;
  39. virtual void resource_did_fail() override;
  40. Optional<ImageLoader> m_image_loader;
  41. bool m_should_show_fallback_content { false };
  42. };
  43. }