| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 DCHECK(layout_box->parent()) << "Should be called on children only."; | 32 DCHECK(layout_box->parent()) << "Should be called on children only."; |
| 33 | 33 |
| 34 layout_box->setX(box_fragment.LeftOffset()); | 34 layout_box->setX(box_fragment.LeftOffset()); |
| 35 layout_box->setY(box_fragment.TopOffset()); | 35 layout_box->setY(box_fragment.TopOffset()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Similar to FragmentPositionUpdated but for floats. | 38 // Similar to FragmentPositionUpdated but for floats. |
| 39 // - Updates layout object's geometric information. | 39 // - Updates layout object's geometric information. |
| 40 // - Creates legacy FloatingObject and attached it to the provided parent. | 40 // - Creates legacy FloatingObject and attached it to the provided parent. |
| 41 void FloatingObjectPositionedUpdated(NGFloatingObject* floating_object, | 41 void FloatingObjectPositionedUpdated(NGFloatingObject* ng_floating_object, |
| 42 LayoutBox* parent) { | 42 LayoutBox* parent) { |
| 43 NGPhysicalBoxFragment* box_fragment = | 43 NGPhysicalBoxFragment* box_fragment = |
| 44 toNGPhysicalBoxFragment(floating_object->fragment.get()); | 44 toNGPhysicalBoxFragment(ng_floating_object->fragment.get()); |
| 45 FragmentPositionUpdated(*box_fragment); | 45 FragmentPositionUpdated(*box_fragment); |
| 46 | 46 |
| 47 LayoutBox* layout_box = toLayoutBox(box_fragment->GetLayoutObject()); | 47 LayoutBox* layout_box = toLayoutBox(box_fragment->GetLayoutObject()); |
| 48 DCHECK(layout_box->isFloating()); | 48 DCHECK(layout_box->isFloating()); |
| 49 | 49 |
| 50 if (parent && parent->isLayoutBlockFlow()) { | 50 if (parent && parent->isLayoutBlockFlow()) { |
| 51 FloatingObject* floating_object = | 51 FloatingObject* floating_object = |
| 52 toLayoutBlockFlow(parent)->insertFloatingObject(*layout_box); | 52 toLayoutBlockFlow(parent)->insertFloatingObject(*layout_box); |
| 53 // TODO(glebl): Fix floating_object's inline offset if it's attached to | 53 floating_object->setX(ng_floating_object->left_offset); |
| 54 // parent != layout_box_->parent | |
| 55 floating_object->setX(box_fragment->LeftOffset()); | |
| 56 floating_object->setY(box_fragment->TopOffset()); | 54 floating_object->setY(box_fragment->TopOffset()); |
| 57 floating_object->setIsPlaced(true); | 55 floating_object->setIsPlaced(true); |
| 58 } | 56 } |
| 59 } | 57 } |
| 60 | 58 |
| 61 } // namespace | 59 } // namespace |
| 62 | 60 |
| 63 NGBlockNode::NGBlockNode(LayoutObject* layout_object) | 61 NGBlockNode::NGBlockNode(LayoutObject* layout_object) |
| 64 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), | 62 : NGLayoutInputNode(NGLayoutInputNodeType::kLegacyBlock), |
| 65 layout_box_(toLayoutBox(layout_object)) { | 63 layout_box_(toLayoutBox(layout_object)) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // Save static position for legacy AbsPos layout. | 325 // Save static position for legacy AbsPos layout. |
| 328 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 326 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
| 329 DCHECK(layout_box_); | 327 DCHECK(layout_box_); |
| 330 DCHECK(layout_box_->isOutOfFlowPositioned()); | 328 DCHECK(layout_box_->isOutOfFlowPositioned()); |
| 331 DCHECK(layout_box_->layer()); | 329 DCHECK(layout_box_->layer()); |
| 332 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
| 333 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
| 334 } | 332 } |
| 335 | 333 |
| 336 } // namespace blink | 334 } // namespace blink |
| OLD | NEW |