Changeset 275059 in webkit
- Timestamp:
- Mar 25, 2021, 2:45:05 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/table/table-anonymous-cell-collapse-expected.html (added)
-
LayoutTests/fast/table/table-anonymous-cell-collapse.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp (modified) (1 diff)
-
Source/WebCore/rendering/updating/RenderTreeBuilderTable.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275055 r275059 1 2021-03-25 Cameron McCormack <heycam@apple.com> 2 3 Collapse newly adjacent anonymous table cells when a table cell is detached from between them. 4 https://bugs.webkit.org/show_bug.cgi?id=220934 5 6 Reviewed by Zalan Bujtas. 7 8 * fast/table/table-anonymous-cell-collapse-expected.html: Added. 9 * fast/table/table-anonymous-cell-collapse.html: Added. 10 1 11 2021-03-25 Tim Nguyen <ntim@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r275055 r275059 1 2021-03-25 Cameron McCormack <heycam@apple.com> 2 3 Collapse newly adjacent anonymous table cells when a table cell is detached from between them. 4 https://bugs.webkit.org/show_bug.cgi?id=220934 5 6 Reviewed by Zalan Bujtas. 7 8 We already had support for collapsing newly adjacent table row cells when a 9 table row cell is detached from between them. We need to do this for anonymous 10 table cells too. 11 12 Test: fast/table/table-anonymous-cell-collapse.html 13 14 * rendering/updating/RenderTreeBuilder.cpp: 15 (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Call 16 into the RenderTreeBuilder::Table to collapse anonymous table cells when 17 needed. 18 * rendering/updating/RenderTreeBuilderTable.cpp: 19 (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings): 20 Factor out the existing collapseAndDestroyAnonymousSiblingRows into 21 something re-usable. 22 (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells): 23 Added. 24 (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): 25 Factored out to collapseAndDestroyAnonymousSiblings. 26 * rendering/updating/RenderTreeBuilderTable.h: 27 1 28 2021-03-25 Tim Nguyen <ntim@apple.com> 2 29 -
trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
r274398 r275059 52 52 #include "RenderSVGText.h" 53 53 #include "RenderTable.h" 54 #include "RenderTableCell.h" 54 55 #include "RenderTableRow.h" 55 56 #include "RenderTableSection.h" … … 827 828 clearFloatsAndOutOfFlowPositionedObjects(); 828 829 829 if (is<RenderTableRow>(destroyRoot)) 830 tableBuilder().collapseAndDestroyAnonymousSiblingRows(downcast<RenderTableRow>(destroyRoot)); 830 auto collapseAndDestroyAnonymousSiblings = [&] { 831 // FIXME: Probably need to handle other table parts here as well. 832 if (is<RenderTableCell>(destroyRoot)) { 833 tableBuilder().collapseAndDestroyAnonymousSiblingCells(downcast<RenderTableCell>(destroyRoot)); 834 return; 835 } 836 837 if (is<RenderTableRow>(destroyRoot)) { 838 tableBuilder().collapseAndDestroyAnonymousSiblingRows(downcast<RenderTableRow>(destroyRoot)); 839 return; 840 } 841 }; 842 collapseAndDestroyAnonymousSiblings(); 831 843 832 844 // FIXME: Do not try to collapse/cleanup the anonymous wrappers inside destroy (see webkit.org/b/186746). -
trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp
r274739 r275059 248 248 } 249 249 250 template <typename Parent, typename Child> 251 void RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings(Parent* parent, Child* previousSibling, Child* nextSibling) 252 { 253 if (!parent || !previousSibling || !nextSibling) 254 return; 255 256 if (previousSibling->isAnonymous() && nextSibling->isAnonymous()) { 257 m_builder.moveAllChildren(*nextSibling, *previousSibling, RenderTreeBuilder::NormalizeAfterInsertion::No); 258 auto toDestroy = m_builder.detach(*parent, *nextSibling); 259 } 260 261 previousSibling->setNeedsLayout(); 262 } 263 264 void RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells(RenderTableCell& cell) 265 { 266 collapseAndDestroyAnonymousSiblings(cell.row(), cell.previousCell(), cell.nextCell()); 267 } 268 250 269 void RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows(RenderTableRow& row) 251 270 { 252 auto* section = row.section(); 253 if (!section) 254 return; 255 256 auto* before = row.previousRow(); 257 if (!before) 258 return; 259 260 auto* after = row.nextRow(); 261 if (!after) 262 return; 263 264 if (before->isAnonymous() && after->isAnonymous()) { 265 m_builder.moveAllChildren(*after, *before, RenderTreeBuilder::NormalizeAfterInsertion::No); 266 auto toDestroy = m_builder.detach(*section, *after); 267 } 268 269 before->setNeedsLayout(); 270 } 271 272 } 271 collapseAndDestroyAnonymousSiblings(row.section(), row.previousRow(), row.nextRow()); 272 } 273 274 } -
trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h
r228954 r275059 33 33 class RenderObject; 34 34 class RenderTable; 35 class RenderTableCell; 35 36 class RenderTableSection; 36 37 class RenderTableRow; … … 52 53 bool childRequiresTable(const RenderElement& parent, const RenderObject& child); 53 54 55 void collapseAndDestroyAnonymousSiblingCells(RenderTableCell&); 54 56 void collapseAndDestroyAnonymousSiblingRows(RenderTableRow&); 55 57 56 58 private: 59 template <typename Parent, typename Child> 60 void collapseAndDestroyAnonymousSiblings(Parent*, Child* previousChild, Child* nextChild); 61 57 62 RenderTreeBuilder& m_builder; 58 63 };
Note:
See TracChangeset
for help on using the changeset viewer.