Diff
Modified: trunk/LayoutTests/ChangeLog (262106 => 262107)
--- trunk/LayoutTests/ChangeLog 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/LayoutTests/ChangeLog 2020-05-24 15:34:44 UTC (rev 262107)
@@ -1,5 +1,15 @@
2020-05-24 Zalan Bujtas <[email protected]>
+ [LFC][TFC] Take sections into account when computing collapsed border.
+ https://bugs.webkit.org/show_bug.cgi?id=212311
+
+ Reviewed by Antti Koivisto.
+
+ * fast/layoutformattingcontext/table-simple-collapsed-tbody-border-expected.html: Added.
+ * fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html: Added.
+
+2020-05-24 Zalan Bujtas <[email protected]>
+
[LFC][TFC] Take collapsed in-between row border into account when computing cell height
https://bugs.webkit.org/show_bug.cgi?id=212307
Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border-expected.html (0 => 262107)
--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border-expected.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border-expected.html 2020-05-24 15:34:44 UTC (rev 262107)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+ height: 40px;
+ width: 40px;
+ border: 10px solid green;
+}
+</style>
+<div></div>
Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html (0 => 262107)
--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html 2020-05-24 15:34:44 UTC (rev 262107)
@@ -0,0 +1,21 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+ border-collapse: collapse;
+}
+td {
+ width: 20px;
+ height: 20px;
+ padding: 0px;
+ border: 0px solid green;
+}
+
+tbody {
+ border: 10px solid green;
+}
+</style>
+<table><tbody>
+<tr><td></td><td></td></tr>
+<tr><td></td><td></td></tr>
+</tbody>
+</table>
Modified: trunk/Source/WebCore/ChangeLog (262106 => 262107)
--- trunk/Source/WebCore/ChangeLog 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/Source/WebCore/ChangeLog 2020-05-24 15:34:44 UTC (rev 262107)
@@ -1,5 +1,28 @@
2020-05-24 Zalan Bujtas <[email protected]>
+ [LFC][TFC] Take sections into account when computing collapsed border.
+ https://bugs.webkit.org/show_bug.cgi?id=212311
+
+ Reviewed by Antti Koivisto.
+
+ Test: fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html
+
+ * layout/Verification.cpp:
+ (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
+ * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
+ (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
+ * layout/tableformatting/TableGrid.cpp:
+ (WebCore::Layout::TableGrid::Section::Section):
+ (WebCore::Layout::TableGrid::appendCell):
+ * layout/tableformatting/TableGrid.h:
+ (WebCore::Layout::TableGrid::Section::box const):
+ (WebCore::Layout::TableGrid::sections const):
+ (WebCore::Layout::TableGrid::sections):
+
+2020-05-24 Zalan Bujtas <[email protected]>
+
[LFC][TFC] Take collapsed in-between row border into account when computing cell height
https://bugs.webkit.org/show_bug.cgi?id=212307
Modified: trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp (262106 => 262107)
--- trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp 2020-05-24 15:34:44 UTC (rev 262107)
@@ -111,14 +111,23 @@
bottomBorder = std::max(bottomBorder, geometry().computedBorder(boxInLastRow).vertical.bottom);
}
+ auto& sections = grid.sections();
+ topBorder = std::max(topBorder, geometry().computedBorder(sections.first().box()).vertical.top);
+ for (auto& section : sections) {
+ auto horiztonalBorder = geometry().computedBorder(section.box()).horizontal;
+ leftBorder = std::max(leftBorder, horiztonalBorder.left);
+ rightBorder = std::max(rightBorder, horiztonalBorder.right);
+ }
+ bottomBorder = std::max(bottomBorder, geometry().computedBorder(sections.last().box()).vertical.bottom);
+
auto& rows = grid.rows().list();
- topBorder = std::max(topBorder, geometry().computedBorder(rows[0].box()).vertical.top);
+ topBorder = std::max(topBorder, geometry().computedBorder(rows.first().box()).vertical.top);
for (auto& row : rows) {
auto horiztonalBorder = geometry().computedBorder(row.box()).horizontal;
leftBorder = std::max(leftBorder, horiztonalBorder.left);
rightBorder = std::max(rightBorder, horiztonalBorder.right);
}
- bottomBorder = std::max(topBorder, geometry().computedBorder(rows[rows.size() - 1].box()).vertical.bottom);
+ bottomBorder = std::max(bottomBorder, geometry().computedBorder(rows.last().box()).vertical.bottom);
auto collapsedBorder = Edges { { leftBorder, rightBorder }, { topBorder, bottomBorder } };
grid.setCollapsedBorder(collapsedBorder);
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (262106 => 262107)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-05-24 15:34:44 UTC (rev 262107)
@@ -190,11 +190,12 @@
auto& grid = formattingState().tableGrid();
auto sectionWidth = grid.columns().logicalWidth() + 2 * grid.horizontalSpacing();
auto logicalTop = constraints.vertical.logicalTop;
- for (auto& section : childrenOfType<ContainerBox>(root())) {
- auto& sectionDisplayBox = formattingState().displayBox(section);
+ for (auto& section : grid.sections()) {
+ auto& sectionBox = section.box();
+ auto& sectionDisplayBox = formattingState().displayBox(sectionBox);
// FIXME: Multiple sections can have their own borders.
- sectionDisplayBox.setBorder(grid.collapsedBorder() ? Edges(): geometry().computedBorder(section));
- sectionDisplayBox.setPadding(geometry().computedPadding(section, constraints.horizontal.logicalWidth));
+ sectionDisplayBox.setBorder(grid.collapsedBorder() ? Edges(): geometry().computedBorder(sectionBox));
+ sectionDisplayBox.setPadding(geometry().computedPadding(sectionBox, constraints.horizontal.logicalWidth));
// Internal table elements do not have margins.
sectionDisplayBox.setHorizontalMargin({ });
sectionDisplayBox.setHorizontalComputedMargin({ });
Modified: trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp (262106 => 262107)
--- trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp 2020-05-24 15:34:44 UTC (rev 262107)
@@ -35,6 +35,11 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(TableGrid);
+TableGrid::Section::Section(const ContainerBox& sectionBox)
+ : m_layoutBox(makeWeakPtr(sectionBox))
+{
+}
+
TableGrid::Column::Column(const ContainerBox* columnBox)
: m_layoutBox(makeWeakPtr(columnBox))
{
@@ -178,6 +183,14 @@
if (isInNewRow)
m_rows.addRow(cellBox.parent());
+ auto& lastRowBox = m_rows.list().last().box();
+ auto needsNewSection = m_sections.isEmpty() || &lastRowBox.parent() != &m_sections.last().box();
+ if (needsNewSection) {
+ auto& tableSection = lastRowBox.parent();
+ ASSERT(tableSection.isTableHeader() || tableSection.isTableBody() || tableSection.isTableFooter());
+ m_sections.append({ tableSection });
+ }
+
m_cells.add(WTFMove(cell));
}
Modified: trunk/Source/WebCore/layout/tableformatting/TableGrid.h (262106 => 262107)
--- trunk/Source/WebCore/layout/tableformatting/TableGrid.h 2020-05-24 15:23:51 UTC (rev 262106)
+++ trunk/Source/WebCore/layout/tableformatting/TableGrid.h 2020-05-24 15:34:44 UTC (rev 262107)
@@ -61,6 +61,16 @@
void setWidthConstraints(FormattingContext::IntrinsicWidthConstraints intrinsicWidthConstraints) { m_intrinsicWidthConstraints = intrinsicWidthConstraints; }
Optional<FormattingContext::IntrinsicWidthConstraints> widthConstraints() const { return m_intrinsicWidthConstraints; }
+ class Section {
+ public:
+ Section(const ContainerBox&);
+
+ const ContainerBox& box() const { return *m_layoutBox.get(); }
+
+ private:
+ WeakPtr<const ContainerBox> m_layoutBox;
+ };
+
// Column represents a vertical set of slots in the grid. A column has horizontal position and width.
class Column {
public:
@@ -207,6 +217,10 @@
FormattingContext::IntrinsicWidthConstraints m_widthConstraints;
};
+ using Sections = Vector<Section>;
+ const Sections& sections() const { return m_sections; }
+ Sections& sections() { return m_sections; }
+
const Columns& columns() const { return m_columns; }
Columns& columns() { return m_columns; }
@@ -226,6 +240,7 @@
Columns m_columns;
Rows m_rows;
Cells m_cells;
+ Sections m_sections;
SlotMap m_slotMap;
LayoutUnit m_horizontalSpacing;