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/api/LineLayoutAPIShim.h" | 8 #include "core/layout/api/LineLayoutAPIShim.h" |
9 #include "core/layout/line/InlineIterator.h" | 9 #include "core/layout/line/InlineIterator.h" |
10 #include "core/layout/ng/layout_ng_block_flow.h" | 10 #include "core/layout/ng/layout_ng_block_flow.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Need an explicit destructor in the .cc file, or the MSWIN compiler will | 37 // Need an explicit destructor in the .cc file, or the MSWIN compiler will |
38 // produce an error when attempting to generate a default one, if the .h file is | 38 // produce an error when attempting to generate a default one, if the .h file is |
39 // included from a compilation unit that lacks the ComputedStyle definition. | 39 // included from a compilation unit that lacks the ComputedStyle definition. |
40 NGBlockNode::~NGBlockNode() {} | 40 NGBlockNode::~NGBlockNode() {} |
41 | 41 |
42 bool NGBlockNode::Layout(NGConstraintSpace* constraint_space, | 42 bool NGBlockNode::Layout(NGConstraintSpace* constraint_space, |
43 NGFragmentBase** out) { | 43 NGFragmentBase** out) { |
44 DCHECK(!minmax_algorithm_) | 44 DCHECK(!minmax_algorithm_) |
45 << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; | 45 << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; |
46 if (layout_box_ && layout_box_->isOutOfFlowPositioned()) | |
47 layout_box_->containingBlock()->insertPositionedObject(layout_box_); | |
48 // We can either use the new layout code to do the layout and then copy the | 46 // We can either use the new layout code to do the layout and then copy the |
49 // resulting size to the LayoutObject, or use the old layout code and | 47 // resulting size to the LayoutObject, or use the old layout code and |
50 // synthesize a fragment. | 48 // synthesize a fragment. |
51 if (CanUseNewLayout()) { | 49 if (CanUseNewLayout()) { |
52 NGPhysicalFragmentBase* fragment; | 50 NGPhysicalFragmentBase* fragment; |
53 | 51 |
54 // Store a coordinator so Layout can preserve its existing semantic | 52 // Store a coordinator so Layout can preserve its existing semantic |
55 // of returning false until completed. | 53 // of returning false until completed. |
56 if (!layout_coordinator_) | 54 if (!layout_coordinator_) |
57 layout_coordinator_ = new NGLayoutCoordinator(this, constraint_space); | 55 layout_coordinator_ = new NGLayoutCoordinator(this, constraint_space); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return builder.ToFragment(); | 323 return builder.ToFragment(); |
326 } | 324 } |
327 | 325 |
328 void NGBlockNode::UseOldOutOfFlowPositioning() { | 326 void NGBlockNode::UseOldOutOfFlowPositioning() { |
329 DCHECK(layout_box_); | 327 DCHECK(layout_box_); |
330 DCHECK(layout_box_->isOutOfFlowPositioned()); | 328 DCHECK(layout_box_->isOutOfFlowPositioned()); |
331 layout_box_->containingBlock()->insertPositionedObject(layout_box_); | 329 layout_box_->containingBlock()->insertPositionedObject(layout_box_); |
332 } | 330 } |
333 | 331 |
334 } // namespace blink | 332 } // namespace blink |
OLD | NEW |