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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp

Issue 2841823006: Resolve inline margins in over-constrained situations correctly. (Closed)
Patch Set: In regular block layout, the width of a child's margin box should always be equal to that of its co… Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/LayoutBox.h" 5 #include "core/layout/LayoutBox.h"
6 6
7 #include "core/html/HTMLElement.h" 7 #include "core/html/HTMLElement.h"
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 " width: 100px; height: 100px; background: blue'>" 256 " width: 100px; height: 100px; background: blue'>"
257 " <div style='width: 300px; height: 10px; background: green'></div>" 257 " <div style='width: 300px; height: 10px; background: green'></div>"
258 "</div>"); 258 "</div>");
259 259
260 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target")); 260 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target"));
261 EXPECT_TRUE(target->HasMask()); 261 EXPECT_TRUE(target->HasMask());
262 EXPECT_TRUE(target->HasOverflowClip()); 262 EXPECT_TRUE(target->HasOverflowClip());
263 EXPECT_EQ(LayoutRect(0, 0, 100, 100), target->LocalVisualRect()); 263 EXPECT_EQ(LayoutRect(0, 0, 100, 100), target->LocalVisualRect());
264 } 264 }
265 265
266 TEST_F(LayoutBoxTest, OverConstrainedAutoMarginLtr) {
mstensho (USE GERRIT) 2017/05/12 11:07:20 Let's use LayoutTests only for this.
facetothefate 2017/05/12 15:00:23 Acknowledged.
267 SetBodyInnerHTML(
268 "<div style='"
269 " width: 400px; border: 3px solid black;"
270 "'>"
271 " <div id='target' style='"
272 " margin-left: 10px; width: 500px; border: 3px solid gray; "
273 "margin-right: auto;"
274 " '></div>"
275 "</div>");
276 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target"));
277 EXPECT_EQ(LayoutUnit(-116), target->MarginEnd());
278 }
279
280 TEST_F(LayoutBoxTest, OverConstrainedAutoMarginRtl) {
281 SetBodyInnerHTML(
282 "<div style='"
283 " width: 400px; border: 3px solid black; direction: rtl;"
284 "'>"
285 " <div id='target' style='"
286 " margin-right: 10px; width: 500px; border: 3px solid gray;"
287 "margin-left: auto;"
288 " '></div>"
289 "</div>");
290 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target"));
291 EXPECT_EQ(LayoutUnit(-116), target->MarginEnd());
292 }
293
266 } // namespace blink 294 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698