| Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| index 11912e2a52e184ed73a6eec9d479c343590f92cb..f73b2eee46d3fd99938b989e616dfaf316a78f71 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| @@ -45,9 +45,11 @@ class NGBlockLayoutAlgorithmTest
|
| public:
|
| NGBlockLayoutAlgorithmTest() {
|
| RuntimeEnabledFeatures::setLayoutNGEnabled(true);
|
| + RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true);
|
| }
|
| ~NGBlockLayoutAlgorithmTest() {
|
| RuntimeEnabledFeatures::setLayoutNGEnabled(false);
|
| + RuntimeEnabledFeatures::setLayoutNGInlineEnabled(false);
|
| }
|
|
|
| protected:
|
| @@ -619,6 +621,37 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
|
| EXPECT_THAT(horizontal_fragment->LeftOffset(), LayoutUnit(130));
|
| }
|
|
|
| +// Verifies that margins collapsing logic works with Layout Inline.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsWithText) {
|
| + setBodyInnerHTML(R"HTML(
|
| + <!DOCTYPE html>
|
| + <style>
|
| + body {
|
| + margin: 10px;
|
| + }
|
| + p {
|
| + margin: 20px;
|
| + }
|
| + </style>
|
| + <p>Some text</p>
|
| + )HTML");
|
| + RefPtr<NGPhysicalBoxFragment> html_fragment;
|
| + std::tie(html_fragment, std::ignore) = RunBlockLayoutAlgorithmForElement(
|
| + document().getElementsByTagName("html")->item(0));
|
| +
|
| + auto* body_fragment =
|
| + toNGPhysicalBoxFragment(html_fragment->Children()[0].get());
|
| + // 20 = std::max(body's margin, p's margin)
|
| + EXPECT_THAT(body_fragment->Offset(),
|
| + NGPhysicalOffset(LayoutUnit(10), LayoutUnit(20)));
|
| +
|
| + auto* p_fragment =
|
| + toNGPhysicalBoxFragment(body_fragment->Children()[0].get());
|
| + // Collapsed margins with result = 0.
|
| + EXPECT_THAT(p_fragment->Offset(),
|
| + NGPhysicalOffset(LayoutUnit(20), LayoutUnit(0)));
|
| +}
|
| +
|
| // Verifies that the margin strut of a child with a different writing mode does
|
| // not get used in the collapsing margins calculation.
|
| //
|
|
|