| 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/compositing/RenderLayerCompositor.h" | 8 #include "core/layout/compositing/LayerCompositor.h" |
| 9 #include "core/rendering/RenderView.h" | 9 #include "core/rendering/RenderView.h" |
| 10 #include "core/rendering/RenderingTestHelper.h" | 10 #include "core/rendering/RenderingTestHelper.h" |
| 11 #include "platform/graphics/GraphicsContext.h" | 11 #include "platform/graphics/GraphicsContext.h" |
| 12 #include "platform/graphics/GraphicsLayer.h" | 12 #include "platform/graphics/GraphicsLayer.h" |
| 13 #include "platform/graphics/paint/DisplayItemList.h" | 13 #include "platform/graphics/paint/DisplayItemList.h" |
| 14 #include <gtest/gtest.h> | 14 #include <gtest/gtest.h> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 ASSERT_TRUE(m_renderView); | 36 ASSERT_TRUE(m_renderView); |
| 37 } | 37 } |
| 38 | 38 |
| 39 RenderView* m_renderView; | 39 RenderView* m_renderView; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase,
const FloatRect& bound) | 42 void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase,
const FloatRect& bound) |
| 43 { | 43 { |
| 44 IntRect rect(1, 1, 9, 9); | 44 IntRect rect(1, 1, 9, 9); |
| 45 ClipRect clipRect(rect); | 45 ClipRect clipRect(rect); |
| 46 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootRenderLayer(
)->renderer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi
nt(), PaintLayerFlags()); | 46 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootLayer()->ren
derer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(),
PaintLayerFlags()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(LayerClipRecorderTest, LayerClipRecorderTest_Single) | 49 TEST_F(LayerClipRecorderTest, LayerClipRecorderTest_Single) |
| 50 { | 50 { |
| 51 GraphicsContext context(nullptr, &rootDisplayItemList()); | 51 GraphicsContext context(nullptr, &rootDisplayItemList()); |
| 52 FloatRect bound = renderView()->viewRect(); | 52 FloatRect bound = renderView()->viewRect(); |
| 53 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); | 53 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); |
| 54 | 54 |
| 55 drawClip(&context, renderView(), PaintPhaseForeground, bound); | 55 drawClip(&context, renderView(), PaintPhaseForeground, bound); |
| 56 rootDisplayItemList().endNewPaints(); | 56 rootDisplayItemList().endNewPaints(); |
| 57 EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size()); | 57 EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } | 60 } |
| 61 } | 61 } |
| OLD | NEW |