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

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

Issue 2921463004: [LayoutNG] PODify NGLayoutInputNode and sub-classes. (Closed)
Patch Set: new ng-bot expectations Created 3 years, 6 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_unpositioned_float.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/exported/WebViewBase.h" 5 #include "core/exported/WebViewBase.h"
6 #include "core/layout/ng/inline/ng_inline_node.h" 6 #include "core/layout/ng/inline/ng_inline_node.h"
7 #include "core/layout/ng/layout_ng_block_flow.h" 7 #include "core/layout/ng/layout_ng_block_flow.h"
8 #include "core/layout/ng/ng_block_layout_algorithm.h" 8 #include "core/layout/ng/ng_block_layout_algorithm.h"
9 #include "core/layout/ng/ng_constraint_space_builder.h" 9 #include "core/layout/ng/ng_constraint_space_builder.h"
10 #include "core/layout/ng/ng_layout_result.h" 10 #include "core/layout/ng/ng_layout_result.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 "<div id=\"target\">Hello <strong>World</strong>!</div>"); 42 "<div id=\"target\">Hello <strong>World</strong>!</div>");
43 43
44 Compositor().BeginFrame(); 44 Compositor().BeginFrame();
45 ASSERT_FALSE(Compositor().NeedsBeginFrame()); 45 ASSERT_FALSE(Compositor().NeedsBeginFrame());
46 46
47 Element* target = GetDocument().getElementById("target"); 47 Element* target = GetDocument().getElementById("target");
48 LayoutNGBlockFlow* block_flow = 48 LayoutNGBlockFlow* block_flow =
49 ToLayoutNGBlockFlow(target->GetLayoutObject()); 49 ToLayoutNGBlockFlow(target->GetLayoutObject());
50 RefPtr<NGConstraintSpace> constraint_space = 50 RefPtr<NGConstraintSpace> constraint_space =
51 ConstraintSpaceForElement(block_flow); 51 ConstraintSpaceForElement(block_flow);
52 NGBlockNode* node = new NGBlockNode(block_flow); 52 NGBlockNode node(block_flow);
53 53
54 RefPtr<NGLayoutResult> result = 54 RefPtr<NGLayoutResult> result =
55 NGBlockLayoutAlgorithm(node, constraint_space.Get()).Layout(); 55 NGBlockLayoutAlgorithm(node, constraint_space.Get()).Layout();
56 EXPECT_TRUE(result); 56 EXPECT_TRUE(result);
57 57
58 String expected_text("Hello World!"); 58 String expected_text("Hello World!");
59 EXPECT_EQ(expected_text, ToNGInlineNode(node->FirstChild())->Text(0, 12)); 59 EXPECT_EQ(expected_text, ToNGInlineNode(node.FirstChild()).Text(0, 12));
60 } 60 }
61 61
62 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) { 62 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) {
63 RuntimeEnabledFeatures::setLayoutNGEnabled(true); 63 RuntimeEnabledFeatures::setLayoutNGEnabled(true);
64 64
65 SimRequest main_resource("https://example.com/", "text/html"); 65 SimRequest main_resource("https://example.com/", "text/html");
66 LoadURL("https://example.com/"); 66 LoadURL("https://example.com/");
67 main_resource.Complete("<div id=\"target\">Hello <img>.</div>"); 67 main_resource.Complete("<div id=\"target\">Hello <img>.</div>");
68 68
69 Compositor().BeginFrame(); 69 Compositor().BeginFrame();
70 ASSERT_FALSE(Compositor().NeedsBeginFrame()); 70 ASSERT_FALSE(Compositor().NeedsBeginFrame());
71 71
72 Element* target = GetDocument().getElementById("target"); 72 Element* target = GetDocument().getElementById("target");
73 LayoutNGBlockFlow* block_flow = 73 LayoutNGBlockFlow* block_flow =
74 ToLayoutNGBlockFlow(target->GetLayoutObject()); 74 ToLayoutNGBlockFlow(target->GetLayoutObject());
75 RefPtr<NGConstraintSpace> constraint_space = 75 RefPtr<NGConstraintSpace> constraint_space =
76 ConstraintSpaceForElement(block_flow); 76 ConstraintSpaceForElement(block_flow);
77 NGBlockNode* node = new NGBlockNode(block_flow); 77 NGBlockNode node(block_flow);
78 78
79 RefPtr<NGLayoutResult> result = 79 RefPtr<NGLayoutResult> result =
80 NGBlockLayoutAlgorithm(node, constraint_space.Get()).Layout(); 80 NGBlockLayoutAlgorithm(node, constraint_space.Get()).Layout();
81 EXPECT_TRUE(result); 81 EXPECT_TRUE(result);
82 82
83 String expected_text("Hello "); 83 String expected_text("Hello ");
84 expected_text.append(kObjectReplacementCharacter); 84 expected_text.append(kObjectReplacementCharacter);
85 expected_text.append("."); 85 expected_text.append(".");
86 EXPECT_EQ(expected_text, ToNGInlineNode(node->FirstChild())->Text(0, 8)); 86 EXPECT_EQ(expected_text, ToNGInlineNode(node.FirstChild()).Text(0, 8));
87 87
88 // Delete the line box tree to avoid leaks in the test. 88 // Delete the line box tree to avoid leaks in the test.
89 block_flow->DeleteLineBoxTree(); 89 block_flow->DeleteLineBoxTree();
90 } 90 }
91 91
92 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_unpositioned_float.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698