Commit e5b684d2 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Adjust BoxInfo::item_index when items are removed

When NGInlineItemsBuilder removed an item, it needs to adjust
BoxInfo::item_index. This patch fixes it.

This was revealed in crrev.com/c/1333588, tests will fail
with the CL without this fix.

Bug: 636993
Change-Id: I7a996e358c0daa8e6c7aa1b5227e4027fe0295bd
Reviewed-on: https://chromium-review.googlesource.com/c/1337210Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608266}
parent 21f4d499
......@@ -774,6 +774,10 @@ void NGInlineItemsBuilderTemplate<
wtf_size_t index =
static_cast<wtf_size_t>(std::distance(items_->begin(), item));
items_->EraseAt(index);
for (BoxInfo& box : boxes_) {
if (box.item_index >= index)
--box.item_index;
}
if (index == items_->size())
return;
// Re-compute |item| because |EraseAt| may have reallocated the buffer.
......
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