TableCellBox.cpp 865 B

1234567891011121314151617181920212223242526272829303132
  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() = default;
  19. size_t TableCellBox::colspan() const
  20. {
  21. if (!dom_node())
  22. return 1;
  23. return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
  24. }
  25. }