Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc

Issue 2752123002: [LayoutNG] Move NGFloatingObject off Oilpan (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 fragment.Width()); 43 fragment.Width());
44 } else { 44 } else {
45 layout_box->setX(fragment.LeftOffset()); 45 layout_box->setX(fragment.LeftOffset());
46 } 46 }
47 layout_box->setY(fragment.TopOffset()); 47 layout_box->setY(fragment.TopOffset());
48 } 48 }
49 49
50 // Similar to FragmentPositionUpdated but for floats. 50 // Similar to FragmentPositionUpdated but for floats.
51 // - Updates layout object's geometric information. 51 // - Updates layout object's geometric information.
52 // - Creates legacy FloatingObject and attached it to the provided parent. 52 // - Creates legacy FloatingObject and attached it to the provided parent.
53 void FloatingObjectPositionedUpdated(NGFloatingObject* ng_floating_object, 53 void FloatingObjectPositionedUpdated(
54 LayoutBox* parent) { 54 RefPtr<NGFloatingObject> ng_floating_object,
ikilpatrick 2017/03/15 22:45:40 same as comment in block_algorithm, just raw ptr w
Gleb Lanbin 2017/03/15 23:24:25 Done.
55 LayoutBox* parent) {
55 NGPhysicalBoxFragment* box_fragment = 56 NGPhysicalBoxFragment* box_fragment =
56 toNGPhysicalBoxFragment(ng_floating_object->fragment.get()); 57 toNGPhysicalBoxFragment(ng_floating_object->fragment.get());
57 FragmentPositionUpdated(*box_fragment); 58 FragmentPositionUpdated(*box_fragment);
58 59
59 LayoutBox* layout_box = toLayoutBox(box_fragment->GetLayoutObject()); 60 LayoutBox* layout_box = toLayoutBox(box_fragment->GetLayoutObject());
60 DCHECK(layout_box->isFloating()); 61 DCHECK(layout_box->isFloating());
61 62
62 if (parent && parent->isLayoutBlockFlow()) { 63 if (parent && parent->isLayoutBlockFlow()) {
63 FloatingObject* floating_object = 64 FloatingObject* floating_object =
64 toLayoutBlockFlow(parent)->insertFloatingObject(*layout_box); 65 toLayoutBlockFlow(parent)->insertFloatingObject(*layout_box);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 ComputePadding(constraint_space, Style()); 233 ComputePadding(constraint_space, Style());
233 LayoutUnit intrinsic_logical_height = 234 LayoutUnit intrinsic_logical_height =
234 layout_box_->style()->isHorizontalWritingMode() 235 layout_box_->style()->isHorizontalWritingMode()
235 ? fragment->HeightOverflow() 236 ? fragment->HeightOverflow()
236 : fragment->WidthOverflow(); 237 : fragment->WidthOverflow();
237 intrinsic_logical_height -= border_and_padding.BlockSum(); 238 intrinsic_logical_height -= border_and_padding.BlockSum();
238 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); 239 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height);
239 240
240 // We may still have unpositioned floats when we reach the root box. 241 // We may still have unpositioned floats when we reach the root box.
241 if (!layout_box_->parent()) { 242 if (!layout_box_->parent()) {
242 for (const auto& floating_object : fragment->PositionedFloats()) { 243 for (const auto& floating_object : fragment->PositionedFloats()) {
ikilpatrick 2017/03/15 22:45:40 /sigh, i wish we had clearer guidelines around con
Gleb Lanbin 2017/03/15 23:24:25 Done.
243 FloatingObjectPositionedUpdated(floating_object, layout_box_); 244 FloatingObjectPositionedUpdated(floating_object, layout_box_);
244 } 245 }
245 } 246 }
246 247
247 for (const auto& child_fragment : fragment->Children()) { 248 for (const auto& child_fragment : fragment->Children()) {
248 if (child_fragment->IsPlaced()) 249 if (child_fragment->IsPlaced())
249 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment)); 250 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment));
250 251
251 for (const auto& floating_object : 252 for (const auto& floating_object :
252 toNGPhysicalBoxFragment(child_fragment.get())->PositionedFloats()) { 253 toNGPhysicalBoxFragment(child_fragment.get())->PositionedFloats()) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 326
326 // Save static position for legacy AbsPos layout. 327 // Save static position for legacy AbsPos layout.
327 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { 328 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) {
328 DCHECK(layout_box_->isOutOfFlowPositioned()); 329 DCHECK(layout_box_->isOutOfFlowPositioned());
329 DCHECK(layout_box_->layer()); 330 DCHECK(layout_box_->layer());
330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); 331 layout_box_->layer()->setStaticBlockPosition(offset.block_offset);
331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); 332 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset);
332 } 333 }
333 334
334 } // namespace blink 335 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698