Commit 0d195767 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

[NGFragmentItem] Utilize NGInlineCursor in PaintControllerPaintTest.InlineRelayout

This patch changes |PaintControllerPaintTest.InlineRelayout| to use
|NGInlineCursor| to handle both |NGFragmentItem| and |NGPaintFragment|.

Bug: 982194
Change-Id: I116261e749509584bed5c023089b25722bb74b7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108423
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751257}
parent 90a421cb
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "third_party/blink/renderer/core/editing/frame_selection.h" #include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/layout/layout_text.h" #include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/line/inline_text_box.h" #include "third_party/blink/renderer/core/layout/line/inline_text_box.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h"
#include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h" #include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h"
#include "third_party/blink/renderer/core/paint/object_paint_properties.h" #include "third_party/blink/renderer/core/paint/object_paint_properties.h"
...@@ -58,37 +59,39 @@ TEST_P(PaintControllerPaintTest, InlineRelayout) { ...@@ -58,37 +59,39 @@ TEST_P(PaintControllerPaintTest, InlineRelayout) {
auto& div_block = auto& div_block =
*To<LayoutBlock>(GetDocument().body()->firstChild()->GetLayoutObject()); *To<LayoutBlock>(GetDocument().body()->firstChild()->GetLayoutObject());
LayoutText& text = *ToLayoutText(div_block.FirstChild()); LayoutText& text = *ToLayoutText(div_block.FirstChild());
DisplayItemClient& first_text_box = const DisplayItemClient* first_text_box = text.FirstTextBox();
text.FirstInlineFragment() if (text.IsInLayoutNGInlineFormattingContext()) {
? (DisplayItemClient&)*text.FirstInlineFragment() NGInlineCursor cursor;
: (DisplayItemClient&)*text.FirstTextBox(); cursor.MoveTo(text);
first_text_box = cursor.Current().GetDisplayItemClient();
}
EXPECT_THAT(RootPaintController().GetDisplayItemList(), EXPECT_THAT(RootPaintController().GetDisplayItemList(),
ElementsAre(IsSameId(&ViewScrollingBackgroundClient(), ElementsAre(IsSameId(&ViewScrollingBackgroundClient(),
kDocumentBackgroundType), kDocumentBackgroundType),
IsSameId(&first_text_box, kForegroundType))); IsSameId(first_text_box, kForegroundType)));
div.setAttribute(html_names::kStyleAttr, "width: 10px; height: 200px"); div.setAttribute(html_names::kStyleAttr, "width: 10px; height: 200px");
UpdateAllLifecyclePhasesForTest(); UpdateAllLifecyclePhasesForTest();
LayoutText& new_text = *ToLayoutText(div_block.FirstChild()); LayoutText& new_text = *ToLayoutText(div_block.FirstChild());
DisplayItemClient& new_first_text_box = const DisplayItemClient* new_first_text_box = text.FirstTextBox();
new_text.FirstInlineFragment() const DisplayItemClient* second_text_box = nullptr;
? (DisplayItemClient&)*new_text.FirstInlineFragment() if (!text.IsInLayoutNGInlineFormattingContext()) {
: (DisplayItemClient&)*text.FirstTextBox(); second_text_box = new_text.FirstTextBox()->NextForSameLayoutObject();
DisplayItemClient& second_text_box = } else {
new_text.FirstInlineFragment() NGInlineCursor cursor;
? (DisplayItemClient&)*NGPaintFragment:: cursor.MoveTo(text);
TraverseNextForSameLayoutObject::Next( new_first_text_box = cursor.Current().GetDisplayItemClient();
new_text.FirstInlineFragment()) cursor.MoveToNextForSameLayoutObject();
: (DisplayItemClient&)*new_text.FirstTextBox() second_text_box = cursor.Current().GetDisplayItemClient();
->NextForSameLayoutObject(); }
EXPECT_THAT(RootPaintController().GetDisplayItemList(), EXPECT_THAT(RootPaintController().GetDisplayItemList(),
ElementsAre(IsSameId(&ViewScrollingBackgroundClient(), ElementsAre(IsSameId(&ViewScrollingBackgroundClient(),
kDocumentBackgroundType), kDocumentBackgroundType),
IsSameId(&new_first_text_box, kForegroundType), IsSameId(new_first_text_box, kForegroundType),
IsSameId(&second_text_box, kForegroundType))); IsSameId(second_text_box, kForegroundType)));
} }
TEST_P(PaintControllerPaintTest, ChunkIdClientCacheFlag) { TEST_P(PaintControllerPaintTest, ChunkIdClientCacheFlag) {
......
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