Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_block_node.h" | 5 #include "core/layout/ng/ng_block_node.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlockFlow.h" | 7 #include "core/layout/LayoutBlockFlow.h" |
| 8 #include "core/layout/LayoutMultiColumnFlowThread.h" | |
| 9 #include "core/layout/LayoutMultiColumnSet.h" | |
| 8 #include "core/layout/api/LineLayoutAPIShim.h" | 10 #include "core/layout/api/LineLayoutAPIShim.h" |
| 9 #include "core/layout/line/InlineIterator.h" | 11 #include "core/layout/line/InlineIterator.h" |
| 10 #include "core/layout/ng/layout_ng_block_flow.h" | 12 #include "core/layout/ng/layout_ng_block_flow.h" |
| 11 #include "core/layout/ng/ng_block_break_token.h" | 13 #include "core/layout/ng/ng_block_break_token.h" |
| 12 #include "core/layout/ng/ng_block_layout_algorithm.h" | 14 #include "core/layout/ng/ng_block_layout_algorithm.h" |
| 13 #include "core/layout/ng/ng_box_fragment.h" | 15 #include "core/layout/ng/ng_box_fragment.h" |
| 14 #include "core/layout/ng/ng_column_layout_algorithm.h" | 16 #include "core/layout/ng/ng_column_layout_algorithm.h" |
| 15 #include "core/layout/ng/ng_constraint_space.h" | 17 #include "core/layout/ng/ng_constraint_space.h" |
| 16 #include "core/layout/ng/ng_constraint_space_builder.h" | 18 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 17 #include "core/layout/ng/ng_fragment_builder.h" | 19 #include "core/layout/ng/ng_fragment_builder.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 | 233 |
| 232 return false; | 234 return false; |
| 233 } | 235 } |
| 234 | 236 |
| 235 void NGBlockNode::CopyFragmentDataToLayoutBox( | 237 void NGBlockNode::CopyFragmentDataToLayoutBox( |
| 236 const NGConstraintSpace& constraint_space, | 238 const NGConstraintSpace& constraint_space, |
| 237 NGLayoutResult* layout_result) { | 239 NGLayoutResult* layout_result) { |
| 238 NGPhysicalBoxFragment* fragment = | 240 NGPhysicalBoxFragment* fragment = |
| 239 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get()); | 241 toNGPhysicalBoxFragment(layout_result->PhysicalFragment().get()); |
| 240 | 242 |
| 243 if (layout_box_->style()->specifiesColumns()) { | |
| 244 LayoutBlockFlow* multicol = toLayoutBlockFlow(layout_box_); | |
|
Gleb Lanbin
2017/03/31 22:33:29
can you move this logic into a separate function d
mstensho (USE GERRIT)
2017/04/03 10:20:11
Done.
| |
| 245 if (auto* flow_thread = multicol->multiColumnFlowThread()) { | |
| 246 if (auto* column_set = flow_thread->firstMultiColumnSet()) { | |
| 247 column_set->setWidth(fragment->Width()); | |
| 248 column_set->setHeight(fragment->Height()); | |
| 249 | |
| 250 // TODO(mstensho): This value has next to nothing to do with the flow | |
| 251 // thread portion size, but at least it's usually better than zero. | |
| 252 column_set->endFlow(fragment->Height()); | |
| 253 | |
| 254 column_set->clearNeedsLayout(); | |
| 255 } | |
| 256 // TODO(mstensho): Fix the relatively nonsensical values here (the | |
| 257 // content box size of the multicol container has very little to do with | |
| 258 // the price of eggs). | |
| 259 flow_thread->setWidth(fragment->Width()); | |
| 260 flow_thread->setHeight(fragment->Height()); | |
| 261 | |
| 262 flow_thread->validateColumnSets(); | |
| 263 flow_thread->clearNeedsLayout(); | |
| 264 } | |
| 265 } | |
| 241 layout_box_->setWidth(fragment->Width()); | 266 layout_box_->setWidth(fragment->Width()); |
| 242 layout_box_->setHeight(fragment->Height()); | 267 layout_box_->setHeight(fragment->Height()); |
| 243 NGBoxStrut border_and_padding = ComputeBorders(constraint_space, Style()) + | 268 NGBoxStrut border_and_padding = ComputeBorders(constraint_space, Style()) + |
| 244 ComputePadding(constraint_space, Style()); | 269 ComputePadding(constraint_space, Style()); |
| 245 LayoutUnit intrinsic_logical_height = | 270 LayoutUnit intrinsic_logical_height = |
| 246 layout_box_->style()->isHorizontalWritingMode() | 271 layout_box_->style()->isHorizontalWritingMode() |
| 247 ? fragment->HeightOverflow() | 272 ? fragment->HeightOverflow() |
| 248 : fragment->WidthOverflow(); | 273 : fragment->WidthOverflow(); |
| 249 intrinsic_logical_height -= border_and_padding.BlockSum(); | 274 intrinsic_logical_height -= border_and_padding.BlockSum(); |
| 250 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); | 275 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 | 364 |
| 340 // Save static position for legacy AbsPos layout. | 365 // Save static position for legacy AbsPos layout. |
| 341 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 366 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
| 342 DCHECK(layout_box_->isOutOfFlowPositioned()); | 367 DCHECK(layout_box_->isOutOfFlowPositioned()); |
| 343 DCHECK(layout_box_->layer()); | 368 DCHECK(layout_box_->layer()); |
| 344 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 369 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
| 345 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 370 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
| 346 } | 371 } |
| 347 | 372 |
| 348 } // namespace blink | 373 } // namespace blink |
| OLD | NEW |