HTMLImageElement.cpp 758 B

123456789101112131415161718192021222324
  1. #include <LibHTML/CSS/StyleResolver.h>
  2. #include <LibHTML/DOM/HTMLImageElement.h>
  3. #include <LibHTML/Layout/LayoutImage.h>
  4. HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name)
  5. : HTMLElement(document, tag_name)
  6. {
  7. }
  8. HTMLImageElement::~HTMLImageElement()
  9. {
  10. }
  11. RefPtr<LayoutNode> HTMLImageElement::create_layout_node(const StyleResolver& resolver, const StyleProperties* parent_style) const
  12. {
  13. auto style = resolver.resolve_style(*this, parent_style);
  14. auto display_property = style->property("display");
  15. String display = display_property.has_value() ? display_property.release_value()->to_string() : "inline";
  16. if (display == "none")
  17. return nullptr;
  18. return adopt(*new LayoutImage(*this, move(style)));
  19. }