| 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/DeprecatedPaintLayerCompositor.h" | 10 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 LayoutRect rect(1, 1, 9, 9); | 53 LayoutRect rect(1, 1, 9, 9); |
| 54 ClipRect clipRect(rect); | 54 ClipRect clipRect(rect); |
| 55 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 55 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const FloatRect& bound) | 58 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const FloatRect& bound) |
| 59 { | 59 { |
| 60 IntRect rect(1, 1, 9, 9); | 60 IntRect rect(1, 1, 9, 9); |
| 61 ClipRect clipRect((LayoutRect(rect))); | 61 ClipRect clipRect((LayoutRect(rect))); |
| 62 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 62 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); |
| 63 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase)) { | 63 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase, LayoutPoint())) { |
| 64 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound); | 64 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound, LayoutPoint()); |
| 65 context.drawRect(rect); | 65 context.drawRect(rect); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(LayerClipRecorderTest, Single) | 69 TEST_F(LayerClipRecorderTest, Single) |
| 70 { | 70 { |
| 71 GraphicsContext context(&rootDisplayItemList()); | 71 GraphicsContext context(&rootDisplayItemList()); |
| 72 FloatRect bound = layoutView().viewRect(); | 72 FloatRect bound = layoutView().viewRect(); |
| 73 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); | 73 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); |
| 74 | 74 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 FloatRect bound = layoutView().viewRect(); | 86 FloatRect bound = layoutView().viewRect(); |
| 87 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); | 87 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); |
| 88 | 88 |
| 89 drawEmptyClip(context, layoutView(), PaintPhaseForeground, bound); | 89 drawEmptyClip(context, layoutView(), PaintPhaseForeground, bound); |
| 90 rootDisplayItemList().commitNewDisplayItems(); | 90 rootDisplayItemList().commitNewDisplayItems(); |
| 91 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); | 91 EXPECT_EQ((size_t)0, rootDisplayItemList().displayItems().size()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } | 94 } |
| 95 } | 95 } |
| OLD | NEW |