Commit 155aa5fb authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize NGInlineCursor for inline box traversal

This patch changes "inline_box_traversal.cc" to utilize |NGInlineCursor| instead
of |NGPaintFragment| for preparation of migraing |NGFragmentItem|.

This patch will reduces 1000+ failed web_tests in |LayoutNGFragmentItem| flag.

Bug: 982194
Change-Id: I7f889755ff44beaa63e83f47db415b65969394d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888242
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712949}
parent ee5f0d37
......@@ -650,6 +650,25 @@ void NGInlineCursor::MoveTo(const LayoutObject& layout_object) {
MoveToNext();
}
void NGInlineCursor::MoveTo(const NGInlineCursor& cursor) {
if (const NGPaintFragment* paint_fragment = cursor.CurrentPaintFragment()) {
MoveTo(*paint_fragment);
return;
}
if (cursor.current_item_) {
if (!fragment_items_)
SetRoot(*cursor.fragment_items_);
// Note: We use address instead of iterato because we can't compare
// iterators in different span. See |base::CheckedContiguousIterator<T>|.
const ptrdiff_t index = &*cursor.item_iter_ - &*items_.begin();
DCHECK_GE(index, 0);
DCHECK_LT(static_cast<size_t>(index), items_.size());
MoveToItem(items_.begin() + index);
return;
}
*this = cursor;
}
void NGInlineCursor::MoveTo(const NGPaintFragment& paint_fragment) {
DCHECK(!fragment_items_);
if (!root_paint_fragment_)
......
......@@ -210,6 +210,11 @@ class CORE_EXPORT NGInlineCursor {
// Functions to move the current position.
//
// Move the current position at |cursor|. Unlinke copy constrcutr, this
// function doesn't copy root. Note: The current position in |cursor|
// should be part of |this| cursor.
void MoveTo(const NGInlineCursor& cursor);
// Move the current posint at |paint_fragment|.
void MoveTo(const NGPaintFragment& paint_fragment);
......
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