2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2020-03-07 06:32:51 -03:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
2020-11-22 11:53:01 -03:00
|
|
|
#include <LibWeb/Layout/TableCellBox.h>
|
|
|
|
|
#include <LibWeb/Layout/TableRowBox.h>
|
2019-10-17 18:09:41 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
namespace Web::Layout {
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2021-01-07 12:37:51 -03:00
|
|
|
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
2021-10-06 15:02:41 -03:00
|
|
|
: Layout::BlockContainer(document, element, move(style))
|
2021-01-07 12:37:51 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
|
2021-10-06 15:02:41 -03:00
|
|
|
: Layout::BlockContainer(document, element, move(computed_values))
|
2019-10-17 18:09:41 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 16:21:51 -03:00
|
|
|
TableCellBox::~TableCellBox() = default;
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
size_t TableCellBox::colspan() const
|
2020-06-12 19:10:52 -03:00
|
|
|
{
|
2021-01-07 12:37:51 -03:00
|
|
|
if (!dom_node())
|
2021-02-06 19:25:58 -03:00
|
|
|
return 1;
|
2021-06-24 14:53:42 -03:00
|
|
|
return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
|
2020-06-12 19:10:52 -03:00
|
|
|
}
|
|
|
|
|
|
2020-03-07 06:27:02 -03:00
|
|
|
}
|