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_box.h" | 5 #include "core/layout/ng/ng_box.h" |
6 | 6 |
7 #include "core/layout/LayoutBlockFlow.h" | 7 #include "core/layout/LayoutBlockFlow.h" |
8 #include "core/layout/ng/layout_ng_block_flow.h" | 8 #include "core/layout/ng/layout_ng_block_flow.h" |
9 #include "core/layout/ng/ng_block_layout_algorithm.h" | 9 #include "core/layout/ng/ng_block_layout_algorithm.h" |
10 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 floating_object->setIsPlaced(true); | 111 floating_object->setIsPlaced(true); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 bool NGBox::CanUseNewLayout() { | 115 bool NGBox::CanUseNewLayout() { |
116 if (!layout_box_) | 116 if (!layout_box_) |
117 return true; | 117 return true; |
118 if (!layout_box_->isLayoutBlockFlow()) | 118 if (!layout_box_->isLayoutBlockFlow()) |
119 return false; | 119 return false; |
120 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 120 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
121 return !block_flow->childrenInline() || !block_flow->firstChild(); | 121 LayoutObject* child = block_flow->firstChild(); |
| 122 while (child) { |
| 123 if (child->isInline()) |
| 124 return false; |
| 125 child = child->nextSibling(); |
| 126 } |
| 127 return true; |
122 } | 128 } |
123 | 129 |
124 void NGBox::CopyFragmentDataToLayoutBox( | 130 void NGBox::CopyFragmentDataToLayoutBox( |
125 const NGConstraintSpace& constraint_space) { | 131 const NGConstraintSpace& constraint_space) { |
126 DCHECK(layout_box_); | 132 DCHECK(layout_box_); |
127 layout_box_->setWidth(fragment_->Width()); | 133 layout_box_->setWidth(fragment_->Width()); |
128 layout_box_->setHeight(fragment_->Height()); | 134 layout_box_->setHeight(fragment_->Height()); |
129 NGBoxStrut border_and_padding = | 135 NGBoxStrut border_and_padding = |
130 ComputeBorders(*Style()) + ComputePadding(constraint_space, *Style()); | 136 ComputeBorders(*Style()) + ComputePadding(constraint_space, *Style()); |
131 LayoutUnit intrinsic_logical_height = | 137 LayoutUnit intrinsic_logical_height = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 .SetBlockSize(layout_box_->logicalHeight()) | 177 .SetBlockSize(layout_box_->logicalHeight()) |
172 .SetDirection(FromPlatformDirection(layout_box_->styleRef().direction())) | 178 .SetDirection(FromPlatformDirection(layout_box_->styleRef().direction())) |
173 .SetWritingMode( | 179 .SetWritingMode( |
174 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) | 180 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) |
175 .SetInlineOverflow(overflow.width()) | 181 .SetInlineOverflow(overflow.width()) |
176 .SetBlockOverflow(overflow.height()); | 182 .SetBlockOverflow(overflow.height()); |
177 return builder.ToFragment(); | 183 return builder.ToFragment(); |
178 } | 184 } |
179 | 185 |
180 } // namespace blink | 186 } // namespace blink |
OLD | NEW |