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

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

Issue 2701523003: Don't pixel-snap overflow clips in clip paint property nodes. (Closed)
Patch Set: Merge branch 'master' into fixclipping Created 3 years, 10 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/PaintLayerClipper.h" 5 #include "core/paint/PaintLayerClipper.h"
6 6
7 #include "core/layout/LayoutBoxModelObject.h" 7 #include "core/layout/LayoutBoxModelObject.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 TEST_P(PaintLayerClipperTest, LayoutSVGRoot) { 45 TEST_P(PaintLayerClipperTest, LayoutSVGRoot) {
46 setBodyInnerHTML( 46 setBodyInnerHTML(
47 "<!DOCTYPE html>" 47 "<!DOCTYPE html>"
48 "<svg id=target width=200 height=300 style='position: relative'>" 48 "<svg id=target width=200 height=300 style='position: relative'>"
49 " <rect width=400 height=500 fill='blue'/>" 49 " <rect width=400 height=500 fill='blue'/>"
50 "</svg>"); 50 "</svg>");
51 51
52 Element* target = document().getElementById("target"); 52 Element* target = document().getElementById("target");
53 PaintLayer* targetPaintLayer = 53 PaintLayer* targetPaintLayer =
54 toLayoutBoxModelObject(target->layoutObject())->layer(); 54 toLayoutBoxModelObject(target->layoutObject())->layer();
55 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects); 55 ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects,
56 IgnoreOverlayScrollbarSize,
57 LayoutSize(FloatSize(0.25, 0.35)));
56 // When RLS is enabled, the LayoutView will have a composited scrolling layer, 58 // When RLS is enabled, the LayoutView will have a composited scrolling layer,
57 // so don't apply an overflow clip. 59 // so don't apply an overflow clip.
58 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 60 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
59 context.setIgnoreOverflowClip(); 61 context.setIgnoreOverflowClip();
60 LayoutRect layerBounds; 62 LayoutRect layerBounds;
61 ClipRect backgroundRect, foregroundRect; 63 ClipRect backgroundRect, foregroundRect;
62 64
63 PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper; 65 PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
64 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 66 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
65 option = PaintLayer::UseGeometryMapper; 67 option = PaintLayer::UseGeometryMapper;
66 targetPaintLayer->clipper(option).calculateRects( 68 targetPaintLayer->clipper(option).calculateRects(
67 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, 69 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
68 backgroundRect, foregroundRect); 70 backgroundRect, foregroundRect);
69 EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect()); 71 EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), backgroundRect.rect());
70 EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect()); 72 EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), foregroundRect.rect());
71 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds); 73 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
72 } 74 }
73 75
74 TEST_P(PaintLayerClipperTest, ControlClip) { 76 TEST_P(PaintLayerClipperTest, ControlClip) {
75 setBodyInnerHTML( 77 setBodyInnerHTML(
76 "<!DOCTYPE html>" 78 "<!DOCTYPE html>"
77 "<input id=target style='position:absolute; width: 200px; height: 300px'" 79 "<input id=target style='position:absolute; width: 200px; height: 300px'"
78 " type=button>"); 80 " type=button>");
79 Element* target = document().getElementById("target"); 81 Element* target = document().getElementById("target");
80 PaintLayer* targetPaintLayer = 82 PaintLayer* targetPaintLayer =
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 option = PaintLayer::UseGeometryMapper; 446 option = PaintLayer::UseGeometryMapper;
445 parent->clipper(option).clearClipRectsIncludingDescendants(AbsoluteClipRects); 447 parent->clipper(option).clearClipRectsIncludingDescendants(AbsoluteClipRects);
446 448
447 EXPECT_TRUE(parent->clipRectsCache()); 449 EXPECT_TRUE(parent->clipRectsCache());
448 EXPECT_TRUE(child->clipRectsCache()); 450 EXPECT_TRUE(child->clipRectsCache());
449 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); 451 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
450 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); 452 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
451 } 453 }
452 454
453 } // namespace blink 455 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698