Changeset 260708 in webkit
- Timestamp:
- Apr 25, 2020 12:13:18 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r260705 r260708 1 2020-04-25 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Add vertical-align: baseline support 4 https://bugs.webkit.org/show_bug.cgi?id=211024 5 6 Reviewed by Antti Koivisto. 7 8 * fast/layoutformattingcontext/table-basic-row-vertical-align-baseline-expected.txt: Added. 9 * fast/layoutformattingcontext/table-basic-row-vertical-align-baseline.html: Added. 10 1 11 2020-04-25 Antoine Quint <graouts@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r260707 r260708 1 2020-04-25 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][TFC] Add vertical-align: baseline support 4 https://bugs.webkit.org/show_bug.cgi?id=211024 5 6 Reviewed by Antti Koivisto. 7 8 Adjust the padding with the baseline offset when the cell is baseline aligned (as opposed to the initial value of 'middle'). 9 10 Test: fast/layoutformattingcontext/table-basic-row-vertical-align-baseline.html 11 12 * layout/tableformatting/TableFormattingContext.cpp: 13 (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): 14 (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): 15 * layout/tableformatting/TableGrid.h: 16 (WebCore::Layout::TableGrid::Cell::setBaselineOffset): 17 (WebCore::Layout::TableGrid::Cell::baselineOffset const): 18 1 19 2020-04-25 Darin Adler <darin@apple.com> 2 20 -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r260703 r260708 69 69 // Final table cell layout. At this point all percentage values can be resolved. 70 70 for (auto& cell : grid.cells()) { 71 auto& cellDisplayBox = formattingState().displayBox(cell->box()); 71 auto& cellBox = cell->box(); 72 auto& cellDisplayBox = formattingState().displayBox(cellBox); 72 73 cellDisplayBox.setTop(rowList[cell->startRow()].logicalTop()); 73 74 cellDisplayBox.setLeft(columnList[cell->startColumn()].logicalLeft()); 74 75 auto rowHeight = rowList[cell->startRow()].logicalHeight(); 75 76 layoutCell(*cell, availableHorizontalSpace, rowHeight); 77 76 78 // FIXME: Find out if it is ok to use the regular padding here to align the content box inside a tall cell or we need to 77 79 // use some kind of intrinsic padding similar to RenderTableCell. 78 auto verticalBorder = cellDisplayBox.verticalBorder(); 79 auto contentHeight = cellDisplayBox.contentBoxHeight(); 80 auto intrinsicVerticalPadding = std::max(0_lu, rowHeight - verticalBorder - contentHeight); 81 // FIXME: Take vertical-align into account here. 82 cellDisplayBox.setVerticalPadding({ intrinsicVerticalPadding / 2, intrinsicVerticalPadding / 2 }); 80 auto paddingTop = cellDisplayBox.paddingTop().valueOr(LayoutUnit { }); 81 auto paddingBottom = cellDisplayBox.paddingBottom().valueOr(LayoutUnit { }); 82 auto intrinsicPaddingTop = LayoutUnit { }; 83 auto intrinsicPaddingBottom = LayoutUnit { }; 84 85 switch (cellBox.style().verticalAlign()) { 86 case VerticalAlign::Middle: { 87 auto intrinsicVerticalPadding = std::max(0_lu, rowHeight - cellDisplayBox.verticalMarginBorderAndPadding() - cellDisplayBox.contentBoxHeight()); 88 intrinsicPaddingTop = intrinsicVerticalPadding / 2; 89 intrinsicPaddingBottom = intrinsicVerticalPadding / 2; 90 break; 91 } 92 case VerticalAlign::Baseline: { 93 auto rowBaselineOffset = LayoutUnit { rowList[cell->startRow()].baselineOffset() }; 94 auto cellBaselineOffset = LayoutUnit { cell->baselineOffset() }; 95 intrinsicPaddingTop = std::max(0_lu, rowBaselineOffset - cellBaselineOffset - cellDisplayBox.borderTop()); 96 intrinsicPaddingBottom = std::max(0_lu, rowHeight - cellDisplayBox.verticalMarginBorderAndPadding() - intrinsicPaddingTop - cellDisplayBox.contentBoxHeight()); 97 break; 98 } 99 default: 100 ASSERT_NOT_IMPLEMENTED_YET(); 101 break; 102 } 103 cellDisplayBox.setVerticalPadding({ paddingTop + intrinsicPaddingTop, paddingBottom + intrinsicPaddingBottom }); 83 104 } 84 105 } … … 491 512 // The minimum height of a row (without spanning-related height distribution) is defined as the height of an hypothetical 492 513 // linebox containing the cells originating in the row. 493 auto& cellBox = slot.cell().box(); 494 auto cellBaselineOffset = geometry().usedBaselineForCell(cellBox); 495 maximumColumnAscent = std::max(maximumColumnAscent, cellBaselineOffset); 496 maximumColumnDescent = std::max(maximumColumnDescent, geometryForBox(cellBox).height() - cellBaselineOffset); 514 auto& cell = slot.cell(); 515 auto& cellBox = cell.box(); 516 cell.setBaselineOffset(geometry().usedBaselineForCell(cellBox)); 517 maximumColumnAscent = std::max(maximumColumnAscent, cell.baselineOffset()); 518 maximumColumnDescent = std::max(maximumColumnDescent, geometryForBox(cellBox).height() - cell.baselineOffset()); 497 519 } 498 520 // <tr style="height: 10px"> is considered as min height. -
trunk/Source/WebCore/layout/tableformatting/TableGrid.h
r260647 r260708 161 161 CellSpan span() const { return m_span; } 162 162 163 void setBaselineOffset(InlineLayoutUnit baselineOffset) { m_baselineOffset = baselineOffset; } 164 InlineLayoutUnit baselineOffset() const { return m_baselineOffset; } 165 163 166 bool isFixedWidth() const; 164 167 … … 169 172 SlotPosition m_position; 170 173 CellSpan m_span; 174 InlineLayoutUnit m_baselineOffset; 171 175 }; 172 176
Note: See TracChangeset
for help on using the changeset viewer.