OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/ng/ng_base_layout_algorithm_test.h" |
| 6 |
| 7 #include "core/layout/ng/layout_ng_block_flow.h" |
| 8 #include "core/layout/ng/ng_block_layout_algorithm.h" |
| 9 #include "core/layout/ng/ng_physical_fragment.h" |
| 10 namespace blink { |
| 11 |
| 12 NGBaseLayoutAlgorithmTest::NGBaseLayoutAlgorithmTest() { |
| 13 RuntimeEnabledFeatures::setLayoutNGEnabled(true); |
| 14 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true); |
| 15 } |
| 16 |
| 17 NGBaseLayoutAlgorithmTest::~NGBaseLayoutAlgorithmTest() { |
| 18 RuntimeEnabledFeatures::setLayoutNGEnabled(false); |
| 19 RuntimeEnabledFeatures::setLayoutNGInlineEnabled(false); |
| 20 } |
| 21 |
| 22 void NGBaseLayoutAlgorithmTest::SetUp() { |
| 23 RenderingTest::SetUp(); |
| 24 enableCompositing(); |
| 25 } |
| 26 |
| 27 std::pair<RefPtr<NGPhysicalBoxFragment>, RefPtr<NGConstraintSpace>> |
| 28 NGBaseLayoutAlgorithmTest::RunBlockLayoutAlgorithmForElement(Element* element) { |
| 29 LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(element->layoutObject()); |
| 30 NGBlockNode* node = new NGBlockNode(block_flow); |
| 31 RefPtr<NGConstraintSpace> space = |
| 32 NGConstraintSpace::CreateFromLayoutObject(*block_flow); |
| 33 |
| 34 RefPtr<NGLayoutResult> result = |
| 35 NGBlockLayoutAlgorithm(node, space.get()).Layout(); |
| 36 return std::make_pair( |
| 37 toNGPhysicalBoxFragment(result->PhysicalFragment().get()), space); |
| 38 } |
| 39 |
| 40 } // namespace blink |
OLD | NEW |