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

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

Issue 2780593002: Apply control clips in LayoutBox::clippingRect() (Closed)
Patch Set: none Created 3 years, 9 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // The writing mode style should be still be inherited. 203 // The writing mode style should be still be inherited.
204 EXPECT_TRUE(foreign->hasFlippedBlocksWritingMode()); 204 EXPECT_TRUE(foreign->hasFlippedBlocksWritingMode());
205 205
206 // The child of the foreign object is affected by writing-mode. 206 // The child of the foreign object is affected by writing-mode.
207 EXPECT_EQ(foreign, child->locationContainer()); 207 EXPECT_EQ(foreign, child->locationContainer());
208 EXPECT_EQ(LayoutRect(0, 0, 33, 55), child->frameRect()); 208 EXPECT_EQ(LayoutRect(0, 0, 33, 55), child->frameRect());
209 EXPECT_EQ(LayoutPoint(67, 0), child->physicalLocation()); 209 EXPECT_EQ(LayoutPoint(67, 0), child->physicalLocation());
210 EXPECT_TRUE(child->hasFlippedBlocksWritingMode()); 210 EXPECT_TRUE(child->hasFlippedBlocksWritingMode());
211 } 211 }
212 212
213 TEST_F(LayoutBoxTest, ControlClip) {
214 setBodyInnerHTML(
215 "<style>"
216 " * { margin: 0; }"
217 " #target {"
218 " position: relative;"
219 " width: 100px; height: 50px;"
220 " }"
221 "</style>"
222 "<input id='target' type='button' value='some text'/>");
223 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
224 EXPECT_TRUE(target->hasControlClip());
225 EXPECT_TRUE(target->hasClipRelatedProperty());
226 EXPECT_TRUE(target->shouldClipOverflow());
227 // Approximate checks to avoid platform-specific clips.
pdr. 2017/03/28 03:30:20 Instead of approximate checks, can you check the O
chrishtr 2017/03/28 03:52:14 Sigh. Ok, will do.
228 EXPECT_LE(target->clippingRect().width().toInt(), 100);
229 EXPECT_LE(target->clippingRect().height().toInt(), 50);
230 }
231
213 } // namespace blink 232 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698