Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: Source/web/PageOverlay.cpp

Issue 867063004: [Slimming Paint] Paint the inspector overlay with GraphicsLayer DisplayList. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/PageOverlay.cpp
diff --git a/Source/web/PageOverlay.cpp b/Source/web/PageOverlay.cpp
index b909ca64831626737a3ef8b5ec45ce803d7625af..eca2eb02cac5a6d44290438de57c868fe1766d91 100644
--- a/Source/web/PageOverlay.cpp
+++ b/Source/web/PageOverlay.cpp
@@ -37,19 +37,11 @@
#include "public/platform/WebLayer.h"
#include "public/web/WebPageOverlay.h"
#include "public/web/WebViewClient.h"
+#include "web/WebGraphicsContextImpl.h"
#include "web/WebViewImpl.h"
namespace blink {
-namespace {
-
-WebCanvas* ToWebCanvas(GraphicsContext* gc)
-{
- return gc->canvas();
-}
-
-} // namespace
-
PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, WebPageOverlay* overlay)
{
return adoptPtr(new PageOverlay(viewImpl, overlay));
@@ -62,36 +54,6 @@ PageOverlay::PageOverlay(WebViewImpl* viewImpl, WebPageOverlay* overlay)
{
}
-class OverlayGraphicsLayerClientImpl : public GraphicsLayerClient {
-public:
- static PassOwnPtr<OverlayGraphicsLayerClientImpl> create(WebPageOverlay* overlay)
- {
- return adoptPtr(new OverlayGraphicsLayerClientImpl(overlay));
- }
-
- virtual ~OverlayGraphicsLayerClientImpl() { }
-
- virtual void paintContents(const GraphicsLayer*, GraphicsContext& gc, GraphicsLayerPaintingPhase, const IntRect& inClip)
- {
- gc.save();
- m_overlay->paintPageOverlay(ToWebCanvas(&gc));
- gc.restore();
- }
-
- virtual String debugName(const GraphicsLayer* graphicsLayer) override
- {
- return String("WebViewImpl Page Overlay Content Layer");
- }
-
-private:
- explicit OverlayGraphicsLayerClientImpl(WebPageOverlay* overlay)
- : m_overlay(overlay)
- {
- }
-
- WebPageOverlay* m_overlay;
-};
-
void PageOverlay::clear()
{
invalidateWebFrame();
@@ -101,7 +63,6 @@ void PageOverlay::clear()
if (Page* page = m_viewImpl->page())
page->inspectorController().didRemovePageOverlay(m_layer.get());
m_layer = nullptr;
- m_layerClient = nullptr;
}
}
@@ -110,8 +71,7 @@ void PageOverlay::update()
invalidateWebFrame();
if (!m_layer) {
- m_layerClient = OverlayGraphicsLayerClientImpl::create(m_overlay);
- m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_layerClient.get());
+ m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), this);
m_layer->setDrawsContent(true);
if (Page* page = m_viewImpl->page())
@@ -136,11 +96,18 @@ void PageOverlay::update()
void PageOverlay::paintWebFrame(GraphicsContext& gc)
{
- if (!m_viewImpl->isAcceleratedCompositingActive()) {
- gc.save();
- m_overlay->paintPageOverlay(ToWebCanvas(&gc));
- gc.restore();
- }
+ WebGraphicsContextImpl contextWrapper(gc, displayItemClient(), DisplayItem::PageOverlay);
+ m_overlay->paintPageOverlay(&contextWrapper, m_viewImpl->size());
+}
+
+void PageOverlay::paintContents(const GraphicsLayer*, GraphicsContext& gc, GraphicsLayerPaintingPhase, const IntRect& inClip)
+{
+ paintWebFrame(gc);
+}
+
+String PageOverlay::debugName(const GraphicsLayer*)
+{
+ return "WebViewImpl Page Overlay Content Layer";
}
void PageOverlay::invalidateWebFrame()

Powered by Google App Engine
This is Rietveld 408576698