OLD | NEW |
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); | 318 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); |
319 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); | 319 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); |
320 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); | 320 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); |
321 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); | 321 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); |
322 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); | 322 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); |
323 } | 323 } |
324 | 324 |
325 TEST_F(NGInlineNodeTest, MinMaxContentSize) { | 325 TEST_F(NGInlineNodeTest, MinMaxContentSize) { |
326 UseLayoutObjectAndAhem(); | 326 UseLayoutObjectAndAhem(); |
327 NGInlineNodeForTest* node = CreateInlineNode(); | 327 NGInlineNodeForTest* node = CreateInlineNode(); |
328 node->Append("AB CDE", style_.Get(), layout_object_); | 328 node->Append("AB CDEF", style_.Get(), layout_object_); |
329 node->ShapeText(); | 329 node->ShapeText(); |
330 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); | 330 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); |
331 // TODO(kojii): min_content should be 20, but is 30 until | 331 EXPECT_EQ(40, sizes.min_content); |
332 // NGInlineLayoutAlgorithm implements trailing spaces correctly. | 332 EXPECT_EQ(70, sizes.max_content); |
333 EXPECT_EQ(30, sizes.min_content); | |
334 EXPECT_EQ(60, sizes.max_content); | |
335 } | 333 } |
336 | 334 |
337 TEST_F(NGInlineNodeTest, MinMaxContentSizeElementBoundary) { | 335 TEST_F(NGInlineNodeTest, MinMaxContentSizeElementBoundary) { |
338 UseLayoutObjectAndAhem(); | 336 UseLayoutObjectAndAhem(); |
339 NGInlineNodeForTest* node = CreateInlineNode(); | 337 NGInlineNodeForTest* node = CreateInlineNode(); |
340 node->Append("A B", style_.Get(), layout_object_); | 338 node->Append("A B", style_.Get(), layout_object_); |
341 node->Append("C D", style_.Get(), layout_object_); | 339 node->Append("C D", style_.Get(), layout_object_); |
342 node->ShapeText(); | 340 node->ShapeText(); |
343 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); | 341 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); |
344 // |min_content| should be the width of "BC" because there is an element | 342 // |min_content| should be the width of "BC" because there is an element |
345 // boundary between "B" and "C" but no break opportunities. | 343 // boundary between "B" and "C" but no break opportunities. |
346 // TODO(kojii): min_content should be 20, but is 30 until | 344 EXPECT_EQ(20, sizes.min_content); |
347 // NGInlineLayoutAlgorithm implements trailing spaces correctly. | |
348 EXPECT_EQ(30, sizes.min_content); | |
349 EXPECT_EQ(60, sizes.max_content); | 345 EXPECT_EQ(60, sizes.max_content); |
350 } | 346 } |
351 | 347 |
352 } // namespace blink | 348 } // namespace blink |
OLD | NEW |