HTMLTableCaptionElement.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/Intrinsics.h>
  7. #include <LibWeb/HTML/HTMLTableCaptionElement.h>
  8. namespace Web::HTML {
  9. HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  10. : HTMLElement(document, move(qualified_name))
  11. {
  12. }
  13. HTMLTableCaptionElement::~HTMLTableCaptionElement() = default;
  14. void HTMLTableCaptionElement::initialize(JS::Realm& realm)
  15. {
  16. Base::initialize(realm);
  17. set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableCaptionElementPrototype>(realm, "HTMLTableCaptionElement"));
  18. }
  19. // https://html.spec.whatwg.org/multipage/rendering.html#tables-2
  20. void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& style) const
  21. {
  22. HTMLElement::apply_presentational_hints(style);
  23. for_each_attribute([&](auto& name, auto& value) {
  24. if (name.equals_ignoring_case("align"sv)) {
  25. if (value == "bottom"sv)
  26. style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom));
  27. }
  28. });
  29. }
  30. }