Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "web/PageOverlay.h" | 6 #include "web/PageOverlay.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "platform/graphics/Color.h" | 10 #include "platform/graphics/Color.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 // WebPageOverlay that uses the underlying blink::GraphicsContext to paint a | 99 // WebPageOverlay that uses the underlying blink::GraphicsContext to paint a |
| 100 // solid color. | 100 // solid color. |
| 101 class PrivateGraphicsContextOverlay : public WebPageOverlay { | 101 class PrivateGraphicsContextOverlay : public WebPageOverlay { |
| 102 public: | 102 public: |
| 103 PrivateGraphicsContextOverlay(Color color) : m_color(color) { } | 103 PrivateGraphicsContextOverlay(Color color) : m_color(color) { } |
| 104 | 104 |
| 105 void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) over ride | 105 void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) over ride |
| 106 { | 106 { |
| 107 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr aphicsContext(); | 107 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr aphicsContext(); |
| 108 FloatRect rect(0, 0, size.width, size.height); | 108 if (!DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, *this, DisplayItem::PageOverlay)) { |
|
Xianzhu
2015/07/03 01:24:42
Nit:
'if (DrawingRecorder::...)
return;'
seems
pdr.
2015/07/03 02:38:04
I agree. Done.
| |
| 109 DrawingRecorder drawingRecorder(graphicsContext, *this, DisplayItem::Pag eOverlay, rect); | 109 FloatRect rect(0, 0, size.width, size.height); |
| 110 if (!drawingRecorder.canUseCachedDrawing()) | 110 DrawingRecorder drawingRecorder(graphicsContext, *this, DisplayItem: :PageOverlay, rect); |
| 111 graphicsContext.fillRect(rect, m_color); | 111 graphicsContext.fillRect(rect, m_color); |
| 112 } | |
| 112 } | 113 } |
| 113 | 114 |
| 114 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } | 115 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } |
| 115 String debugName() const { return "PrivateGraphicsContextOverlay"; } | 116 String debugName() const { return "PrivateGraphicsContextOverlay"; } |
| 116 | 117 |
| 117 private: | 118 private: |
| 118 Color m_color; | 119 Color m_color; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 template <bool(*getter)(), void(*setter)(bool)> | 122 template <bool(*getter)(), void(*setter)(bool)> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 } | 232 } |
| 232 | 233 |
| 233 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) | 234 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) |
| 234 { | 235 { |
| 235 SlimmingPaintScope slimmingPaintEnabled(true); | 236 SlimmingPaintScope slimmingPaintEnabled(true); |
| 236 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); | 237 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace | 240 } // namespace |
| 240 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |