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

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

Issue 2394263004: Reformat comments in core/layout up until LayoutMultiColumnFlowThread (Closed)
Patch Set: Rebase w/HEAD Created 4 years, 2 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 "#target5 { background: none border-box, green content-box;}" 48 "#target5 { background: none border-box, green content-box;}"
49 "#target6 { background: green content-box local; }" 49 "#target6 { background: green content-box local; }"
50 "</style>" 50 "</style>"
51 "<div id='target1'></div>" 51 "<div id='target1'></div>"
52 "<div id='target2'></div>" 52 "<div id='target2'></div>"
53 "<div id='target3'></div>" 53 "<div id='target3'></div>"
54 "<div id='target4'></div>" 54 "<div id='target4'></div>"
55 "<div id='target5'></div>" 55 "<div id='target5'></div>"
56 "<div id='target6'></div>"); 56 "<div id='target6'></div>");
57 57
58 // #target1's opaque background color only fills the content box but its trans lucent image extends to the borders. 58 // #target1's opaque background color only fills the content box but its
59 // translucent image extends to the borders.
59 LayoutBox* layoutBox = toLayoutBox(getLayoutObjectByElementId("target1")); 60 LayoutBox* layoutBox = toLayoutBox(getLayoutObjectByElementId("target1"));
60 EXPECT_EQ(LayoutRect(20, 20, 100, 100), 61 EXPECT_EQ(LayoutRect(20, 20, 100, 100),
61 layoutBox->backgroundRect(BackgroundKnownOpaqueRect)); 62 layoutBox->backgroundRect(BackgroundKnownOpaqueRect));
62 EXPECT_EQ(LayoutRect(0, 0, 140, 140), 63 EXPECT_EQ(LayoutRect(0, 0, 140, 140),
63 layoutBox->backgroundRect(BackgroundClipRect)); 64 layoutBox->backgroundRect(BackgroundClipRect));
64 65
65 // #target2's background color is opaque but only fills the padding-box becaus e it has local attachment. 66 // #target2's background color is opaque but only fills the padding-box
66 // This eclipses the content-box image. 67 // because it has local attachment. This eclipses the content-box image.
67 layoutBox = toLayoutBox(getLayoutObjectByElementId("target2")); 68 layoutBox = toLayoutBox(getLayoutObjectByElementId("target2"));
68 EXPECT_EQ(LayoutRect(10, 10, 120, 120), 69 EXPECT_EQ(LayoutRect(10, 10, 120, 120),
69 layoutBox->backgroundRect(BackgroundKnownOpaqueRect)); 70 layoutBox->backgroundRect(BackgroundKnownOpaqueRect));
70 EXPECT_EQ(LayoutRect(10, 10, 120, 120), 71 EXPECT_EQ(LayoutRect(10, 10, 120, 120),
71 layoutBox->backgroundRect(BackgroundClipRect)); 72 layoutBox->backgroundRect(BackgroundClipRect));
72 73
73 // #target3's background color is not opaque so we only have a clip rect. 74 // #target3's background color is not opaque so we only have a clip rect.
74 layoutBox = toLayoutBox(getLayoutObjectByElementId("target3")); 75 layoutBox = toLayoutBox(getLayoutObjectByElementId("target3"));
75 EXPECT_TRUE(layoutBox->backgroundRect(BackgroundKnownOpaqueRect).isEmpty()); 76 EXPECT_TRUE(layoutBox->backgroundRect(BackgroundKnownOpaqueRect).isEmpty());
76 EXPECT_EQ(LayoutRect(0, 0, 140, 140), 77 EXPECT_EQ(LayoutRect(0, 0, 140, 140),
77 layoutBox->backgroundRect(BackgroundClipRect)); 78 layoutBox->backgroundRect(BackgroundClipRect));
78 79
79 // #target4's background color has a blend mode so it isn't opaque. 80 // #target4's background color has a blend mode so it isn't opaque.
80 layoutBox = toLayoutBox(getLayoutObjectByElementId("target4")); 81 layoutBox = toLayoutBox(getLayoutObjectByElementId("target4"));
81 EXPECT_TRUE(layoutBox->backgroundRect(BackgroundKnownOpaqueRect).isEmpty()); 82 EXPECT_TRUE(layoutBox->backgroundRect(BackgroundKnownOpaqueRect).isEmpty());
82 EXPECT_EQ(LayoutRect(0, 0, 140, 140), 83 EXPECT_EQ(LayoutRect(0, 0, 140, 140),
83 layoutBox->backgroundRect(BackgroundClipRect)); 84 layoutBox->backgroundRect(BackgroundClipRect));
84 85
85 // #target5's solid background only covers the content-box but it has a "none" background 86 // #target5's solid background only covers the content-box but it has a "none"
86 // covering the border box. 87 // background covering the border box.
87 layoutBox = toLayoutBox(getLayoutObjectByElementId("target5")); 88 layoutBox = toLayoutBox(getLayoutObjectByElementId("target5"));
88 EXPECT_EQ(LayoutRect(20, 20, 100, 100), 89 EXPECT_EQ(LayoutRect(20, 20, 100, 100),
89 layoutBox->backgroundRect(BackgroundKnownOpaqueRect)); 90 layoutBox->backgroundRect(BackgroundKnownOpaqueRect));
90 EXPECT_EQ(LayoutRect(0, 0, 140, 140), 91 EXPECT_EQ(LayoutRect(0, 0, 140, 140),
91 layoutBox->backgroundRect(BackgroundClipRect)); 92 layoutBox->backgroundRect(BackgroundClipRect));
92 93
93 // Because it can scroll due to local attachment, the opaque local background in #target6 94 // Because it can scroll due to local attachment, the opaque local background
94 // is treated as padding box for the clip rect, but remains the content box fo r the known 95 // in #target6 is treated as padding box for the clip rect, but remains the
95 // opaque rect. 96 // content box for the known opaque rect.
96 layoutBox = toLayoutBox(getLayoutObjectByElementId("target6")); 97 layoutBox = toLayoutBox(getLayoutObjectByElementId("target6"));
97 EXPECT_EQ(LayoutRect(20, 20, 100, 100), 98 EXPECT_EQ(LayoutRect(20, 20, 100, 100),
98 layoutBox->backgroundRect(BackgroundKnownOpaqueRect)); 99 layoutBox->backgroundRect(BackgroundKnownOpaqueRect));
99 EXPECT_EQ(LayoutRect(10, 10, 120, 120), 100 EXPECT_EQ(LayoutRect(10, 10, 120, 120),
100 layoutBox->backgroundRect(BackgroundClipRect)); 101 layoutBox->backgroundRect(BackgroundClipRect));
101 } 102 }
102 103
103 TEST_F(LayoutBoxTest, LocationContainer) { 104 TEST_F(LayoutBoxTest, LocationContainer) {
104 setBodyInnerHTML( 105 setBodyInnerHTML(
105 "<div id='div'>" 106 "<div id='div'>"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const LayoutBox* row2 = toLayoutBox(getLayoutObjectByElementId("row2")); 176 const LayoutBox* row2 = toLayoutBox(getLayoutObjectByElementId("row2"));
176 EXPECT_EQ(LayoutPoint(100, 0), row2->location()); 177 EXPECT_EQ(LayoutPoint(100, 0), row2->location());
177 EXPECT_EQ(LayoutPoint(0, 0), row2->topLeftLocation()); 178 EXPECT_EQ(LayoutPoint(0, 0), row2->topLeftLocation());
178 179
179 const LayoutBox* cell2 = toLayoutBox(getLayoutObjectByElementId("cell2")); 180 const LayoutBox* cell2 = toLayoutBox(getLayoutObjectByElementId("cell2"));
180 EXPECT_EQ(LayoutPoint(100, 0), cell2->location()); 181 EXPECT_EQ(LayoutPoint(100, 0), cell2->location());
181 EXPECT_EQ(LayoutPoint(0, 0), cell2->topLeftLocation()); 182 EXPECT_EQ(LayoutPoint(0, 0), cell2->topLeftLocation());
182 } 183 }
183 184
184 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698