| 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_layout_coordinator.h" | 5 #include "core/layout/ng/ng_layout_coordinator.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/ng_layout_input_node.h" | 7 #include "core/layout/ng/ng_layout_input_node.h" |
| 8 #include "core/layout/ng/ng_physical_fragment_base.h" | 8 #include "core/layout/ng/ng_physical_fragment_base.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 NGLayoutCoordinator::NGLayoutCoordinator( | 12 NGLayoutCoordinator::NGLayoutCoordinator( |
| 13 NGLayoutInputNode* input_node, | 13 NGLayoutInputNode* input_node, |
| 14 const NGConstraintSpace* constraint_space) { | 14 const NGConstraintSpace* constraint_space) { |
| 15 layout_algorithms_.append( | 15 layout_algorithms_.append( |
| 16 NGLayoutInputNode::AlgorithmForInputNode(input_node, constraint_space)); | 16 NGLayoutInputNode::AlgorithmForInputNode(input_node, constraint_space)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** fragment) { | 19 bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** fragment) { |
| 20 NGLayoutAlgorithm* child_algorithm; | 20 NGLayoutAlgorithm* child_algorithm; |
| 21 | 21 |
| 22 // Tick should never be called without a layout algorithm on the stack. | 22 // Tick should never be called without a layout algorithm on the stack. |
| 23 DCHECK(layout_algorithms_.size()); | 23 DCHECK(layout_algorithms_.size()); |
| 24 | 24 |
| 25 // TODO(layout-dev): store box from last tick and pass it into Layout here. | 25 // TODO(layout-dev): store box from last tick and pass it into Layout here. |
| 26 switch ( | 26 switch ( |
| 27 layout_algorithms_.back()->Layout(nullptr, fragment, &child_algorithm)) { | 27 layout_algorithms_.back()->Layout(nullptr, fragment, &child_algorithm)) { |
| 28 case NotFinished: | 28 case kNotFinished: |
| 29 return false; | 29 return false; |
| 30 case NewFragment: | 30 case kNewFragment: |
| 31 layout_algorithms_.pop_back(); | 31 layout_algorithms_.pop_back(); |
| 32 return (layout_algorithms_.size() == 0); | 32 return (layout_algorithms_.size() == 0); |
| 33 case ChildAlgorithmRequired: | 33 case kChildAlgorithmRequired: |
| 34 layout_algorithms_.append(child_algorithm); | 34 layout_algorithms_.append(child_algorithm); |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 NOTREACHED(); | 38 NOTREACHED(); |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 DEFINE_TRACE(NGLayoutCoordinator) { | 42 DEFINE_TRACE(NGLayoutCoordinator) { |
| 43 visitor->trace(layout_algorithms_); | 43 visitor->trace(layout_algorithms_); |
| 44 } | 44 } |
| 45 } | 45 } |
| OLD | NEW |