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

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

Issue 2651793013: Fix incorrectly calculated size/position information for writing-modes (Closed)
Patch Set: git rebase-update Created 3 years, 10 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/ng_constraint_space.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 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_constraint_space_builder.h" 5 #include "core/layout/ng/ng_constraint_space_builder.h"
6 6
7 #include "core/layout/ng/ng_length_utils.h" 7 #include "core/layout/ng/ng_length_utils.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 NGConstraintSpaceBuilder::NGConstraintSpaceBuilder( 11 NGConstraintSpaceBuilder::NGConstraintSpaceBuilder(
12 const NGConstraintSpace* parent_space) 12 const NGConstraintSpace* parent_space)
13 : available_size_(parent_space->AvailableSize()), 13 : available_size_(parent_space->AvailableSize()),
14 percentage_resolution_size_(parent_space->PercentageResolutionSize()), 14 percentage_resolution_size_(parent_space->PercentageResolutionSize()),
15 fragmentainer_space_available_(NGSizeIndefinite), 15 fragmentainer_space_available_(NGSizeIndefinite),
16 writing_mode_(parent_space->WritingMode()), 16 writing_mode_(parent_space->WritingMode()),
17 parent_writing_mode_(writing_mode_), 17 parent_writing_mode_(parent_space->WritingMode()),
18 is_fixed_size_inline_(false), 18 is_fixed_size_inline_(false),
19 is_fixed_size_block_(false), 19 is_fixed_size_block_(false),
20 is_shrink_to_fit_(false), 20 is_shrink_to_fit_(false),
21 is_inline_direction_triggers_scrollbar_(false), 21 is_inline_direction_triggers_scrollbar_(false),
22 is_block_direction_triggers_scrollbar_(false), 22 is_block_direction_triggers_scrollbar_(false),
23 fragmentation_type_(parent_space->BlockFragmentationType()), 23 fragmentation_type_(parent_space->BlockFragmentationType()),
24 is_new_fc_(parent_space->IsNewFormattingContext()), 24 is_new_fc_(parent_space->IsNewFormattingContext()),
25 text_direction_(static_cast<unsigned>(parent_space->Direction())), 25 text_direction_(static_cast<unsigned>(parent_space->Direction())),
26 bfc_offset_(parent_space->bfc_offset_), 26 bfc_offset_(parent_space->bfc_offset_),
27 exclusions_(parent_space->Exclusions()) {} 27 exclusions_(parent_space->Exclusions()) {}
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return *this; 110 return *this;
111 } 111 }
112 112
113 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetWritingMode( 113 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetWritingMode(
114 NGWritingMode writing_mode) { 114 NGWritingMode writing_mode) {
115 writing_mode_ = writing_mode; 115 writing_mode_ = writing_mode;
116 return *this; 116 return *this;
117 } 117 }
118 118
119 NGConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace() { 119 NGConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace() {
120 // Exclusions do not pass the formatting context boundary.
121 std::shared_ptr<NGExclusions> exclusions(
122 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_);
123
124 // Whether the child and the containing block are parallel to each other. 120 // Whether the child and the containing block are parallel to each other.
125 // Example: vertical-rl and vertical-lr 121 // Example: vertical-rl and vertical-lr
126 bool is_in_parallel_flow = (parent_writing_mode_ == kHorizontalTopBottom) == 122 bool is_in_parallel_flow = (parent_writing_mode_ == kHorizontalTopBottom) ==
127 (writing_mode_ == kHorizontalTopBottom); 123 (writing_mode_ == kHorizontalTopBottom);
128 124
129 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_;
130 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_;
131
132 if (is_in_parallel_flow) { 125 if (is_in_parallel_flow) {
133 return new NGConstraintSpace( 126 return new NGConstraintSpace(
134 static_cast<NGWritingMode>(writing_mode_), 127 static_cast<NGWritingMode>(writing_mode_),
135 static_cast<TextDirection>(text_direction_), 128 static_cast<TextDirection>(text_direction_),
136 {available_size_.inline_size, available_size_.block_size}, 129 {available_size_.inline_size, available_size_.block_size},
137 {percentage_resolution_size_.inline_size, 130 {percentage_resolution_size_.inline_size,
138 percentage_resolution_size_.block_size}, 131 percentage_resolution_size_.block_size},
139 fragmentainer_space_available_, is_fixed_size_inline_, 132 fragmentainer_space_available_, is_fixed_size_inline_,
140 is_fixed_size_block_, is_shrink_to_fit_, 133 is_fixed_size_block_, is_shrink_to_fit_,
141 is_inline_direction_triggers_scrollbar_, 134 is_inline_direction_triggers_scrollbar_,
142 is_block_direction_triggers_scrollbar_, 135 is_block_direction_triggers_scrollbar_,
143 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 136 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
144 margin_strut, bfc_offset, exclusions); 137 margin_strut_, bfc_offset_, exclusions_);
145 } 138 }
146 139
147 return new NGConstraintSpace( 140 return new NGConstraintSpace(
148 static_cast<NGWritingMode>(writing_mode_), 141 static_cast<NGWritingMode>(writing_mode_),
149 static_cast<TextDirection>(text_direction_), 142 static_cast<TextDirection>(text_direction_),
150 {available_size_.block_size, available_size_.inline_size}, 143 {available_size_.block_size, available_size_.inline_size},
151 {percentage_resolution_size_.block_size, 144 {percentage_resolution_size_.block_size,
152 percentage_resolution_size_.inline_size}, 145 percentage_resolution_size_.inline_size},
153 fragmentainer_space_available_, is_fixed_size_block_, 146 fragmentainer_space_available_, is_fixed_size_block_,
154 is_fixed_size_inline_, is_shrink_to_fit_, 147 is_fixed_size_inline_, is_shrink_to_fit_,
155 is_block_direction_triggers_scrollbar_, 148 is_block_direction_triggers_scrollbar_,
156 is_inline_direction_triggers_scrollbar_, 149 is_inline_direction_triggers_scrollbar_,
157 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 150 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
158 margin_strut, bfc_offset, exclusions); 151 margin_strut_, bfc_offset_, exclusions_);
159 } 152 }
160 153
161 } // namespace blink 154 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698