TableCellBox.cpp 858 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Element.h>
  7. #include <LibWeb/Layout/TableCellBox.h>
  8. #include <LibWeb/Layout/TableRowBox.h>
  9. namespace Web::Layout {
  10. TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
  11. : Layout::BlockContainer(document, element, move(style))
  12. {
  13. }
  14. TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
  15. : Layout::BlockContainer(document, element, move(computed_values))
  16. {
  17. }
  18. TableCellBox::~TableCellBox()
  19. {
  20. }
  21. size_t TableCellBox::colspan() const
  22. {
  23. if (!dom_node())
  24. return 1;
  25. return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
  26. }
  27. }