| 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_line_box_fragment_builder.h" | 5 #include "core/layout/ng/inline/ng_line_box_fragment_builder.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/geometry/ng_logical_size.h" | 7 #include "core/layout/ng/geometry/ng_logical_size.h" |
| 8 #include "core/layout/ng/inline/ng_inline_break_token.h" | 8 #include "core/layout/ng/inline/ng_inline_break_token.h" |
| 9 #include "core/layout/ng/inline/ng_inline_node.h" | 9 #include "core/layout/ng/inline/ng_inline_node.h" |
| 10 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" | 10 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 offsets_.push_back(child_offset); | 35 offsets_.push_back(child_offset); |
| 36 | 36 |
| 37 return *this; | 37 return *this; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta) { | 40 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta) { |
| 41 for (auto& offset : offsets_) | 41 for (auto& offset : offsets_) |
| 42 offset.block_offset += delta; | 42 offset.block_offset += delta; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void NGLineBoxFragmentBuilder::MoveChildrenInInlineDirection(LayoutUnit delta) { |
| 46 NGWritingMode writing_mode( |
| 47 FromPlatformWritingMode(node_->Style().GetWritingMode())); |
| 48 LayoutUnit child_inline_size; |
| 49 for (size_t i = 0; i < children_.size(); ++i) { |
| 50 offsets_[i].inline_offset = delta + child_inline_size; |
| 51 NGPhysicalFragment* child = children_[i].Get(); |
| 52 child_inline_size += |
| 53 child->Size().ConvertToLogical(writing_mode).inline_size; |
| 54 } |
| 55 } |
| 56 |
| 45 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta, | 57 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta, |
| 46 unsigned start, | 58 unsigned start, |
| 47 unsigned end) { | 59 unsigned end) { |
| 48 for (unsigned index = start; index < end; index++) | 60 for (unsigned index = start; index < end; index++) |
| 49 offsets_[index].block_offset += delta; | 61 offsets_[index].block_offset += delta; |
| 50 } | 62 } |
| 51 | 63 |
| 52 void NGLineBoxFragmentBuilder::SetMetrics(const NGLineHeightMetrics& metrics) { | 64 void NGLineBoxFragmentBuilder::SetMetrics(const NGLineHeightMetrics& metrics) { |
| 53 metrics_ = metrics; | 65 metrics_ = metrics; |
| 54 } | 66 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 writing_mode, direction_, physical_size, child->Size())); | 86 writing_mode, direction_, physical_size, child->Size())); |
| 75 } | 87 } |
| 76 | 88 |
| 77 return AdoptRef(new NGPhysicalLineBoxFragment( | 89 return AdoptRef(new NGPhysicalLineBoxFragment( |
| 78 physical_size, children_, metrics_, | 90 physical_size, children_, metrics_, |
| 79 break_token_ ? std::move(break_token_) | 91 break_token_ ? std::move(break_token_) |
| 80 : NGInlineBreakToken::Create(node_))); | 92 : NGInlineBreakToken::Create(node_))); |
| 81 } | 93 } |
| 82 | 94 |
| 83 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |