Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc

Issue 2764753007: [LayoutNG] Add NGLineBoxFragment (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc
index 6b10956bd53c8a565d43ff5ab6be84127f5d48a0..86c4d0d90998f910a882a9dc511531ea305e392e 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm_test.cc
@@ -7,6 +7,7 @@
#include "core/dom/TagCollection.h"
#include "core/layout/line/InlineTextBox.h"
#include "core/layout/ng/ng_inline_node.h"
+#include "core/layout/ng/ng_physical_linebox_fragment.h"
#include "core/layout/ng/ng_physical_text_fragment.h"
#include "platform/geometry/LayoutPoint.h"
#include "platform/geometry/LayoutRect.h"
@@ -56,8 +57,15 @@ TEST_F(NGTextLayoutAlgorithmTest, TextFloatsAroundFloatsBefore) {
toNGPhysicalBoxFragment(html_fragment->Children()[0].get());
auto* container_fragment =
toNGPhysicalBoxFragment(body_fragment->Children()[0].get());
- auto* text_fragments_wrapper =
+ auto* linebox_fragments_wrapper =
toNGPhysicalBoxFragment(container_fragment->Children()[0].get());
+ Vector<NGPhysicalTextFragment*> text_fragments;
+ for (const auto& child : linebox_fragments_wrapper->Children()) {
+ auto* linebox = toNGPhysicalLineboxFragment(child.get());
+ EXPECT_EQ(1u, linebox->Children().size());
+ for (const auto& text : linebox->Children())
+ text_fragments.push_back(toNGPhysicalTextFragment(text.get()));
+ }
LayoutText* layout_text =
toLayoutText(getLayoutObjectByElementId("text")->slowFirstChild());
@@ -65,10 +73,9 @@ TEST_F(NGTextLayoutAlgorithmTest, TextFloatsAroundFloatsBefore) {
// TODO(glebl): Should have only 3 text fragments. For some reason we have a
// left over fragment with text == "dog".
- ASSERT_EQ(4UL, text_fragments_wrapper->Children().size());
+ ASSERT_EQ(4UL, text_fragments.size());
- auto* text_fragment1 =
- toNGPhysicalTextFragment(text_fragments_wrapper->Children()[0].get());
+ auto* text_fragment1 = text_fragments[0];
auto* text_node = text_fragment1->Node();
// 40 = #left-float1' width 30 + #left-float2 10
EXPECT_EQ(LayoutUnit(40), text_fragment1->LeftOffset());
@@ -77,8 +84,7 @@ TEST_F(NGTextLayoutAlgorithmTest, TextFloatsAroundFloatsBefore) {
InlineTextBox* inline_text_box1 = layout_text->firstTextBox();
EXPECT_EQ(LayoutUnit(40), inline_text_box1->x());
- auto* text_fragment2 =
- toNGPhysicalTextFragment(text_fragments_wrapper->Children()[1].get());
+ auto* text_fragment2 = text_fragments[1];
// 40 = #left-float1' width 30
EXPECT_EQ(LayoutUnit(30), text_fragment2->LeftOffset());
EXPECT_EQ("brown fox jumps over",
@@ -87,8 +93,7 @@ TEST_F(NGTextLayoutAlgorithmTest, TextFloatsAroundFloatsBefore) {
InlineTextBox* inline_text_box2 = inline_text_box1->nextTextBox();
EXPECT_EQ(LayoutUnit(30), inline_text_box2->x());
- auto* text_fragment3 =
- toNGPhysicalTextFragment(text_fragments_wrapper->Children()[2].get());
+ auto* text_fragment3 = text_fragments[2];
EXPECT_EQ(LayoutUnit(), text_fragment3->LeftOffset());
EXPECT_EQ("jumps over the lazy dog",
text_node->Text(text_fragment3->StartOffset(),

Powered by Google App Engine
This is Rietveld 408576698