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

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

Issue 2921463004: [LayoutNG] PODify NGLayoutInputNode and sub-classes. (Closed)
Patch Set: new ng-bot expectations Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 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 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_space_utils.h" 5 #include "core/layout/ng/ng_space_utils.h"
6 6
7 #include "core/layout/ng/ng_base_layout_algorithm_test.h" 7 #include "core/layout/ng/ng_base_layout_algorithm_test.h"
8 #include "core/layout/ng/ng_block_node.h" 8 #include "core/layout/ng/ng_block_node.h"
9 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 10
11 namespace blink { 11 namespace blink {
12 namespace { 12 namespace {
13 13
14 class NGSpaceUtilsTest : public NGBaseLayoutAlgorithmTest {}; 14 class NGSpaceUtilsTest : public NGBaseLayoutAlgorithmTest {};
15 15
16 // Verifies that IsNewFormattingContextForInFlowBlockLevelChild returnes true 16 // Verifies that IsNewFormattingContextForInFlowBlockLevelChild returnes true
17 // if the child is out-of-flow, e.g. floating or abs-pos. 17 // if the child is out-of-flow, e.g. floating or abs-pos.
18 TEST_F(NGSpaceUtilsTest, NewFormattingContextForOutOfFlowChild) { 18 TEST_F(NGSpaceUtilsTest, NewFormattingContextForOutOfFlowChild) {
19 SetBodyInnerHTML(R"HTML( 19 SetBodyInnerHTML(R"HTML(
20 <!DOCTYPE html> 20 <!DOCTYPE html>
21 <div id="parent"> 21 <div id="parent">
22 <div id="child"></div> 22 <div id="child"></div>
23 </div> 23 </div>
24 )HTML"); 24 )HTML");
25 25
26 auto& parent_style = GetLayoutObjectByElementId("parent")->StyleRef(); 26 auto& parent_style = GetLayoutObjectByElementId("parent")->StyleRef();
27 auto* child = GetLayoutObjectByElementId("child"); 27 auto* child = GetLayoutObjectByElementId("child");
28 auto* node = new NGBlockNode(child); 28 NGBlockNode node(ToLayoutBox(child));
29 29
30 auto run_test = [&](RefPtr<ComputedStyle> style) { 30 auto run_test = [&](RefPtr<ComputedStyle> style) {
31 child->SetStyle(style); 31 child->SetStyle(style);
32 EXPECT_TRUE(IsNewFormattingContextForBlockLevelChild(parent_style, *node)); 32 EXPECT_TRUE(IsNewFormattingContextForBlockLevelChild(parent_style, node));
33 }; 33 };
34 34
35 RefPtr<ComputedStyle> style = ComputedStyle::Create(); 35 RefPtr<ComputedStyle> style = ComputedStyle::Create();
36 style->SetFloating(EFloat::kLeft); 36 style->SetFloating(EFloat::kLeft);
37 run_test(style); 37 run_test(style);
38 38
39 style = ComputedStyle::Create(); 39 style = ComputedStyle::Create();
40 style->SetPosition(EPosition::kAbsolute); 40 style->SetPosition(EPosition::kAbsolute);
41 run_test(style); 41 run_test(style);
42 42
43 style = ComputedStyle::Create(); 43 style = ComputedStyle::Create();
44 style->SetPosition(EPosition::kFixed); 44 style->SetPosition(EPosition::kFixed);
45 run_test(style); 45 run_test(style);
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 } // namespace blink 49 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698