Chromium Code Reviews| 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_space_utils.h" | |
| 6 | |
| 7 #include "core/layout/ng/ng_constraint_space.h" | |
| 8 #include "core/layout/ng/ng_constraint_space_builder.h" | |
| 9 #include "core/style/ComputedStyle.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 namespace { | |
| 14 | |
| 15 class NGSpaceUtilsTest : public ::testing::Test { | |
| 16 protected: | |
| 17 NGSpaceUtilsTest() : space_builder_(NGWritingMode::kHorizontalTopBottom) {} | |
| 18 | |
| 19 void SetUp() override { style_ = ComputedStyle::create(); } | |
| 20 RefPtr<ComputedStyle> style_; | |
| 21 NGConstraintSpaceBuilder space_builder_; | |
| 22 }; | |
| 23 | |
| 24 // Verifies that IsNewFormattingContextForInFlowBlockLevelChild returnes true | |
| 25 // if the child is out-of-flow, e.g. floating or abs-pos. | |
| 26 TEST_F(NGSpaceUtilsTest, NewFormattingContextForOutOfFlowChild) { | |
|
ikilpatrick
2017/03/23 16:39:59
thanks for this :)
Gleb Lanbin
2017/03/24 20:10:05
Acknowledged.
| |
| 27 auto run_test = [&](const ComputedStyle& style) { | |
| 28 RefPtr<NGConstraintSpace> not_used_space = | |
| 29 space_builder_.ToConstraintSpace(NGWritingMode::kHorizontalTopBottom); | |
| 30 EXPECT_TRUE(IsNewFormattingContextForInFlowBlockLevelChild( | |
| 31 *not_used_space.get(), style)); | |
| 32 }; | |
| 33 RefPtr<ComputedStyle> style = ComputedStyle::create(); | |
| 34 style->setFloating(EFloat::kLeft); | |
| 35 run_test(*style.get()); | |
| 36 | |
| 37 style = ComputedStyle::create(); | |
| 38 style->setPosition(EPosition::kAbsolute); | |
| 39 run_test(*style.get()); | |
| 40 | |
| 41 style = ComputedStyle::create(); | |
| 42 style->setPosition(EPosition::kFixed); | |
| 43 run_test(*style.get()); | |
| 44 } | |
| 45 | |
| 46 } // namespace | |
| 47 } // namespace blink | |
| OLD | NEW |