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

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

Issue 2068723002: Paint local attachment backgrounds into composited scrolling contents layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add/update tests and simplify added code. Created 4 years, 4 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"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class LayoutBoxTest : public RenderingTest { 14 class LayoutBoxTest : public RenderingTest {
15 }; 15 };
16 16
17 TEST_F(LayoutBoxTest, BackgroundObscuredInRect) 17 TEST_F(LayoutBoxTest, BackgroundObscuredInRect)
18 { 18 {
19 setBodyInnerHTML("<style>.column { width: 295.4px; padding-left: 10.4px; } . white-background { background: red; position: relative; overflow: hidden; border -radius: 1px; }" 19 setBodyInnerHTML("<style>.column { width: 295.4px; padding-left: 10.4px; } . white-background { background: red; position: relative; overflow: hidden; border -radius: 1px; }"
20 ".black-background { height: 100px; background: black; color: white; } < /style>" 20 ".black-background { height: 100px; background: black; color: white; } < /style>"
21 "<div class='column'> <div> <div id='target' class='white-background'> < div class='black-background'></div> </div> </div> </div>"); 21 "<div class='column'> <div> <div id='target' class='white-background'> < div class='black-background'></div> </div> </div> </div>");
22 LayoutObject* layoutObject = getLayoutObjectByElementId("target"); 22 LayoutObject* layoutObject = getLayoutObjectByElementId("target");
23 ASSERT_TRUE(layoutObject); 23 ASSERT_TRUE(layoutObject);
24 ASSERT_TRUE(layoutObject->backgroundIsKnownToBeObscured()); 24 ASSERT_TRUE(layoutObject->backgroundIsKnownToBeObscured());
25 } 25 }
26 26
27 TEST_F(LayoutBoxTest, BackgroundRect)
chrishtr 2016/08/12 17:03:00 Add more tests for other cases.
flackr 2016/08/16 17:52:51 I added tests which I think cover all of the speci
28 {
29 setBodyInnerHTML("<style>#target { background: url(data:image/png;base64,iVB ORw0KGgoAAAANSUhEUg) border-box, green content-box; width: 100px; height: 100px; padding: 10px; border: 10px solid black;}</style>"
30 "<div id='target'></div>");
31 LayoutBox* layoutBox = toLayoutBox(getLayoutObjectByElementId("target"));
32 EXPECT_EQ(LayoutRect(20, 20, 100, 100), layoutBox->backgroundRect(OpaqueBack groundRect));
33 EXPECT_EQ(LayoutRect(0, 0, 140, 140), layoutBox->backgroundRect(TranslucentB ackgroundRect));
34 }
35
27 } // namespace blink 36 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698