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_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_break_token.h" | 7 #include "core/layout/ng/ng_break_token.h" |
8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
10 #include "core/layout/ng/ng_fragment_base.h" | 10 #include "core/layout/ng/ng_fragment_base.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 builder_->SetInlineSize(inline_size).SetBlockSize(block_size); | 237 builder_->SetInlineSize(inline_size).SetBlockSize(block_size); |
238 current_child_ = first_child_; | 238 current_child_ = first_child_; |
239 if (current_child_) | 239 if (current_child_) |
240 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); | 240 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); |
241 | 241 |
242 state_ = kStateChildLayout; | 242 state_ = kStateChildLayout; |
243 return kNotFinished; | 243 return kNotFinished; |
244 } | 244 } |
245 case kStateChildLayout: { | 245 case kStateChildLayout: { |
246 if (current_child_) { | 246 if (current_child_) { |
| 247 // TODO(atotic): uncomment this code when implementing oof layout. |
| 248 // This code cannot be turned on because it prevents layout of |
| 249 // oof children, and non-layedout objects trigger a DCHECK. |
| 250 // EPosition position = current_child_->Style()->position(); |
| 251 // if ((position == AbsolutePosition || position == FixedPosition)) { |
| 252 // builder_->AddOutOfFlowCandidateChild(current_child_, |
| 253 // GetChildSpaceOffset()); |
| 254 // } |
| 255 // else |
247 if (!LayoutCurrentChild()) | 256 if (!LayoutCurrentChild()) |
248 return kNotFinished; | 257 return kNotFinished; |
249 current_child_ = current_child_->NextSibling(); | 258 current_child_ = current_child_->NextSibling(); |
250 if (current_child_) { | 259 if (current_child_) { |
251 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); | 260 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); |
252 return kNotFinished; | 261 return kNotFinished; |
253 } | 262 } |
254 } | 263 } |
255 state_ = kStateFinalize; | 264 state_ = kStateFinalize; |
256 return kNotFinished; | 265 return kNotFinished; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 433 |
425 NGConstraintSpace* | 434 NGConstraintSpace* |
426 NGBlockLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() const { | 435 NGBlockLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() const { |
427 DCHECK(current_child_); | 436 DCHECK(current_child_); |
428 space_builder_->SetIsNewFormattingContext( | 437 space_builder_->SetIsNewFormattingContext( |
429 IsNewFormattingContextForInFlowBlockLevelChild(ConstraintSpace(), | 438 IsNewFormattingContextForInFlowBlockLevelChild(ConstraintSpace(), |
430 CurrentChildStyle())); | 439 CurrentChildStyle())); |
431 NGConstraintSpace* child_space = space_builder_->ToConstraintSpace(); | 440 NGConstraintSpace* child_space = space_builder_->ToConstraintSpace(); |
432 | 441 |
433 // TODO(layout-ng): Set offset through the space builder. | 442 // TODO(layout-ng): Set offset through the space builder. |
434 child_space->SetOffset( | 443 child_space->SetOffset(GetChildSpaceOffset()); |
435 NGLogicalOffset(border_and_padding_.inline_start, content_size_)); | |
436 return child_space; | 444 return child_space; |
437 } | 445 } |
438 | 446 |
439 DEFINE_TRACE(NGBlockLayoutAlgorithm) { | 447 DEFINE_TRACE(NGBlockLayoutAlgorithm) { |
440 NGLayoutAlgorithm::trace(visitor); | 448 NGLayoutAlgorithm::trace(visitor); |
441 visitor->trace(first_child_); | 449 visitor->trace(first_child_); |
442 visitor->trace(constraint_space_); | 450 visitor->trace(constraint_space_); |
443 visitor->trace(break_token_); | 451 visitor->trace(break_token_); |
444 visitor->trace(builder_); | 452 visitor->trace(builder_); |
445 visitor->trace(space_builder_); | 453 visitor->trace(space_builder_); |
446 visitor->trace(space_for_current_child_); | 454 visitor->trace(space_for_current_child_); |
447 visitor->trace(current_child_); | 455 visitor->trace(current_child_); |
448 } | 456 } |
449 | 457 |
450 } // namespace blink | 458 } // namespace blink |
OLD | NEW |