Skip to content

Commit db55378

Browse files
committed
Revert "Optimize step4 to skip re-layout if width matches"
This reverts commit 3961b78.
1 parent 3961b78 commit db55378

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

packages/core/lib/src/widgets/html_table.dart

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ class _TableRenderLayouter {
397397
(availableWidth == null || columnWidths.sum <= availableWidth)) {
398398
return _TableDataStep3(
399399
step2,
400-
cellSizes: cellSizes,
401400
columnWidths: columnWidths,
402401
);
403402
}
@@ -459,7 +458,6 @@ class _TableRenderLayouter {
459458

460459
return _TableDataStep3(
461460
step2,
462-
cellSizes: cellSizes,
463461
columnWidths: columnWidths,
464462
);
465463
}
@@ -506,27 +504,22 @@ class _TableRenderLayouter {
506504
final step2 = step3.step2;
507505
final step1 = step2.step1;
508506
final cells = step1.cells;
509-
final cellSizes = step3.cellSizes;
510507
final children = step1.children;
511508

512509
final childSizes = List.filled(children.length, Size.zero);
513510
final rowHeights = List.filled(step1.rowCount, .0);
514511

515512
for (var i = 0; i < children.length; i++) {
516-
final cellSize = cellSizes[i];
517513
final child = children[i];
518514
final data = cells[i];
519515

516+
// always re-layout because we cannot be sure whether
517+
// children will render the same inside an unconstrained and a tight box
520518
final childWidth = data.calculateWidth(tro, step3.columnWidths);
521-
Size childSize;
522-
if (cellSize != null && cellSize.width == childWidth) {
523-
childSize = cellSize;
524-
} else {
525-
final cc1 = BoxConstraints.tightFor(width: childWidth);
526-
childSize = layouter(child, cc1);
527-
logger.fine('[4] Got child#$i $childSize@$cc1');
528-
childSizes[i] = childSize;
529-
}
519+
final cc1 = BoxConstraints.tightFor(width: childWidth);
520+
final childSize = layouter(child, cc1);
521+
logger.fine('[4] Got child#$i $childSize@$cc1');
522+
childSizes[i] = childSize;
530523

531524
// distribute cell height across spanned rows
532525
final rowHeight =
@@ -699,12 +692,10 @@ class _TableDataStep2 {
699692
class _TableDataStep3 {
700693
final _TableDataStep2 step2;
701694

702-
final List<Size?> cellSizes;
703695
final List<double> columnWidths;
704696

705697
const _TableDataStep3(
706698
this.step2, {
707-
required this.cellSizes,
708699
required this.columnWidths,
709700
});
710701
}

0 commit comments

Comments
 (0)