Changeset 261991 in webkit
- Timestamp:
- May 21, 2020 5:33:00 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261989 r261991 1 2020-05-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Collapse in-between cell borders 4 https://bugs.webkit.org/show_bug.cgi?id=212183 5 6 Reviewed by Antti Koivisto. 7 8 * fast/layoutformattingcontext/table-simple-border-collapse3-expected.html: Added. 9 * fast/layoutformattingcontext/table-simple-border-collapse3.html: Added. 10 1 11 2020-05-21 Diego Pino Garcia <dpino@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r261986 r261991 1 2020-05-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Collapse in-between cell borders 4 https://bugs.webkit.org/show_bug.cgi?id=212183 5 6 Reviewed by Antti Koivisto. 7 8 This patch expands border collapsing to in-between cell borders. 9 10 Test: fast/layoutformattingcontext/table-simple-border-collapse3.html 11 12 * layout/tableformatting/TableFormattingContext.cpp: 13 (WebCore::Layout::TableFormattingContext::layoutCell): 14 * layout/tableformatting/TableFormattingContext.h: 15 * layout/tableformatting/TableFormattingContextGeometry.cpp: 16 (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const): 17 (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell): 18 1 19 2020-05-21 Enrique Ocaña González <eocanha@igalia.com> 2 20 -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r261980 r261991 200 200 auto& cellDisplayBox = formattingState().displayBox(cellBox); 201 201 202 auto computedCellBorder = [&] { 203 auto border = geometry().computedBorder(cellBox); 204 auto collapsedBorder = grid.collapsedBorder(); 205 if (!collapsedBorder) 206 return border; 207 auto cellPosition = cell.position(); 208 if (!cellPosition.column) 209 border.horizontal.left = collapsedBorder->horizontal.left / 2; 210 if (cellPosition.column == grid.columns().size() - 1) 211 border.horizontal.right = collapsedBorder->horizontal.right / 2; 212 if (!cellPosition.row) 213 border.vertical.top = collapsedBorder->vertical.top / 2; 214 if (cellPosition.row == grid.rows().size() - 1) 215 border.vertical.bottom = collapsedBorder->vertical.bottom / 2; 216 return border; 217 }(); 218 cellDisplayBox.setBorder(computedCellBorder); 202 cellDisplayBox.setBorder(geometry().computedCellBorder(cell)); 219 203 cellDisplayBox.setPadding(geometry().computedPadding(cellBox, availableHorizontalSpace)); 220 204 // Internal table elements do not have margins. -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h
r261980 r261991 67 67 public: 68 68 LayoutUnit cellHeigh(const ContainerBox&) const; 69 Edges computedCellBorder(const TableGrid::Cell&) const; 69 70 Optional<LayoutUnit> computedColumnWidth(const ContainerBox& columnBox) const; 70 71 FormattingContext::IntrinsicWidthConstraints intrinsicWidthConstraintsForCell(const TableGrid::Cell&); -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp
r261980 r261991 47 47 } 48 48 49 Edges TableFormattingContext::Geometry::computedCellBorder(const TableGrid::Cell& cell) const 50 { 51 auto& cellBox = cell.box(); 52 auto border = computedBorder(cellBox); 53 auto collapsedBorder = m_grid.collapsedBorder(); 54 if (!collapsedBorder) 55 return border; 56 57 // We might want to cache these collapsed borders on the grid. 58 auto cellPosition = cell.position(); 59 if (!cellPosition.column) 60 border.horizontal.left = collapsedBorder->horizontal.left / 2; 61 else { 62 auto adjacentBorderRight = computedBorder(m_grid.slot({ cellPosition.column - 1, cellPosition.row })->cell().box()).horizontal.right; 63 border.horizontal.left = std::max(border.horizontal.left, adjacentBorderRight) / 2; 64 } 65 if (cellPosition.column == m_grid.columns().size() - 1) 66 border.horizontal.right = collapsedBorder->horizontal.right / 2; 67 else { 68 auto adjacentBorderLeft = computedBorder(m_grid.slot({ cellPosition.column + 1, cellPosition.row })->cell().box()).horizontal.left; 69 border.horizontal.right = std::max(border.horizontal.right, adjacentBorderLeft) / 2; 70 } 71 if (!cellPosition.row) 72 border.vertical.top = collapsedBorder->vertical.top / 2; 73 else { 74 auto adjacentBorderBottom = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row - 1 })->cell().box()).vertical.bottom; 75 border.vertical.top = std::max(border.vertical.top, adjacentBorderBottom) / 2; 76 } 77 if (cellPosition.row == m_grid.rows().size() - 1) 78 border.vertical.bottom = collapsedBorder->vertical.bottom / 2; 79 else { 80 auto adjacentBorderTop = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row + 1 })->cell().box()).vertical.top; 81 border.vertical.bottom = std::max(border.vertical.bottom, adjacentBorderTop) / 2; 82 } 83 return border; 84 } 85 49 86 Optional<LayoutUnit> TableFormattingContext::Geometry::computedColumnWidth(const ContainerBox& columnBox) const 50 87 { … … 61 98 auto& style = cellBox.style(); 62 99 63 auto computedHorizontalBorder = [&] {64 auto leftBorderWidth = LayoutUnit { style.borderLeftWidth() };65 auto rightBorderWidth = LayoutUnit { style.borderRightWidth() };66 if (auto collapsedBorder = m_grid.collapsedBorder()) {67 auto cellPosition = cell.position();68 if (!cellPosition.column)69 leftBorderWidth = collapsedBorder->horizontal.left / 2;70 if (cellPosition.column == m_grid.columns().size() - 1)71 rightBorderWidth = collapsedBorder->horizontal.right / 2;72 }73 return leftBorderWidth + rightBorderWidth;74 };75 76 100 auto computedIntrinsicWidthConstraints = [&] { 77 101 // Even fixed width cells expand to their minimum content width … … 80 104 if (cellBox.hasChild()) 81 105 intrinsicWidthConstraints = LayoutContext::createFormattingContext(cellBox, layoutState())->computedIntrinsicWidthConstraints(); 82 if (auto width = fixedValue( cellBox.style().logicalWidth()))106 if (auto width = fixedValue(style.logicalWidth())) 83 107 return FormattingContext::IntrinsicWidthConstraints { std::max(intrinsicWidthConstraints.minimum, *width), *width }; 84 108 return intrinsicWidthConstraints; … … 87 111 auto intrinsicWidthConstraints = constrainByMinMaxWidth(cellBox, computedIntrinsicWidthConstraints()); 88 112 // Expand with border 89 intrinsicWidthConstraints.expand(computed HorizontalBorder());113 intrinsicWidthConstraints.expand(computedCellBorder(cell).horizontal.width()); 90 114 // padding 91 115 intrinsicWidthConstraints.expand(fixedValue(style.paddingLeft()).valueOr(0) + fixedValue(style.paddingRight()).valueOr(0));
Note: See TracChangeset
for help on using the changeset viewer.