| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_text_fragment_builder.h" | 5 #include "core/layout/ng/inline/ng_text_fragment_builder.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/inline/ng_inline_node.h" | 7 #include "core/layout/ng/inline/ng_inline_node.h" |
| 8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" | 8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" |
| 9 #include "core/layout/ng/ng_fragment.h" | 9 #include "core/layout/ng/ng_fragment.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 NGTextFragmentBuilder::NGTextFragmentBuilder(NGInlineNode* node) | 14 NGTextFragmentBuilder::NGTextFragmentBuilder(NGInlineNode node) |
| 15 : direction_(TextDirection::kLtr), node_(node) {} | 15 : direction_(TextDirection::kLtr), node_(node) {} |
| 16 | 16 |
| 17 NGTextFragmentBuilder& NGTextFragmentBuilder::SetDirection( | 17 NGTextFragmentBuilder& NGTextFragmentBuilder::SetDirection( |
| 18 TextDirection direction) { | 18 TextDirection direction) { |
| 19 direction_ = direction; | 19 direction_ = direction; |
| 20 return *this; | 20 return *this; |
| 21 } | 21 } |
| 22 | 22 |
| 23 NGTextFragmentBuilder& NGTextFragmentBuilder::SetSize( | 23 NGTextFragmentBuilder& NGTextFragmentBuilder::SetSize( |
| 24 const NGLogicalSize& size) { | 24 const NGLogicalSize& size) { |
| 25 size_ = size; | 25 size_ = size; |
| 26 return *this; | 26 return *this; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void NGTextFragmentBuilder::UniteMetrics(const NGLineHeightMetrics& metrics) { | 29 void NGTextFragmentBuilder::UniteMetrics(const NGLineHeightMetrics& metrics) { |
| 30 metrics_.Unite(metrics); | 30 metrics_.Unite(metrics); |
| 31 } | 31 } |
| 32 | 32 |
| 33 RefPtr<NGPhysicalTextFragment> NGTextFragmentBuilder::ToTextFragment( | 33 RefPtr<NGPhysicalTextFragment> NGTextFragmentBuilder::ToTextFragment( |
| 34 unsigned index, | 34 unsigned index, |
| 35 unsigned start_offset, | 35 unsigned start_offset, |
| 36 unsigned end_offset) { | 36 unsigned end_offset) { |
| 37 NGWritingMode writing_mode( | 37 NGWritingMode writing_mode( |
| 38 FromPlatformWritingMode(node_->Style().GetWritingMode())); | 38 FromPlatformWritingMode(node_.Style().GetWritingMode())); |
| 39 return AdoptRef(new NGPhysicalTextFragment( | 39 return AdoptRef(new NGPhysicalTextFragment( |
| 40 node_->GetLayoutObject(), node_, index, start_offset, end_offset, | 40 node_.GetLayoutObject(), node_, index, start_offset, end_offset, |
| 41 size_.ConvertToPhysical(writing_mode))); | 41 size_.ConvertToPhysical(writing_mode))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |