Index: third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc |
index 0b350b3c4afedc46fc90fe4d404ab343cd52c2a7..09b813453c7b2df47f1f31a194f0a06bcb09cd66 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc |
@@ -270,5 +270,34 @@ TEST_F(NGInlineLayoutAlgorithmTest, |
EXPECT_EQ(wide_float->offsetTop(), narrow_float->offsetTop()); |
} |
+// Verifies that InlineLayoutAlgorithm positions floats with respect to their |
+// margins. |
+TEST_F(NGInlineLayoutAlgorithmTest, PositionFloatsWithMargins) { |
+ setBodyInnerHTML(R"HTML( |
+ <!DOCTYPE html> |
+ <style> |
+ #container { |
+ height: 200px; width: 200px; outline: solid orange; |
+ } |
+ #left { |
+ float: left; width: 5px; height: 30px; background-color: blue; |
+ margin: 10%; |
+ } |
+ </style> |
+ <div id="container"> |
+ <span id="text"> |
+ The quick <div id="left"></div> brown fox jumps over the lazy dog |
+ </span> |
+ </div> |
+ )HTML"); |
+ LayoutText* layout_text = |
+ toLayoutText(getLayoutObjectByElementId("text")->slowFirstChild()); |
+ ASSERT(layout_text->hasTextBoxes()); |
+ |
+ InlineTextBox* inline_text_box1 = layout_text->firstTextBox(); |
+ // 45 = sum of left's inline margins: 40 + left's width: 5 |
+ EXPECT_EQ(LayoutUnit(45), inline_text_box1->x()); |
+} |
+ |
} // namespace |
} // namespace blink |