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

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

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: Created 3 years, 10 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_layout_algorithm.h" 5 #include "core/layout/ng/ng_block_layout_algorithm.h"
6 6
7 #include "core/dom/NodeComputedStyle.h" 7 #include "core/dom/NodeComputedStyle.h"
8 #include "core/dom/TagCollection.h" 8 #include "core/dom/TagCollection.h"
9 #include "core/layout/ng/layout_ng_block_flow.h" 9 #include "core/layout/ng/layout_ng_block_flow.h"
10 #include "core/layout/ng/ng_block_node.h" 10 #include "core/layout/ng/ng_block_node.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 RenderingTest::SetUp(); 56 RenderingTest::SetUp();
57 enableCompositing(); 57 enableCompositing();
58 } 58 }
59 59
60 RefPtr<NGPhysicalBoxFragment> RunBlockLayoutAlgorithm( 60 RefPtr<NGPhysicalBoxFragment> RunBlockLayoutAlgorithm(
61 NGConstraintSpace* space, 61 NGConstraintSpace* space,
62 NGBlockNode* first_child) { 62 NGBlockNode* first_child) {
63 NGBlockNode parent(style_.get()); 63 NGBlockNode parent(style_.get());
64 parent.SetFirstChild(first_child); 64 parent.SetFirstChild(first_child);
65 65
66 RefPtr<NGPhysicalFragment> fragment = 66 RefPtr<NGLayoutResult> result =
67 NGBlockLayoutAlgorithm(/* layout_object */ nullptr, style_.get(), 67 NGBlockLayoutAlgorithm(/* layout_object */ nullptr, style_.get(),
68 first_child, space) 68 first_child, space)
69 .Layout(); 69 .Layout();
70 70
71 return toNGPhysicalBoxFragment(fragment.get()); 71 return toNGPhysicalBoxFragment(result->PhysicalFragment().get());
72 } 72 }
73 73
74 std::pair<RefPtr<NGPhysicalBoxFragment>, NGConstraintSpace*> 74 std::pair<RefPtr<NGPhysicalBoxFragment>, NGConstraintSpace*>
75 RunBlockLayoutAlgorithmForElement(Element* element) { 75 RunBlockLayoutAlgorithmForElement(Element* element) {
76 LayoutNGBlockFlow* block_flow = 76 LayoutNGBlockFlow* block_flow =
77 toLayoutNGBlockFlow(element->layoutObject()); 77 toLayoutNGBlockFlow(element->layoutObject());
78 NGConstraintSpace* space = 78 NGConstraintSpace* space =
79 NGConstraintSpace::CreateFromLayoutObject(*block_flow); 79 NGConstraintSpace::CreateFromLayoutObject(*block_flow);
80 RefPtr<NGPhysicalBoxFragment> fragment = RunBlockLayoutAlgorithm( 80 RefPtr<NGPhysicalBoxFragment> fragment = RunBlockLayoutAlgorithm(
81 space, new NGBlockNode(element->layoutObject()->slowFirstChild())); 81 space, new NGBlockNode(element->layoutObject()->slowFirstChild()));
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); 2000 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset());
2001 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); 2001 EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
2002 EXPECT_EQ(LayoutUnit(16), fragment->Width()); 2002 EXPECT_EQ(LayoutUnit(16), fragment->Width());
2003 EXPECT_EQ(LayoutUnit(50), fragment->Height()); 2003 EXPECT_EQ(LayoutUnit(50), fragment->Height());
2004 EXPECT_EQ(0UL, fragment->Children().size()); 2004 EXPECT_EQ(0UL, fragment->Children().size());
2005 EXPECT_FALSE(iterator.NextChild()); 2005 EXPECT_FALSE(iterator.NextChild());
2006 } 2006 }
2007 2007
2008 } // namespace 2008 } // namespace
2009 } // namespace blink 2009 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698