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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp

Issue 2591883002: Apply both phsical bounding box and clip to composited bounds. (Closed)
Patch Set: none Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintLayer.h" 5 #include "core/paint/PaintLayer.h"
6 6
7 #include "core/html/HTMLIFrameElement.h" 7 #include "core/html/HTMLIFrameElement.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 " width: 200px; background: lightblue; }</style>"); 51 " width: 200px; background: lightblue; }</style>");
52 52
53 PaintLayer* parentLayer = 53 PaintLayer* parentLayer =
54 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer(); 54 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
55 // Since "absposchild" is clipped by "parent", it should not expand the 55 // Since "absposchild" is clipped by "parent", it should not expand the
56 // composited bounds for "parent" beyond its intrinsic size of 150x150. 56 // composited bounds for "parent" beyond its intrinsic size of 150x150.
57 EXPECT_EQ(LayoutRect(0, 0, 150, 150), 57 EXPECT_EQ(LayoutRect(0, 0, 150, 150),
58 parentLayer->boundingBoxForCompositing()); 58 parentLayer->boundingBoxForCompositing());
59 } 59 }
60 60
61 TEST_P(PaintLayerTest, CompositedBoundsTransformedChild) {
62 // TODO(chrishtr): fix this test for SPv2
63 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
64 return;
65
66 setBodyInnerHTML(
67 "<div id=parent style='overflow: scroll; will-change: transform'>"
68 " <div class='target'"
69 " style='position: relative; transform: skew(-15deg);'>"
70 " </div>"
71 " <div style='width: 1000px; height: 500px; background: lightgray'>"
72 " </div>"
73 "</div>");
74
75 PaintLayer* parentLayer =
76 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer();
77 EXPECT_EQ(LayoutRect(0, 0, 784, 500),
78 parentLayer->boundingBoxForCompositing());
79 }
80
61 TEST_P(PaintLayerTest, PaintingExtentReflection) { 81 TEST_P(PaintLayerTest, PaintingExtentReflection) {
62 setBodyInnerHTML( 82 setBodyInnerHTML(
63 "<div id='target' style='background-color: blue; position: absolute;" 83 "<div id='target' style='background-color: blue; position: absolute;"
64 " width: 110px; height: 120px; top: 40px; left: 60px;" 84 " width: 110px; height: 120px; top: 40px; left: 60px;"
65 " -webkit-box-reflect: below 3px'>" 85 " -webkit-box-reflect: below 3px'>"
66 "</div>"); 86 "</div>");
67 87
68 PaintLayer* layer = 88 PaintLayer* layer =
69 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); 89 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer();
70 EXPECT_EQ( 90 EXPECT_EQ(
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); 414 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
395 415
396 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20), 416 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20),
397 ProgrammaticScroll); 417 ProgrammaticScroll);
398 document().view()->updateAllLifecyclePhases(); 418 document().view()->updateAllLifecyclePhases();
399 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect()); 419 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
400 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); 420 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
401 } 421 }
402 422
403 } // namespace blink 423 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698