OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/LayerClipRecorder.h" | 6 #include "core/paint/LayerClipRecorder.h" |
7 | 7 |
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/layout/compositing/LayerCompositor.h" | 10 #include "core/layout/compositing/LayerCompositor.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 ASSERT_TRUE(m_layoutView); | 37 ASSERT_TRUE(m_layoutView); |
38 } | 38 } |
39 | 39 |
40 LayoutView* m_layoutView; | 40 LayoutView* m_layoutView; |
41 }; | 41 }; |
42 | 42 |
43 void drawEmptyClip(GraphicsContext* context, LayoutView* renderer, PaintPhase ph
ase, const FloatRect& bound) | 43 void drawEmptyClip(GraphicsContext* context, LayoutView* renderer, PaintPhase ph
ase, const FloatRect& bound) |
44 { | 44 { |
45 LayoutRect rect(1, 1, 9, 9); | 45 LayoutRect rect(1, 1, 9, 9); |
46 ClipRect clipRect(rect); | 46 ClipRect clipRect(rect); |
47 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootLayer()->ren
derer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(),
PaintLayerFlags()); | 47 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootLayer()->lay
outObject(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint
(), PaintLayerFlags()); |
48 } | 48 } |
49 | 49 |
50 void drawRectInClip(GraphicsContext* context, LayoutView* renderer, PaintPhase p
hase, const FloatRect& bound) | 50 void drawRectInClip(GraphicsContext* context, LayoutView* renderer, PaintPhase p
hase, const FloatRect& bound) |
51 { | 51 { |
52 IntRect rect(1, 1, 9, 9); | 52 IntRect rect(1, 1, 9, 9); |
53 ClipRect clipRect((LayoutRect(rect))); | 53 ClipRect clipRect((LayoutRect(rect))); |
54 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootLayer()->ren
derer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(),
PaintLayerFlags()); | 54 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootLayer()->lay
outObject(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint
(), PaintLayerFlags()); |
55 RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound); | 55 RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound); |
56 if (!drawingRecorder.canUseCachedDrawing()) | 56 if (!drawingRecorder.canUseCachedDrawing()) |
57 context->drawRect(rect); | 57 context->drawRect(rect); |
58 } | 58 } |
59 | 59 |
60 TEST_F(LayerClipRecorderTest, Single) | 60 TEST_F(LayerClipRecorderTest, Single) |
61 { | 61 { |
62 GraphicsContext context(nullptr, &rootDisplayItemList()); | 62 GraphicsContext context(nullptr, &rootDisplayItemList()); |
63 FloatRect bound = layoutView()->viewRect(); | 63 FloatRect bound = layoutView()->viewRect(); |
64 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); | 64 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); |
(...skipping 12 matching lines...) Expand all Loading... |
77 FloatRect bound = layoutView()->viewRect(); | 77 FloatRect bound = layoutView()->viewRect(); |
78 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); | 78 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); |
79 | 79 |
80 drawEmptyClip(&context, layoutView(), PaintPhaseForeground, bound); | 80 drawEmptyClip(&context, layoutView(), PaintPhaseForeground, bound); |
81 rootDisplayItemList().endNewPaints(); | 81 rootDisplayItemList().endNewPaints(); |
82 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); | 82 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); |
83 } | 83 } |
84 | 84 |
85 } | 85 } |
86 } | 86 } |
OLD | NEW |