HTMLImageElement.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteBuffer.h>
  8. #include <AK/OwnPtr.h>
  9. #include <LibGfx/Forward.h>
  10. #include <LibWeb/HTML/FormAssociatedElement.h>
  11. #include <LibWeb/Loader/ImageLoader.h>
  12. namespace Web::HTML {
  13. class HTMLImageElement final : public FormAssociatedElement {
  14. public:
  15. using WrapperType = Bindings::HTMLImageElementWrapper;
  16. HTMLImageElement(DOM::Document&, DOM::QualifiedName);
  17. virtual ~HTMLImageElement() override;
  18. virtual void parse_attribute(const FlyString& name, const String& value) override;
  19. String alt() const { return attribute(HTML::AttributeNames::alt); }
  20. String src() const { return attribute(HTML::AttributeNames::src); }
  21. const Gfx::Bitmap* bitmap() const;
  22. unsigned width() const;
  23. void set_width(unsigned);
  24. unsigned height() const;
  25. void set_height(unsigned);
  26. private:
  27. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  28. void animate();
  29. virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  30. ImageLoader m_image_loader;
  31. };
  32. }