commit | e5b684d2cfabe74104622e5b241d7deac9b542fd | [log] [tgz] |
---|---|---|
author | Koji Ishii <kojii@chromium.org> | Thu Nov 15 05:12:32 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Nov 15 05:12:32 2018 |
tree | 1fba4b7f93f70889aa8c6baeb26e0bfee3743039 | |
parent | 21f4d49913435d77666383128b62657b56e0bfb3 [diff] |
[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/1337210 Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/master@{#608266}
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc index 931780b0..ca511fb 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc
@@ -774,6 +774,10 @@ 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.