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

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

Issue 2705493003: Revert of Don't pixel-snap overflow clips in clip paint property nodes. (Closed)
Patch Set: 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)));
58 // When RLS is enabled, the LayoutView will have a composited scrolling layer, 56 // When RLS is enabled, the LayoutView will have a composited scrolling layer,
59 // so don't apply an overflow clip. 57 // so don't apply an overflow clip.
60 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 58 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
61 context.setIgnoreOverflowClip(); 59 context.setIgnoreOverflowClip();
62 LayoutRect layerBounds; 60 LayoutRect layerBounds;
63 ClipRect backgroundRect, foregroundRect; 61 ClipRect backgroundRect, foregroundRect;
64 62
65 PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper; 63 PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
66 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 64 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
67 option = PaintLayer::UseGeometryMapper; 65 option = PaintLayer::UseGeometryMapper;
68 targetPaintLayer->clipper(option).calculateRects( 66 targetPaintLayer->clipper(option).calculateRects(
69 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, 67 context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
70 backgroundRect, foregroundRect); 68 backgroundRect, foregroundRect);
71 EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), backgroundRect.rect()); 69 EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
72 EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), foregroundRect.rect()); 70 EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect());
73 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds); 71 EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
74 } 72 }
75 73
76 TEST_P(PaintLayerClipperTest, ControlClip) { 74 TEST_P(PaintLayerClipperTest, ControlClip) {
77 setBodyInnerHTML( 75 setBodyInnerHTML(
78 "<!DOCTYPE html>" 76 "<!DOCTYPE html>"
79 "<input id=target style='position:absolute; width: 200px; height: 300px'" 77 "<input id=target style='position:absolute; width: 200px; height: 300px'"
80 " type=button>"); 78 " type=button>");
81 Element* target = document().getElementById("target"); 79 Element* target = document().getElementById("target");
82 PaintLayer* targetPaintLayer = 80 PaintLayer* targetPaintLayer =
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 option = PaintLayer::UseGeometryMapper; 444 option = PaintLayer::UseGeometryMapper;
447 parent->clipper(option).clearClipRectsIncludingDescendants(AbsoluteClipRects); 445 parent->clipper(option).clearClipRectsIncludingDescendants(AbsoluteClipRects);
448 446
449 EXPECT_TRUE(parent->clipRectsCache()); 447 EXPECT_TRUE(parent->clipRectsCache());
450 EXPECT_TRUE(child->clipRectsCache()); 448 EXPECT_TRUE(child->clipRectsCache());
451 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); 449 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
452 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root); 450 EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
453 } 451 }
454 452
455 } // namespace blink 453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698