Commit e349cefb authored by Aleks Totic's avatar Aleks Totic Committed by Commit Bot

[LayoutNG] Prevent LayoutNGTableCell DCHECK

Bug: 986567
Change-Id: I0b69e747023a289280de75bfe54003e5fecb5b1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1714151
Commit-Queue: Aleks Totic <atotic@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680635}
parent 01af5a67
...@@ -324,7 +324,7 @@ void TableLayoutAlgorithmFixed::UpdateLayout() { ...@@ -324,7 +324,7 @@ void TableLayoutAlgorithmFixed::UpdateLayout() {
if (width_[i].IsAuto()) { if (width_[i].IsAuto()) {
unsigned span = table_->SpanOfEffectiveColumn(i); unsigned span = table_->SpanOfEffectiveColumn(i);
int w = remaining_width * span / auto_span; int w = remaining_width * span / auto_span;
calc_width[i] = w + hspacing * (span - 1); calc_width[i] = std::max<int>((w + hspacing * (span - 1)), 0);
remaining_width -= w; remaining_width -= w;
if (!remaining_width) if (!remaining_width)
break; break;
...@@ -334,8 +334,10 @@ void TableLayoutAlgorithmFixed::UpdateLayout() { ...@@ -334,8 +334,10 @@ void TableLayoutAlgorithmFixed::UpdateLayout() {
} }
} }
// Last one gets the remainder. // Last one gets the remainder.
if (remaining_width) if (remaining_width) {
calc_width[last_auto] += remaining_width; calc_width[last_auto] =
std::max(calc_width[last_auto] + remaining_width, 0);
}
total_width = table_logical_width; total_width = table_logical_width;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment