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

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

Issue 1490063002: Implement Paint Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: additional rename, fix search/replace Created 5 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "core/layout/LayoutBlock.h"
8 #include "core/layout/LayoutInline.h"
9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/paint/PaintLayer.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace blink {
14
15 class PaintContainmentTest : public RenderingTest {
16 };
17
18 static void checkIsClippingStackingContextAndContainer(LayoutBoxModelObject& obj )
19 {
20 EXPECT_TRUE(obj.canContainFixedPositionObjects());
21 EXPECT_TRUE(obj.hasClipRelatedProperty());
chrishtr 2015/12/11 23:39:19 EXPECT_TRUE(obj.style()->containsPaint())
22
23 // TODO(leviw): Ideally, we wouldn't require a paint layer to handle the cli pping
24 // and stacking performed by paint containment.
25 ASSERT(obj.layer());
26 PaintLayer* layer = obj.layer();
27 EXPECT_TRUE(layer->stackingNode() && layer->stackingNode()->isStackingContex t());
28 }
29
30 TEST_F(PaintContainmentTest, BlockPaintContainment)
31 {
32 setBodyInnerHTML("<div id='div' style='contain: paint'></div>");
33 Element* div = document().getElementById(AtomicString("div"));
34 ASSERT(div);
35 LayoutObject* obj = div->layoutObject();
36 ASSERT(obj && obj->isLayoutBlock());
37 LayoutBlock& block = toLayoutBlock(*obj);
38 EXPECT_TRUE(block.createsNewFormattingContext());
39 EXPECT_FALSE(block.canBeScrolledAndHasScrollableArea());
40 checkIsClippingStackingContextAndContainer(block);
41 }
42
43 TEST_F(PaintContainmentTest, InlinePaintContainment)
44 {
45 setBodyInnerHTML("<div><span id='test' style='contain: paint'>Foo</span></di v>");
46 Element* span = document().getElementById(AtomicString("test"));
47 ASSERT(span);
48 LayoutObject* obj = span->layoutObject();
49 ASSERT(obj && obj->isInline());
50 LayoutInline& layoutInline = toLayoutInline(*obj);
51 checkIsClippingStackingContextAndContainer(layoutInline);
52 }
53
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698