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

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

Issue 2679343002: Fragment that establishes new BFC knows it's BFC offset in parent space (Closed)
Patch Set: 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
(...skipping 99 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
120 // Whether the child and the containing block are parallel to each other. 124 // Whether the child and the containing block are parallel to each other.
121 // Example: vertical-rl and vertical-lr 125 // Example: vertical-rl and vertical-lr
122 bool is_in_parallel_flow = (parent_writing_mode_ == kHorizontalTopBottom) == 126 bool is_in_parallel_flow = (parent_writing_mode_ == kHorizontalTopBottom) ==
123 (writing_mode_ == kHorizontalTopBottom); 127 (writing_mode_ == kHorizontalTopBottom);
124 128
129 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_;
130 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_;
131
125 if (is_in_parallel_flow) { 132 if (is_in_parallel_flow) {
126 return new NGConstraintSpace( 133 return new NGConstraintSpace(
127 static_cast<NGWritingMode>(writing_mode_), 134 static_cast<NGWritingMode>(writing_mode_),
128 static_cast<TextDirection>(text_direction_), 135 static_cast<TextDirection>(text_direction_),
129 {available_size_.inline_size, available_size_.block_size}, 136 {available_size_.inline_size, available_size_.block_size},
130 {percentage_resolution_size_.inline_size, 137 {percentage_resolution_size_.inline_size,
131 percentage_resolution_size_.block_size}, 138 percentage_resolution_size_.block_size},
132 fragmentainer_space_available_, is_fixed_size_inline_, 139 fragmentainer_space_available_, is_fixed_size_inline_,
133 is_fixed_size_block_, is_shrink_to_fit_, 140 is_fixed_size_block_, is_shrink_to_fit_,
134 is_inline_direction_triggers_scrollbar_, 141 is_inline_direction_triggers_scrollbar_,
135 is_block_direction_triggers_scrollbar_, 142 is_block_direction_triggers_scrollbar_,
136 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 143 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
137 margin_strut_, bfc_offset_, exclusions_); 144 margin_strut, bfc_offset, exclusions);
138 } 145 }
139 146
140 return new NGConstraintSpace( 147 return new NGConstraintSpace(
141 static_cast<NGWritingMode>(writing_mode_), 148 static_cast<NGWritingMode>(writing_mode_),
142 static_cast<TextDirection>(text_direction_), 149 static_cast<TextDirection>(text_direction_),
143 {available_size_.block_size, available_size_.inline_size}, 150 {available_size_.block_size, available_size_.inline_size},
144 {percentage_resolution_size_.block_size, 151 {percentage_resolution_size_.block_size,
145 percentage_resolution_size_.inline_size}, 152 percentage_resolution_size_.inline_size},
146 fragmentainer_space_available_, is_fixed_size_block_, 153 fragmentainer_space_available_, is_fixed_size_block_,
147 is_fixed_size_inline_, is_shrink_to_fit_, 154 is_fixed_size_inline_, is_shrink_to_fit_,
148 is_block_direction_triggers_scrollbar_, 155 is_block_direction_triggers_scrollbar_,
149 is_inline_direction_triggers_scrollbar_, 156 is_inline_direction_triggers_scrollbar_,
150 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 157 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
151 margin_strut_, bfc_offset_, exclusions_); 158 margin_strut, bfc_offset, exclusions);
152 } 159 }
153 160
154 } // namespace blink 161 } // 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