Changeset 261919 in webkit
- Timestamp:
- May 20, 2020 8:34:24 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261913 r261919 1 2020-05-20 Alan Kinsley <zalan@apple.com> 2 3 [LFC][TFC] Internal table boxes should take collapsed border into account 4 https://bugs.webkit.org/show_bug.cgi?id=212135 5 6 Reviewed by Antti Koivisto. 7 8 * fast/layoutformattingcontext/table-simple-border-collapse-expected.html: Added. 9 * fast/layoutformattingcontext/table-simple-border-collapse.html: Added. 10 1 11 2020-05-20 Zan Dobersek <zdobersek@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r261915 r261919 1 2020-05-20 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Internal table boxes should take collapsed border into account 4 https://bugs.webkit.org/show_bug.cgi?id=212135 5 6 Reviewed by Antti Koivisto. 7 8 Use the collapsed border value to compute the borders for sections, rows and cells. 9 The collapsed border is propagated to the table box and the adjacent cell boxes. 10 11 Test: fast/layoutformattingcontext/table-simple-border-collapse.html 12 13 * layout/LayoutUnits.h: 14 (WebCore::Layout::operator/): 15 * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: 16 (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): 17 * layout/tableformatting/TableFormattingContext.cpp: 18 (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): 19 (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): 20 (WebCore::Layout::TableFormattingContext::layoutCell): 21 * layout/tableformatting/TableGrid.h: 22 (WebCore::Layout::TableGrid::setCollapsedBorder): 23 (WebCore::Layout::TableGrid::collapsedBorder const): 24 1 25 2020-05-20 Youenn Fablet <youenn@apple.com> 2 26 -
trunk/Source/WebCore/layout/LayoutUnits.h
r260827 r261919 132 132 }; 133 133 134 inline Edges operator/(const Edges& edge, size_t value) 135 { 136 return { { edge.horizontal.left / value, edge.horizontal.right / value }, { edge.vertical.top / value, edge.vertical.bottom / value } }; 137 } 138 134 139 struct ContentWidthAndMargin { 135 140 LayoutUnit contentWidth; -
trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp
r261832 r261919 111 111 bottomBorder = std::max(bottomBorder, geometry().computedBorder(boxInLastRow).vertical.bottom); 112 112 } 113 auto collapsedBorder = Edges { { leftBorder / 2, rightBorder / 2 }, { topBorder / 2, bottomBorder / 2 } }; 113 auto collapsedBorder = Edges { { leftBorder, rightBorder }, { topBorder, bottomBorder } }; 114 grid.setCollapsedBorder(collapsedBorder); 114 115 115 116 auto& displayBox = formattingState().displayBox(tableBox); 116 displayBox.setBorder(collapsedBorder );117 displayBox.setBorder(collapsedBorder / 2); 117 118 displayBox.setPadding(geometry().computedPadding(tableBox, horizontalConstraints.logicalWidth)); 118 119 return; -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r261810 r261919 116 116 auto rowWidth = grid.columns().logicalWidth() + 2 * grid.horizontalSpacing(); 117 117 auto rowLogicalTop = grid.verticalSpacing(); 118 for (auto& row : rows) { 118 for (size_t rowIndex = 0; rowIndex < rows.size(); ++rowIndex) { 119 auto& row = rows[rowIndex]; 119 120 auto& rowBox = row.box(); 120 121 auto& rowDisplayBox = formattingState().displayBox(rowBox); 121 computeBorderAndPadding(rowBox, HorizontalConstraints { { }, availableHorizontalSpace }); 122 123 auto computedRowBorder = [&] { 124 auto border = geometry().computedBorder(rowBox); 125 if (!grid.collapsedBorder()) 126 return border; 127 // Border collapsing delegates borders to table/cells. 128 border.horizontal = { }; 129 if (!rowIndex) 130 border.vertical.top = { }; 131 if (rowIndex == rows.size() - 1) 132 border.vertical.bottom = { }; 133 return border; 134 }(); 135 rowDisplayBox.setBorder(computedRowBorder); 136 rowDisplayBox.setPadding(geometry().computedPadding(rowBox, availableHorizontalSpace)); 122 137 // Internal table elements do not have margins. 123 138 rowDisplayBox.setHorizontalMargin({ }); … … 159 174 for (auto& section : childrenOfType<ContainerBox>(root())) { 160 175 auto& sectionDisplayBox = formattingState().displayBox(section); 161 computeBorderAndPadding(section, HorizontalConstraints { { }, constraints.horizontal.logicalWidth }); 176 // FIXME: Multiple sections can have their own borders. 177 sectionDisplayBox.setBorder(grid.collapsedBorder() ? Edges(): geometry().computedBorder(section)); 178 sectionDisplayBox.setPadding(geometry().computedPadding(section, constraints.horizontal.logicalWidth)); 162 179 // Internal table elements do not have margins. 163 180 sectionDisplayBox.setHorizontalMargin({ }); … … 179 196 ASSERT(cell.box().establishesBlockFormattingContext()); 180 197 198 auto& grid = formattingState().tableGrid(); 181 199 auto& cellBox = cell.box(); 182 200 auto& cellDisplayBox = formattingState().displayBox(cellBox); 183 201 184 computeBorderAndPadding(cellBox, HorizontalConstraints { { }, availableHorizontalSpace }); 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); 219 cellDisplayBox.setPadding(geometry().computedPadding(cellBox, availableHorizontalSpace)); 185 220 // Internal table elements do not have margins. 186 221 cellDisplayBox.setHorizontalMargin({ }); … … 189 224 190 225 auto availableSpaceForContent = [&] { 191 auto& grid = formattingState().tableGrid();192 226 auto& columnList = grid.columns().list(); 193 227 auto logicalWidth = LayoutUnit { }; -
trunk/Source/WebCore/layout/tableformatting/TableGrid.h
r261745 r261919 56 56 LayoutUnit verticalSpacing() const { return m_verticalSpacing; } 57 57 58 void setCollapsedBorder(const Edges& collapsedBorder) { m_collapsedBorder = collapsedBorder; } 59 Optional<Edges> collapsedBorder() const { return m_collapsedBorder; } 60 58 61 void setWidthConstraints(FormattingContext::IntrinsicWidthConstraints intrinsicWidthConstraints) { m_intrinsicWidthConstraints = intrinsicWidthConstraints; } 59 62 Optional<FormattingContext::IntrinsicWidthConstraints> widthConstraints() const { return m_intrinsicWidthConstraints; } … … 229 232 LayoutUnit m_verticalSpacing; 230 233 Optional<FormattingContext::IntrinsicWidthConstraints> m_intrinsicWidthConstraints; 234 Optional<Edges> m_collapsedBorder; 231 235 }; 232 236
Note: See TracChangeset
for help on using the changeset viewer.