| 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/ng_inline_node.h" | 5 #include "core/layout/ng/ng_inline_node.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.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_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_EQ(end_offset, fragment->EndOffset()); \ | 211 EXPECT_EQ(end_offset, fragment->EndOffset()); \ |
| 212 EXPECT_EQ(dir, node->Items()[fragment->ItemIndex()].Direction()) | 212 EXPECT_EQ(dir, node->Items()[fragment->ItemIndex()].Direction()) |
| 213 | 213 |
| 214 TEST_F(NGInlineNodeTest, CreateLineBidiIsolate) { | 214 TEST_F(NGInlineNodeTest, CreateLineBidiIsolate) { |
| 215 UseLayoutObjectAndAhem(); | 215 UseLayoutObjectAndAhem(); |
| 216 RefPtr<ComputedStyle> style = ComputedStyle::create(); | 216 RefPtr<ComputedStyle> style = ComputedStyle::create(); |
| 217 style->setLineHeight(Length(1, Fixed)); | 217 style->setLineHeight(Length(1, Fixed)); |
| 218 style->font().update(nullptr); | 218 style->font().update(nullptr); |
| 219 NGInlineNodeForTest* node = | 219 NGInlineNodeForTest* node = |
| 220 CreateBidiIsolateNode(CreateInlineNode(), style.get(), layout_object_); | 220 CreateBidiIsolateNode(CreateInlineNode(), style.get(), layout_object_); |
| 221 node->ShapeText(); |
| 221 Vector<RefPtr<const NGPhysicalTextFragment>> fragments; | 222 Vector<RefPtr<const NGPhysicalTextFragment>> fragments; |
| 222 CreateLine(node, &fragments); | 223 CreateLine(node, &fragments); |
| 223 ASSERT_EQ(5u, fragments.size()); | 224 ASSERT_EQ(5u, fragments.size()); |
| 224 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); | 225 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); |
| 225 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); | 226 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); |
| 226 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); | 227 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); |
| 227 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); | 228 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); |
| 228 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); | 229 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); |
| 229 } | 230 } |
| 230 | 231 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 249 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); | 250 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); |
| 250 // |min_content| should be the width of "BC" because there is an element | 251 // |min_content| should be the width of "BC" because there is an element |
| 251 // boundary between "B" and "C" but no break opportunities. | 252 // boundary between "B" and "C" but no break opportunities. |
| 252 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder | 253 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder |
| 253 // implements trailing spaces correctly. | 254 // implements trailing spaces correctly. |
| 254 EXPECT_EQ(30, sizes.min_content); | 255 EXPECT_EQ(30, sizes.min_content); |
| 255 EXPECT_EQ(60, sizes.max_content); | 256 EXPECT_EQ(60, sizes.max_content); |
| 256 } | 257 } |
| 257 | 258 |
| 258 } // namespace blink | 259 } // namespace blink |
| OLD | NEW |