| 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 "core/paint/LayerClipRecorder.h" | 5 #include "core/paint/LayerClipRecorder.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/compositing/PaintLayerCompositor.h" | 9 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 LayoutRect rect(1, 1, 9, 9); | 44 LayoutRect rect(1, 1, 9, 9); |
| 45 ClipRect clipRect(rect); | 45 ClipRect clipRect(rect); |
| 46 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 46 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const LayoutRect& bound) | 49 void drawRectInClip(GraphicsContext& context, LayoutView& layoutView, PaintPhase
phase, const LayoutRect& bound) |
| 50 { | 50 { |
| 51 IntRect rect(1, 1, 9, 9); | 51 IntRect rect(1, 1, 9, 9); |
| 52 ClipRect clipRect((LayoutRect(rect))); | 52 ClipRect clipRect((LayoutRect(rect))); |
| 53 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 53 LayerClipRecorder LayerClipRecorder(context, *layoutView.compositor()->rootL
ayer()->layoutObject(), DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); |
| 54 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase, LayoutPoint())) { | 54 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layout
View, phase)) { |
| 55 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound, LayoutPoint()); | 55 LayoutObjectDrawingRecorder drawingRecorder(context, layoutView, phase,
bound); |
| 56 context.drawRect(rect); | 56 context.drawRect(rect); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 TEST_F(LayerClipRecorderTest, Single) | 60 TEST_F(LayerClipRecorderTest, Single) |
| 61 { | 61 { |
| 62 rootPaintController().invalidateAll(); | 62 rootPaintController().invalidateAll(); |
| 63 GraphicsContext context(rootPaintController()); | 63 GraphicsContext context(rootPaintController()); |
| 64 LayoutRect bound = layoutView().viewRect(); | 64 LayoutRect bound = layoutView().viewRect(); |
| 65 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); | 65 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 GraphicsContext context(rootPaintController()); | 78 GraphicsContext context(rootPaintController()); |
| 79 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); | 79 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); |
| 80 | 80 |
| 81 drawEmptyClip(context, layoutView(), PaintPhaseForeground); | 81 drawEmptyClip(context, layoutView(), PaintPhaseForeground); |
| 82 rootPaintController().commitNewDisplayItems(); | 82 rootPaintController().commitNewDisplayItems(); |
| 83 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); | 83 EXPECT_EQ((size_t)0, rootPaintController().displayItemList().size()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace | 86 } // namespace |
| 87 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |