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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm_test.cc

Issue 2798203002: NGInlineLayoutAlgorithm should take margins of inline floats into account (Closed)
Patch Set: use parent's writing mode, direction while calculating margins Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698