Skip to content

Commit 0061a82

Browse files
committed
LibWeb: Add LayoutTableCell::colspan()
A convenient function for looking up a cell's colspan attribute.
1 parent 196a398 commit 0061a82

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Libraries/LibWeb/Layout/LayoutTableCell.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@ LayoutTableCell::~LayoutTableCell()
3838
{
3939
}
4040

41+
size_t LayoutTableCell::colspan() const
42+
{
43+
ASSERT(node());
44+
return to<Element>(*node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
45+
}
46+
4147
}

Libraries/LibWeb/Layout/LayoutTableCell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class LayoutTableCell final : public LayoutBlock {
3838
LayoutTableCell* next_cell() { return next_sibling_of_type<LayoutTableCell>(); }
3939
const LayoutTableCell* next_cell() const { return next_sibling_of_type<LayoutTableCell>(); }
4040

41+
size_t colspan() const;
42+
4143
private:
4244
virtual bool is_table_cell() const override { return true; }
4345
virtual const char* class_name() const override { return "LayoutTableCell"; }

0 commit comments

Comments
 (0)