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