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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc

Issue 2668183003: [LayoutNG] Make NG algorithms non-oilpan. (Closed)
Patch Set: fix win compile 2? Created 3 years, 10 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
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/ng_inline_node.h" 5 #include "core/layout/ng/ng_inline_node.h"
6 6
7 #include "core/layout/ng/ng_constraint_space.h" 7 #include "core/layout/ng/ng_constraint_space.h"
8 #include "core/layout/ng/ng_constraint_space_builder.h" 8 #include "core/layout/ng/ng_constraint_space_builder.h"
9 #include "core/layout/ng/ng_fragment_builder.h" 9 #include "core/layout/ng/ng_fragment_builder.h"
10 #include "core/layout/ng/ng_line_builder.h" 10 #include "core/layout/ng/ng_line_builder.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 style_ = ComputedStyle::create(); 62 style_ = ComputedStyle::create();
63 style_->font().update(nullptr); 63 style_->font().update(nullptr);
64 } 64 }
65 65
66 void CreateLine( 66 void CreateLine(
67 NGInlineNode* node, 67 NGInlineNode* node,
68 HeapVector<Member<const NGPhysicalTextFragment>>* fragments_out) { 68 HeapVector<Member<const NGPhysicalTextFragment>>* fragments_out) {
69 NGConstraintSpace* constraint_space = 69 NGConstraintSpace* constraint_space =
70 NGConstraintSpaceBuilder(kHorizontalTopBottom).ToConstraintSpace(); 70 NGConstraintSpaceBuilder(kHorizontalTopBottom).ToConstraintSpace();
71 NGLineBuilder line_builder(node, constraint_space); 71 NGLineBuilder line_builder(node, constraint_space);
72 NGTextLayoutAlgorithm* algorithm = 72
73 new NGTextLayoutAlgorithm(node, constraint_space); 73 NGTextLayoutAlgorithm algorithm(node, constraint_space);
74 algorithm->LayoutInline(&line_builder); 74 algorithm.LayoutInline(&line_builder);
75 75
76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox, 76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox,
77 /* layout_object */ nullptr); 77 /* layout_object */ nullptr);
78 line_builder.CreateFragments(&fragment_builder); 78 line_builder.CreateFragments(&fragment_builder);
79 NGPhysicalBoxFragment* fragment = fragment_builder.ToBoxFragment(); 79 NGPhysicalBoxFragment* fragment = fragment_builder.ToBoxFragment();
80 for (const NGPhysicalFragment* child : fragment->Children()) { 80 for (const NGPhysicalFragment* child : fragment->Children()) {
81 fragments_out->push_back(toNGPhysicalTextFragment(child)); 81 fragments_out->push_back(toNGPhysicalTextFragment(child));
82 } 82 }
83 } 83 }
84 84
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 CreateLine(node, &fragments); 191 CreateLine(node, &fragments);
192 ASSERT_EQ(5u, fragments.size()); 192 ASSERT_EQ(5u, fragments.size());
193 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 1u, TextDirection::kLtr); 193 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 1u, TextDirection::kLtr);
194 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 7u, TextDirection::kRtl); 194 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 7u, TextDirection::kRtl);
195 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 5u, TextDirection::kLtr); 195 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 5u, TextDirection::kLtr);
196 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 3u, TextDirection::kRtl); 196 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 3u, TextDirection::kRtl);
197 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 9u, TextDirection::kLtr); 197 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 9u, TextDirection::kLtr);
198 } 198 }
199 199
200 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698