Changeset 258480 in webkit
- Timestamp:
- Mar 15, 2020 8:33:24 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r258473 r258480 1 2020-03-15 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Add basic column span support for content box width 4 https://bugs.webkit.org/show_bug.cgi?id=209120 5 <rdar://problem/60463424> 6 7 Reviewed by Antti Koivisto. 8 9 * fast/layoutformattingcontext/table-colspan-simple-expected.html: Added. 10 * fast/layoutformattingcontext/table-colspan-simple.html: Added. 11 1 12 2020-03-14 Zalan Bujtas <zalan@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r258478 r258480 1 2020-03-15 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Add basic column span support for content box width 4 https://bugs.webkit.org/show_bug.cgi?id=209120 5 <rdar://problem/60463424> 6 7 Reviewed by Antti Koivisto. 8 9 Take the column spanning into account when computing the content width for the table cell. 10 [content box width = column width(1) + column width(2) + .. + column width(spanning value) + ((spanning value - 1) * horizontal spacing)] 11 12 Test: fast/layoutformattingcontext/table-colspan-simple.html 13 14 * layout/tableformatting/TableFormattingContext.cpp: 15 (WebCore::Layout::TableFormattingContext::layoutInFlowContent): 16 (WebCore::Layout::TableFormattingContext::layoutTableCellBox): 17 (WebCore::Layout::TableFormattingContext::positionTableCells): 18 * layout/tableformatting/TableFormattingContext.h: 19 * layout/tableformatting/TableGrid.cpp: 20 (WebCore::Layout::TableGrid::appendCell): 21 * layout/tableformatting/TableGrid.h: 22 (WebCore::Layout::TableGrid::CellInfo::startColumn const): 23 (WebCore::Layout::TableGrid::CellInfo::endColumn const): 24 (WebCore::Layout::TableGrid::CellInfo::startRow const): 25 (WebCore::Layout::TableGrid::CellInfo::endRow const): 26 (WebCore::Layout::TableGrid::CellInfo::columnSpan const): 27 (WebCore::Layout::TableGrid::CellInfo::rowSpan const): 28 1 29 2020-03-15 Yusuke Suzuki <ysuzuki@apple.com> 2 30 -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r258137 r258480 77 77 78 78 // 2. Layout each table cell (and compute row height as well). 79 auto& columnList = columnsContext.columns();80 79 auto& cellList = grid.cells(); 81 80 ASSERT(!cellList.isEmpty()); 82 81 for (auto& cell : cellList) { 83 82 auto& cellLayoutBox = cell->tableCellBox; 84 layoutTableCellBox( cellLayoutBox, columnList.at(cell->position.x()), invalidationState, horizontalConstraints);83 layoutTableCellBox(*cell, invalidationState, horizontalConstraints); 85 84 // FIXME: Add support for column and row spanning and this requires a 2 pass layout. 86 auto& row = grid.rows().at(cell-> position.y());85 auto& row = grid.rows().at(cell->startRow()); 87 86 row.setLogicalHeight(std::max(row.logicalHeight(), geometryForBox(cellLayoutBox).marginBoxHeight())); 88 87 } … … 100 99 } 101 100 102 void TableFormattingContext::layoutTableCellBox(const Box& cellLayoutBox, const TableGrid::Column& column, InvalidationState& invalidationState, const HorizontalConstraints& horizontalConstraints) 103 { 101 void TableFormattingContext::layoutTableCellBox(const TableGrid::CellInfo& cell, InvalidationState& invalidationState, const HorizontalConstraints& horizontalConstraints) 102 { 103 auto& cellLayoutBox = cell.tableCellBox; 104 104 computeBorderAndPadding(cellLayoutBox, horizontalConstraints); 105 105 // Margins do not apply to internal table elements. … … 109 109 // Don't know the actual position yet. 110 110 cellDisplayBox.setTopLeft({ }); 111 cellDisplayBox.setContentBoxWidth(column.logicalWidth() - cellDisplayBox.horizontalMarginBorderAndPadding()); 111 auto contentWidth = [&] { 112 auto& grid = formattingState().tableGrid(); 113 auto& columnList = grid.columnsContext().columns(); 114 auto logicalWidth = LayoutUnit { }; 115 for (auto columnIndex = cell.startColumn(); columnIndex < cell.endColumn(); ++columnIndex) 116 logicalWidth += columnList.at(columnIndex).logicalWidth(); 117 // No column spacing when spanning. 118 logicalWidth += (cell.columnSpan() - 1) * grid.horizontalSpacing(); 119 return logicalWidth - cellDisplayBox.horizontalMarginBorderAndPadding(); 120 }(); 121 cellDisplayBox.setContentBoxWidth(contentWidth); 112 122 113 123 ASSERT(cellLayoutBox.establishesBlockFormattingContext()); … … 131 141 for (auto& cell : grid.cells()) { 132 142 auto& cellDisplayBox = formattingState().displayBox(cell->tableCellBox); 133 cellDisplayBox.setTop(rowList.at(cell-> position.y()).logicalTop());134 cellDisplayBox.setLeft(columnList.at(cell-> position.x()).logicalLeft());143 cellDisplayBox.setTop(rowList.at(cell->startRow()).logicalTop()); 144 cellDisplayBox.setLeft(columnList.at(cell->startColumn()).logicalLeft()); 135 145 } 136 146 } -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h
r258137 r258480 60 60 61 61 IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override; 62 void layoutTableCellBox(const Box& cellLayoutBox, const TableGrid::Column&, InvalidationState&, const HorizontalConstraints&);62 void layoutTableCellBox(const TableGrid::CellInfo&, InvalidationState&, const HorizontalConstraints&); 63 63 void positionTableCells(); 64 64 void setComputedGeometryForRows(); -
trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp
r254087 r258480 143 143 } 144 144 } 145 auto cellInfo = makeUnique<CellInfo>(tableCellBox, initialSlotPosition, CellSize { rowSpan, columnSpan });145 auto cellInfo = makeUnique<CellInfo>(tableCellBox, initialSlotPosition, CellSize { columnSpan, rowSpan }); 146 146 // Row and column spanners create additional slots. 147 147 for (int row = 1; row <= rowSpan; ++row) { 148 148 for (int column = 1; column <= columnSpan; ++column) { 149 auto position = SlotPosition { initialSlotPosition.x() + row - 1, initialSlotPosition.y() + column- 1 };149 auto position = SlotPosition { initialSlotPosition.x() + column - 1, initialSlotPosition.y() + row - 1 }; 150 150 ASSERT(!m_slotMap.contains(position)); 151 151 m_slotMap.add(position, makeUnique<SlotInfo>(*cellInfo)); -
trunk/Source/WebCore/layout/tableformatting/TableGrid.h
r254087 r258480 62 62 WTF_MAKE_STRUCT_FAST_ALLOCATED; 63 63 CellInfo(const Box& tableCellBox, SlotPosition, CellSize); 64 65 size_t startColumn() const { return position.x(); } 66 size_t endColumn() const { return position.x() + size.width(); } 67 68 size_t startRow() const { return position.y(); } 69 size_t endRow() const { return position.y() + size.height(); } 70 71 size_t columnSpan() const { return size.width(); } 72 size_t rowSpan() const { return size.height(); } 64 73 65 74 const Box& tableCellBox;
Note: See TracChangeset
for help on using the changeset viewer.