Commit 938737c5 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Speed up NGPaintFragment::ResetInlineFragmentsFor

No need for the vector here

R=yosin@chromium.org,kojii@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I420acd918a937b1a01071f5fe9ada44db16a1d53
Reviewed-on: https://chromium-review.googlesource.com/1196369Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587606}
parent d9f2b8fa
...@@ -359,13 +359,12 @@ void NGPaintFragment::ResetInlineFragmentsFor( ...@@ -359,13 +359,12 @@ void NGPaintFragment::ResetInlineFragmentsFor(
// Because |next_for_same_layout_object_| can be the last reference, we should // Because |next_for_same_layout_object_| can be the last reference, we should
// have another reference during resetting |next_for_same_layout_object_| // have another reference during resetting |next_for_same_layout_object_|
// |FragmentRange|.. // |FragmentRange|..
const FragmentRange range = InlineFragmentsFor(layout_object); scoped_refptr<NGPaintFragment> current = layout_object->FirstInlineFragment();
Vector<scoped_refptr<NGPaintFragment>> fragments; while (current) {
fragments.ReserveCapacity(range.size()); scoped_refptr<NGPaintFragment> next;
for (NGPaintFragment* fragment : range) next.swap(current->next_for_same_layout_object_);
fragments.push_back(fragment); current.swap(next);
for (const auto& fragment : fragments) }
fragment->next_for_same_layout_object_.reset();
} }
bool NGPaintFragment::FlippedLocalVisualRectFor( bool NGPaintFragment::FlippedLocalVisualRectFor(
......
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