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

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

Issue 2612103004: [ng_layout] Rename NGFragmentBase,NGFragment,NGPhysicalFragment (Closed)
Patch Set: CR: rename ifdef guards 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 NGInlineLayoutAlgorithm* layoutAlgorithm = new NGInlineLayoutAlgorithm(
52 blockFlow->style(), inlineBox, constraintSpace); 52 blockFlow->style(), inlineBox, constraintSpace);
53 53
54 NGPhysicalFragmentBase* fragment; 54 NGPhysicalFragment* fragment;
55 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) { 55 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) {
56 // Repeat until layout completes. 56 // Repeat until layout completes.
57 } 57 }
58 58
59 String expectedText("Hello World!"); 59 String expectedText("Hello World!");
60 EXPECT_EQ(expectedText, inlineBox->Text(0, 12)); 60 EXPECT_EQ(expectedText, inlineBox->Text(0, 12));
61 } 61 }
62 62
63 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) { 63 TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) {
64 RuntimeEnabledFeatures::setLayoutNGEnabled(true); 64 RuntimeEnabledFeatures::setLayoutNGEnabled(true);
65 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true); 65 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true);
66 66
67 SimRequest mainResource("https://example.com/", "text/html"); 67 SimRequest mainResource("https://example.com/", "text/html");
68 loadURL("https://example.com/"); 68 loadURL("https://example.com/");
69 mainResource.complete("<div id=\"target\">Hello <img>.</div>"); 69 mainResource.complete("<div id=\"target\">Hello <img>.</div>");
70 70
71 compositor().beginFrame(); 71 compositor().beginFrame();
72 ASSERT_FALSE(compositor().needsBeginFrame()); 72 ASSERT_FALSE(compositor().needsBeginFrame());
73 73
74 Element* target = document().getElementById("target"); 74 Element* target = document().getElementById("target");
75 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject()); 75 LayoutNGBlockFlow* blockFlow = toLayoutNGBlockFlow(target->layoutObject());
76 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow); 76 NGConstraintSpace* constraintSpace = constraintSpaceForElement(blockFlow);
77 77
78 NGInlineNode* inlineBox = 78 NGInlineNode* inlineBox =
79 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle()); 79 new NGInlineNode(blockFlow->firstChild(), blockFlow->mutableStyle());
80 NGInlineLayoutAlgorithm* layoutAlgorithm = new NGInlineLayoutAlgorithm( 80 NGInlineLayoutAlgorithm* layoutAlgorithm = new NGInlineLayoutAlgorithm(
81 blockFlow->style(), inlineBox, constraintSpace); 81 blockFlow->style(), inlineBox, constraintSpace);
82 82
83 NGPhysicalFragmentBase* fragment; 83 NGPhysicalFragment* fragment;
84 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) { 84 while (layoutAlgorithm->Layout(nullptr, &fragment, nullptr) != kNewFragment) {
85 // Repeat until layout completes. 85 // Repeat until layout completes.
86 } 86 }
87 87
88 String expectedText("Hello "); 88 String expectedText("Hello ");
89 expectedText.append(objectReplacementCharacter); 89 expectedText.append(objectReplacementCharacter);
90 expectedText.append("."); 90 expectedText.append(".");
91 EXPECT_EQ(expectedText, inlineBox->Text(0, 8)); 91 EXPECT_EQ(expectedText, inlineBox->Text(0, 8));
92 } 92 }
93 93
94 } // namespace blink 94 } // 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