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

Side by Side Diff: third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp

Issue 2649583002: [LayoutNG] Remove the ng_layout_coordinator and temporary LayoutSync method. (Closed)
Patch Set: rebase v2 Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/layout_ng_block_flow.h" 5 #include "core/layout/ng/layout_ng_block_flow.h"
6 #include "core/layout/ng/ng_constraint_space_builder.h" 6 #include "core/layout/ng/ng_constraint_space_builder.h"
7 #include "core/layout/ng/ng_inline_layout_algorithm.h" 7 #include "core/layout/ng/ng_inline_layout_algorithm.h"
8 #include "core/layout/ng/ng_inline_node.h" 8 #include "core/layout/ng/ng_inline_node.h"
9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
10 #include "platform/testing/UnitTestHelpers.h" 10 #include "platform/testing/UnitTestHelpers.h"
(...skipping 30 matching lines...) Expand all
41 41
42 compositor().beginFrame(); 42 compositor().beginFrame();
43 ASSERT_FALSE(compositor().needsBeginFrame()); 43 ASSERT_FALSE(compositor().needsBeginFrame());
44 44
45 Element* target = document().getElementById("target"); 45 Element* target = document().getElementById("target");
46 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject()); 46 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject());
47 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow); 47 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow);
48 48
49 NGInlineNode* inlineBox = 49 NGInlineNode* inlineBox =
50 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle()); 50 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle());
51 NGInlineLayoutAlgorithm* layoutAlgorithm = new NGInlineLayoutAlgorithm( 51 NGPhysicalFragment* fragment =
52 blockFlow->style(), inlineBox, constraintSpace); 52 NGInlineLayoutAlgorithm(blockFlow->style(), inlineBox, constraintSpace)
53 53 .Layout();
54 NGPhysicalFragment* fragment; 54 EXPECT_TRUE(fragment);
55 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) {
56 // Repeat until layout completes.
57 }
58 55
59 String expectedText("Hello World!"); 56 String expectedText("Hello World!");
60 EXPECT_EQ(expectedText, inlineBox->Text(0, 12)); 57 EXPECT_EQ(expectedText, inlineBox->Text(0, 12));
61 } 58 }
62 59
63 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) { 60 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) {
64 RuntimeEnabledFeatures::setLayoutNGEnabled(true); 61 RuntimeEnabledFeatures::setLayoutNGEnabled(true);
65 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true); 62 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true);
66 63
67 SimRequest mainResource("https://example.com/", "text/html"); 64 SimRequest mainResource("https://example.com/", "text/html");
68 loadURL("https://example.com/"); 65 loadURL("https://example.com/");
69 mainResource.complete("<div id=\"target\">Hello <img>.</div>"); 66 mainResource.complete("<div id=\"target\">Hello <img>.</div>");
70 67
71 compositor().beginFrame(); 68 compositor().beginFrame();
72 ASSERT_FALSE(compositor().needsBeginFrame()); 69 ASSERT_FALSE(compositor().needsBeginFrame());
73 70
74 Element* target = document().getElementById("target"); 71 Element* target = document().getElementById("target");
75 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject()); 72 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject());
76 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow); 73 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow);
77 74
78 NGInlineNode* inlineBox = 75 NGInlineNode* inlineBox =
79 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle()); 76 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle());
80 NGInlineLayoutAlgorithm* layoutAlgorithm = new NGInlineLayoutAlgorithm( 77 NGPhysicalFragment* fragment =
81 blockFlow->style(), inlineBox, constraintSpace); 78 NGInlineLayoutAlgorithm(blockFlow->style(), inlineBox, constraintSpace)
82 79 .Layout();
83 NGPhysicalFragment* fragment; 80 EXPECT_TRUE(fragment);
84 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) {
85 // Repeat until layout completes.
86 }
87 81
88 String expectedText("Hello "); 82 String expectedText("Hello ");
89 expectedText.append(objectReplacementCharacter); 83 expectedText.append(objectReplacementCharacter);
90 expectedText.append("."); 84 expectedText.append(".");
91 EXPECT_EQ(expectedText, inlineBox->Text(0, 8)); 85 EXPECT_EQ(expectedText, inlineBox->Text(0, 8));
92 } 86 }
93 87
94 } // namespace blink 88 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698