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

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

Issue 2892293002: Add a basic support of text-align:right property to NGInlineLayoutAlgorithm. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/inline/ng_line_box_fragment_builder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(
46 LayoutUnit available_inline_size) {
47 NGWritingMode writing_mode(
48 FromPlatformWritingMode(node_->Style().GetWritingMode()));
49 LayoutUnit base_inline_offset = available_inline_size - inline_size_;
kojii 2017/05/22 03:27:03 Can't we add delta instead? The position may not b
50 LayoutUnit child_inline_size;
51 for (size_t i = 0; i < children_.size(); ++i) {
52 offsets_[i].inline_offset = base_inline_offset + child_inline_size;
53 NGPhysicalFragment* child = children_[i].Get();
54 child_inline_size +=
55 child->Size().ConvertToLogical(writing_mode).inline_size;
56 }
57 }
58
45 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta, 59 void NGLineBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta,
46 unsigned start, 60 unsigned start,
47 unsigned end) { 61 unsigned end) {
48 for (unsigned index = start; index < end; index++) 62 for (unsigned index = start; index < end; index++)
49 offsets_[index].block_offset += delta; 63 offsets_[index].block_offset += delta;
50 } 64 }
51 65
52 void NGLineBoxFragmentBuilder::SetMetrics(const NGLineHeightMetrics& metrics) { 66 void NGLineBoxFragmentBuilder::SetMetrics(const NGLineHeightMetrics& metrics) {
53 metrics_ = metrics; 67 metrics_ = metrics;
54 } 68 }
(...skipping 19 matching lines...) Expand all
74 writing_mode, direction_, physical_size, child->Size())); 88 writing_mode, direction_, physical_size, child->Size()));
75 } 89 }
76 90
77 return AdoptRef(new NGPhysicalLineBoxFragment( 91 return AdoptRef(new NGPhysicalLineBoxFragment(
78 physical_size, children_, metrics_, 92 physical_size, children_, metrics_,
79 break_token_ ? std::move(break_token_) 93 break_token_ ? std::move(break_token_)
80 : NGInlineBreakToken::Create(node_))); 94 : NGInlineBreakToken::Create(node_)));
81 } 95 }
82 96
83 } // namespace blink 97 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/inline/ng_line_box_fragment_builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698