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

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

Issue 2871733003: [LayoutNG] Refactor NGLineBreaker for ShapingLineBreaker (Closed)
Patch Set: WIP Created 3 years, 7 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/inline/ng_inline_node.h" 5 #include "core/layout/ng/inline/ng_inline_node.h"
6 6
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h" 8 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h"
9 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" 9 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h"
10 #include "core/layout/ng/inline/ng_physical_text_fragment.h" 10 #include "core/layout/ng/inline/ng_physical_text_fragment.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); 306 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr);
307 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); 307 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl);
308 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); 308 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr);
309 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); 309 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl);
310 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); 310 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr);
311 } 311 }
312 312
313 TEST_F(NGInlineNodeTest, MinMaxContentSize) { 313 TEST_F(NGInlineNodeTest, MinMaxContentSize) {
314 UseLayoutObjectAndAhem(); 314 UseLayoutObjectAndAhem();
315 NGInlineNodeForTest* node = CreateInlineNode(); 315 NGInlineNodeForTest* node = CreateInlineNode();
316 node->Append("AB CDE", style_.Get(), layout_object_); 316 node->Append("AB CDEF", style_.Get(), layout_object_);
317 node->ShapeText(); 317 node->ShapeText();
318 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); 318 MinMaxContentSize sizes = node->ComputeMinMaxContentSize();
319 // TODO(kojii): min_content should be 20, but is 30 until 319 EXPECT_EQ(40, sizes.min_content);
320 // NGInlineLayoutAlgorithm implements trailing spaces correctly. 320 EXPECT_EQ(70, sizes.max_content);
321 EXPECT_EQ(30, sizes.min_content);
322 EXPECT_EQ(60, sizes.max_content);
323 } 321 }
324 322
325 TEST_F(NGInlineNodeTest, MinMaxContentSizeElementBoundary) { 323 TEST_F(NGInlineNodeTest, MinMaxContentSizeElementBoundary) {
326 UseLayoutObjectAndAhem(); 324 UseLayoutObjectAndAhem();
327 NGInlineNodeForTest* node = CreateInlineNode(); 325 NGInlineNodeForTest* node = CreateInlineNode();
328 node->Append("A B", style_.Get(), layout_object_); 326 node->Append("A B", style_.Get(), layout_object_);
329 node->Append("C D", style_.Get(), layout_object_); 327 node->Append("C D", style_.Get(), layout_object_);
330 node->ShapeText(); 328 node->ShapeText();
331 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); 329 MinMaxContentSize sizes = node->ComputeMinMaxContentSize();
332 // |min_content| should be the width of "BC" because there is an element 330 // |min_content| should be the width of "BC" because there is an element
333 // boundary between "B" and "C" but no break opportunities. 331 // boundary between "B" and "C" but no break opportunities.
334 // TODO(kojii): min_content should be 20, but is 30 until 332 EXPECT_EQ(20, sizes.min_content);
335 // NGInlineLayoutAlgorithm implements trailing spaces correctly.
336 EXPECT_EQ(30, sizes.min_content);
337 EXPECT_EQ(60, sizes.max_content); 333 EXPECT_EQ(60, sizes.max_content);
338 } 334 }
339 335
340 } // namespace blink 336 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698