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

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

Issue 2525033002: Deprecate NGPhysicalConstraintSpace (Closed)
Patch Set: update TestExpectations Created 4 years 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_absolute_utils.h" 5 #include "core/layout/ng/ng_absolute_utils.h"
6 6
7 #include "core/layout/ng/ng_constraint_space_builder.h" 7 #include "core/layout/ng/ng_constraint_space_builder.h"
8 #include "core/layout/ng/ng_length_utils.h" 8 #include "core/layout/ng/ng_length_utils.h"
9 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace blink { 12 namespace blink {
13 namespace { 13 namespace {
14 14
15 #define NGAuto LayoutUnit(-1) 15 #define NGAuto LayoutUnit(-1)
16 16
17 class NGAbsoluteUtilsTest : public ::testing::Test { 17 class NGAbsoluteUtilsTest : public ::testing::Test {
18 protected: 18 protected:
19 void SetUp() override { 19 void SetUp() override {
20 style_ = ComputedStyle::create(); 20 style_ = ComputedStyle::create();
21 // If not set, border widths will always be 0. 21 // If not set, border widths will always be 0.
22 style_->setBorderLeftStyle(EBorderStyle::BorderStyleSolid); 22 style_->setBorderLeftStyle(EBorderStyle::BorderStyleSolid);
23 style_->setBorderRightStyle(EBorderStyle::BorderStyleSolid); 23 style_->setBorderRightStyle(EBorderStyle::BorderStyleSolid);
24 style_->setBorderTopStyle(EBorderStyle::BorderStyleSolid); 24 style_->setBorderTopStyle(EBorderStyle::BorderStyleSolid);
25 style_->setBorderBottomStyle(EBorderStyle::BorderStyleSolid); 25 style_->setBorderBottomStyle(EBorderStyle::BorderStyleSolid);
26 style_->setBoxSizing(EBoxSizing::BoxSizingBorderBox); 26 style_->setBoxSizing(EBoxSizing::BoxSizingBorderBox);
27 container_size_ = NGLogicalSize(LayoutUnit(200), LayoutUnit(300)); 27 container_size_ = NGLogicalSize(LayoutUnit(200), LayoutUnit(300));
28 NGConstraintSpaceBuilder builder(kHorizontalTopBottom); 28 NGConstraintSpaceBuilder builder(kHorizontalTopBottom);
29 ltr_space_ = new NGConstraintSpace( 29 builder.SetAvailableSize(container_size_);
30 kHorizontalTopBottom, LTR, 30 ltr_space_ = builder.SetWritingMode(kHorizontalTopBottom)
31 builder.SetAvailableSize(container_size_).ToConstraintSpace()); 31 .SetTextDirection(LTR)
32 rtl_space_ = new NGConstraintSpace( 32 .ToConstraintSpace();
33 kHorizontalTopBottom, RTL, 33 rtl_space_ = builder.SetWritingMode(kHorizontalTopBottom)
34 builder.SetAvailableSize(container_size_).ToConstraintSpace()); 34 .SetTextDirection(RTL)
35 vertical_lr_space_ = new NGConstraintSpace( 35 .ToConstraintSpace();
36 kVerticalLeftRight, LTR, 36 vertical_lr_space_ = builder.SetWritingMode(kVerticalLeftRight)
37 builder.SetAvailableSize(container_size_).ToConstraintSpace()); 37 .SetTextDirection(LTR)
38 vertical_rl_space_ = new NGConstraintSpace( 38 .ToConstraintSpace();
39 kVerticalLeftRight, LTR, 39 vertical_rl_space_ = builder.SetWritingMode(kVerticalLeftRight)
40 builder.SetAvailableSize(container_size_).ToConstraintSpace()); 40 .SetTextDirection(LTR)
41 .ToConstraintSpace();
41 } 42 }
42 43
43 void SetHorizontalStyle(LayoutUnit left, 44 void SetHorizontalStyle(LayoutUnit left,
44 LayoutUnit margin_left, 45 LayoutUnit margin_left,
45 LayoutUnit width, 46 LayoutUnit width,
46 LayoutUnit margin_right, 47 LayoutUnit margin_right,
47 LayoutUnit right) { 48 LayoutUnit right) {
48 style_->setLeft(left == NGAuto ? Length(LengthType::Auto) 49 style_->setLeft(left == NGAuto ? Length(LengthType::Auto)
49 : Length(left.toInt(), LengthType::Fixed)); 50 : Length(left.toInt(), LengthType::Fixed));
50 style_->setMarginLeft(margin_left == NGAuto 51 style_->setMarginLeft(margin_left == NGAuto
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // Rule 6: height is unknown. 384 // Rule 6: height is unknown.
384 SetVerticalStyle(top, margin_top, NGAuto, margin_bottom, bottom); 385 SetVerticalStyle(top, margin_top, NGAuto, margin_bottom, bottom);
385 EXPECT_EQ(AbsoluteNeedsChildBlockSize(*style_), false); 386 EXPECT_EQ(AbsoluteNeedsChildBlockSize(*style_), false);
386 auto_height.reset(); 387 auto_height.reset();
387 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, auto_height, &p); 388 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, auto_height, &p);
388 EXPECT_EQ(height, p.size.height); 389 EXPECT_EQ(height, p.size.height);
389 } 390 }
390 391
391 } // namespace 392 } // namespace
392 } // namespace blink 393 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698