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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc

Issue 2739683006: Use Opportunity Iterator to position text fragments in NGLineBuilder (Closed)
Patch Set: add font-family 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..32399911203e150f7ff7b2d02834289aa092d5c7
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc
@@ -0,0 +1,40 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/layout/ng/ng_base_layout_algorithm_test.h"
+
+#include "core/layout/ng/layout_ng_block_flow.h"
+#include "core/layout/ng/ng_block_layout_algorithm.h"
+#include "core/layout/ng/ng_physical_fragment.h"
+namespace blink {
+
+NGBaseLayoutAlgorithmTest::NGBaseLayoutAlgorithmTest() {
+ RuntimeEnabledFeatures::setLayoutNGEnabled(true);
+ RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true);
+}
+
+NGBaseLayoutAlgorithmTest::~NGBaseLayoutAlgorithmTest() {
+ RuntimeEnabledFeatures::setLayoutNGEnabled(false);
+ RuntimeEnabledFeatures::setLayoutNGInlineEnabled(false);
+}
+
+void NGBaseLayoutAlgorithmTest::SetUp() {
+ RenderingTest::SetUp();
+ enableCompositing();
+}
+
+std::pair<RefPtr<NGPhysicalBoxFragment>, RefPtr<NGConstraintSpace>>
+NGBaseLayoutAlgorithmTest::RunBlockLayoutAlgorithmForElement(Element* element) {
+ LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(element->layoutObject());
+ NGBlockNode* node = new NGBlockNode(block_flow);
+ RefPtr<NGConstraintSpace> space =
+ NGConstraintSpace::CreateFromLayoutObject(*block_flow);
+
+ RefPtr<NGLayoutResult> result =
+ NGBlockLayoutAlgorithm(node, space.get()).Layout();
+ return std::make_pair(
+ toNGPhysicalBoxFragment(result->PhysicalFragment().get()), space);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698