| 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" |
| 11 #include "core/layout/ng/ng_block_layout_algorithm.h" | 11 #include "core/layout/ng/ng_block_layout_algorithm.h" |
| 12 #include "core/layout/ng/ng_constraint_space_builder.h" | 12 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 13 #include "core/layout/ng/ng_constraint_space.h" | 13 #include "core/layout/ng/ng_constraint_space.h" |
| 14 #include "core/layout/ng/ng_inline_layout_algorithm.h" | |
| 15 #include "core/layout/ng/ng_fragment.h" | 14 #include "core/layout/ng/ng_fragment.h" |
| 16 #include "core/layout/ng/ng_fragment_builder.h" | 15 #include "core/layout/ng/ng_fragment_builder.h" |
| 16 #include "core/layout/ng/ng_inline_node.h" |
| 17 #include "core/layout/ng/ng_layout_coordinator.h" | 17 #include "core/layout/ng/ng_layout_coordinator.h" |
| 18 #include "core/layout/ng/ng_length_utils.h" | 18 #include "core/layout/ng/ng_length_utils.h" |
| 19 #include "core/layout/ng/ng_writing_mode.h" | 19 #include "core/layout/ng/ng_writing_mode.h" |
| 20 #include "platform/RuntimeEnabledFeatures.h" | 20 #include "platform/RuntimeEnabledFeatures.h" |
| 21 #include "platform/text/TextDirection.h" | |
| 22 | 21 |
| 23 namespace blink { | 22 namespace blink { |
| 24 | 23 |
| 25 NGBlockNode::NGBlockNode(LayoutObject* layout_object) | 24 NGBlockNode::NGBlockNode(LayoutObject* layout_object) |
| 26 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), | 25 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), |
| 27 layout_box_(toLayoutBox(layout_object)) { | 26 layout_box_(toLayoutBox(layout_object)) { |
| 28 DCHECK(layout_box_); | 27 DCHECK(layout_box_); |
| 29 } | 28 } |
| 30 | 29 |
| 31 NGBlockNode::NGBlockNode(ComputedStyle* style) | 30 NGBlockNode::NGBlockNode(ComputedStyle* style) |
| 32 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), | 31 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), |
| 33 layout_box_(nullptr), | 32 layout_box_(nullptr), |
| 34 style_(style) { | 33 style_(style) { |
| 35 DCHECK(style_); | 34 DCHECK(style_); |
| 36 } | 35 } |
| 37 | 36 |
| 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 |
| 39 // included from a compilation unit that lacks the ComputedStyle definition. |
| 40 NGBlockNode::~NGBlockNode() {} |
| 41 |
| 38 bool NGBlockNode::Layout(const NGConstraintSpace* constraint_space, | 42 bool NGBlockNode::Layout(const NGConstraintSpace* constraint_space, |
| 39 NGFragmentBase** out) { | 43 NGFragmentBase** out) { |
| 40 DCHECK(!minmax_algorithm_) | 44 DCHECK(!minmax_algorithm_) |
| 41 << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; | 45 << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; |
| 42 if (layout_box_ && layout_box_->isOutOfFlowPositioned()) | 46 if (layout_box_ && layout_box_->isOutOfFlowPositioned()) |
| 43 layout_box_->containingBlock()->insertPositionedObject(layout_box_); | 47 layout_box_->containingBlock()->insertPositionedObject(layout_box_); |
| 44 // We can either use the new layout code to do the layout and then copy the | 48 // We can either use the new layout code to do the layout and then copy the |
| 45 // resulting size to the LayoutObject, or use the old layout code and | 49 // resulting size to the LayoutObject, or use the old layout code and |
| 46 // synthesize a fragment. | 50 // synthesize a fragment. |
| 47 if (CanUseNewLayout()) { | 51 if (CanUseNewLayout()) { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 .SetBlockSize(layout_box_->logicalHeight()) | 316 .SetBlockSize(layout_box_->logicalHeight()) |
| 313 .SetDirection(layout_box_->styleRef().direction()) | 317 .SetDirection(layout_box_->styleRef().direction()) |
| 314 .SetWritingMode( | 318 .SetWritingMode( |
| 315 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) | 319 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) |
| 316 .SetInlineOverflow(overflow.width()) | 320 .SetInlineOverflow(overflow.width()) |
| 317 .SetBlockOverflow(overflow.height()); | 321 .SetBlockOverflow(overflow.height()); |
| 318 return builder.ToFragment(); | 322 return builder.ToFragment(); |
| 319 } | 323 } |
| 320 | 324 |
| 321 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |