Title: [88582] trunk/Source/WebKit/chromium
Revision
88582
Author
[email protected]
Date
2011-06-10 17:39:10 -0700 (Fri, 10 Jun 2011)

Log Message

2011-06-10  Vsevolod Vlasov  <[email protected]>

        Reviewed by James Robinson.

        Web Inspector: [Chromium] DevTools does not highlight elements when accelerated compositing is on.
        https://bugs.webkit.org/show_bug.cgi?id=62149

        Added page overlay for inspector highlight support.

        * WebKit.gyp:
        * src/ChromeClientImpl.cpp:
        (WebKit::ChromeClientImpl::attachRootGraphicsLayer):
        * src/PageOverlay.cpp: Added.
        (WebKit::PageOverlay::create):
        (WebKit::PageOverlay::PageOverlay):
        (WebKit::OverlayGraphicsLayerClientImpl::create):
        (WebKit::OverlayGraphicsLayerClientImpl::~OverlayGraphicsLayerClientImpl):
        (WebKit::OverlayGraphicsLayerClientImpl::notifyAnimationStarted):
        (WebKit::OverlayGraphicsLayerClientImpl::notifySyncRequired):
        (WebKit::OverlayGraphicsLayerClientImpl::paintContents):
        (WebKit::OverlayGraphicsLayerClientImpl::showDebugBorders):
        (WebKit::OverlayGraphicsLayerClientImpl::showRepaintCounter):
        (WebKit::OverlayGraphicsLayerClientImpl::OverlayGraphicsLayerClientImpl):
        (WebKit::PageOverlay::clear):
        (WebKit::PageOverlay::update):
        (WebKit::PageOverlay::paintWebFrame):
        (WebKit::PageOverlay::invalidateWebFrame):
        * src/PageOverlay.h: Added.
        (WebKit::PageOverlay::~PageOverlay):
        (WebKit::PageOverlay::setClient):
        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::paintPageOverlay):
        (WebKit::WebDevToolsAgentImpl::highlight):
        (WebKit::WebDevToolsAgentImpl::hideHighlight):
        * src/WebDevToolsAgentImpl.h:
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrameImpl::paintWithContext):
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::WebViewImpl):
        (WebKit::WebViewImpl::setPageOverlayClient):
        (WebKit::WebViewImpl::setOverlayLayer):
        (WebKit::WebViewImpl::setRootGraphicsLayer):
        (WebKit::WebViewImpl::setRootPlatformLayer):
        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
        (WebKit::WebViewImpl::doComposite):
        (WebKit::WebViewImpl::reallocateRenderer):
        * src/WebViewImpl.h:
        (WebKit::WebViewImpl::pageOverlay):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (88581 => 88582)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-06-11 00:39:10 UTC (rev 88582)
@@ -1,3 +1,52 @@
+2011-06-10  Vsevolod Vlasov  <[email protected]>
+
+        Reviewed by James Robinson.
+
+        Web Inspector: [Chromium] DevTools does not highlight elements when accelerated compositing is on.
+        https://bugs.webkit.org/show_bug.cgi?id=62149
+
+        Added page overlay for inspector highlight support.
+
+        * WebKit.gyp:
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::attachRootGraphicsLayer):
+        * src/PageOverlay.cpp: Added.
+        (WebKit::PageOverlay::create):
+        (WebKit::PageOverlay::PageOverlay):
+        (WebKit::OverlayGraphicsLayerClientImpl::create):
+        (WebKit::OverlayGraphicsLayerClientImpl::~OverlayGraphicsLayerClientImpl):
+        (WebKit::OverlayGraphicsLayerClientImpl::notifyAnimationStarted):
+        (WebKit::OverlayGraphicsLayerClientImpl::notifySyncRequired):
+        (WebKit::OverlayGraphicsLayerClientImpl::paintContents):
+        (WebKit::OverlayGraphicsLayerClientImpl::showDebugBorders):
+        (WebKit::OverlayGraphicsLayerClientImpl::showRepaintCounter):
+        (WebKit::OverlayGraphicsLayerClientImpl::OverlayGraphicsLayerClientImpl):
+        (WebKit::PageOverlay::clear):
+        (WebKit::PageOverlay::update):
+        (WebKit::PageOverlay::paintWebFrame):
+        (WebKit::PageOverlay::invalidateWebFrame):
+        * src/PageOverlay.h: Added.
+        (WebKit::PageOverlay::~PageOverlay):
+        (WebKit::PageOverlay::setClient):
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::paintPageOverlay):
+        (WebKit::WebDevToolsAgentImpl::highlight):
+        (WebKit::WebDevToolsAgentImpl::hideHighlight):
+        * src/WebDevToolsAgentImpl.h:
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::paintWithContext):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::setPageOverlayClient):
+        (WebKit::WebViewImpl::setOverlayLayer):
+        (WebKit::WebViewImpl::setRootGraphicsLayer):
+        (WebKit::WebViewImpl::setRootPlatformLayer):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit::WebViewImpl::doComposite):
+        (WebKit::WebViewImpl::reallocateRenderer):
+        * src/WebViewImpl.h:
+        (WebKit::WebViewImpl::pageOverlay):
+
 2011-06-10  David Levin  <[email protected]>
 
         Reviewed by Dmitry Titov.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (88581 => 88582)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -393,6 +393,8 @@
                 'src/NotificationPresenterImpl.h',
                 'src/NotificationPresenterImpl.cpp',
                 'src/painting/GraphicsContextBuilder.h',
+                'src/PageOverlay.cpp',
+                'src/PageOverlay.h',
                 'src/PlatformBridge.cpp',
                 'src/PlatformMessagePortChannel.cpp',
                 'src/PlatformMessagePortChannel.h',

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -836,7 +836,7 @@
 #if USE(ACCELERATED_COMPOSITING)
 void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
 {
-    m_webView->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->platformLayer() : 0);
+    m_webView->setRootGraphicsLayer(graphicsLayer);
 }
 
 void ChromeClientImpl::scheduleCompositingLayerSync()

Added: trunk/Source/WebKit/chromium/src/PageOverlay.cpp (0 => 88582)


--- trunk/Source/WebKit/chromium/src/PageOverlay.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/PageOverlay.cpp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageOverlay.h"
+
+#include "GraphicsLayer.h"
+#include "GraphicsLayerClient.h"
+#include "Page.h"
+#include "Settings.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlayClient* client)
+{
+    return adoptPtr(new PageOverlay(viewImpl, client));
+}
+
+PageOverlay::PageOverlay(WebViewImpl* viewImpl, PageOverlayClient* client)
+    : m_viewImpl(viewImpl)
+    , m_client(client)
+{
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+class OverlayGraphicsLayerClientImpl : public WebCore::GraphicsLayerClient {
+public:
+    static PassOwnPtr<OverlayGraphicsLayerClientImpl*> create(WebViewImpl* webViewImpl, PageOverlay::PageOverlayClient* pageOverlayClient)
+    {
+        return adoptPtr(new OverlayGraphicsLayerClientImpl(webViewImpl, pageOverlayClient));
+    }
+
+    virtual ~OverlayGraphicsLayerClientImpl() { }
+
+    virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { }
+
+    virtual void notifySyncRequired(const GraphicsLayer*) { }
+
+    virtual void paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& inClip)
+    {
+        m_pageOverlayClient->paintPageOverlay(context);
+    }
+
+    virtual bool showDebugBorders() const
+    {
+        return m_webViewImpl->page()->settings()->showDebugBorders();
+    }
+
+    virtual bool showRepaintCounter() const
+    {
+        return m_webViewImpl->page()->settings()->showRepaintCounter();
+    }
+
+private:
+    explicit OverlayGraphicsLayerClientImpl(WebViewImpl* webViewImpl, PageOverlay::PageOverlayClient* pageOverlayClient)
+        : m_pageOverlayClient(pageOverlayClient)
+        , m_webViewImpl(webViewImpl)
+    {
+    }
+
+    PageOverlay::PageOverlayClient* m_pageOverlayClient;
+    WebViewImpl* m_webViewImpl;
+};
+#endif
+
+void PageOverlay::clear()
+{
+    invalidateWebFrame();
+
+#if USE(ACCELERATED_COMPOSITING)
+    if (m_layer) {
+        m_layer->removeFromParent();
+        m_layer = nullptr;
+        m_layerClient = nullptr;
+    }
+#endif
+}
+
+void PageOverlay::update()
+{
+    invalidateWebFrame();
+
+#if USE(ACCELERATED_COMPOSITING)
+    if (!m_layer) {
+        m_layerClient = OverlayGraphicsLayerClientImpl::create(m_viewImpl, m_client);
+        m_layer = GraphicsLayer::create(m_layerClient.get());
+        m_layer->setName("WebViewImpl page overlay content");
+        m_layer->setDrawsContent(true);
+        const WebSize& size = m_viewImpl->size();
+        m_layer->setSize(IntSize(size.width, size.height));
+    }
+    m_viewImpl->setOverlayLayer(m_layer.get());
+    m_layer->setNeedsDisplay();
+#endif
+}
+
+void PageOverlay::paintWebFrame(GraphicsContext& gc)
+{
+    if (!m_viewImpl->isAcceleratedCompositingActive())
+        m_client->paintPageOverlay(gc);
+}
+
+void PageOverlay::invalidateWebFrame()
+{
+    // PageOverlayClient does the actual painting of the overlay.
+    // Here we just make sure to invalidate.
+    if (!m_viewImpl->isAcceleratedCompositingActive()) {
+        // FIXME: able to invalidate a smaller rect.
+        // FIXME: Is it important to just invalidate a smaller rect given that
+        // this is not on a critical codepath? In order to do so, we'd
+        // have to take scrolling into account.
+        const WebSize& size = m_viewImpl->size();
+        WebRect damagedRect(0, 0, size.width, size.height);
+        if (m_viewImpl->client())
+            m_viewImpl->client()->didInvalidateRect(damagedRect);
+    }
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/chromium/src/PageOverlay.h (0 => 88582)


--- trunk/Source/WebKit/chromium/src/PageOverlay.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/PageOverlay.h	2011-06-11 00:39:10 UTC (rev 88582)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageOverlay_h
+#define PageOverlay_h
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+class GraphicsContext;
+class GraphicsLayer;
+class GraphicsLayerClient;
+}
+
+namespace WebKit {
+class WebViewImpl;
+
+class PageOverlay {
+public:
+    class PageOverlayClient {
+    public:
+        virtual void paintPageOverlay(WebCore::GraphicsContext&) = 0;
+    };
+
+    static PassOwnPtr<PageOverlay> create(WebViewImpl*, PageOverlayClient*);
+
+    ~PageOverlay() { }
+
+    void setClient(PageOverlayClient* client) { m_client = client; }
+
+    void clear();
+    void update();
+    void paintWebFrame(WebCore::GraphicsContext&);
+
+private:
+    PageOverlay(WebViewImpl*, PageOverlayClient*);
+    void invalidateWebFrame();
+
+    WebViewImpl* m_viewImpl;
+    PageOverlayClient* m_client;
+    OwnPtr<WebCore::GraphicsLayer> m_layer;
+    OwnPtr<WebCore::GraphicsLayerClient> m_layerClient;
+};
+
+} // namespace WebKit
+
+#endif // PageOverlay_h

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -34,12 +34,14 @@
 #include "DebuggerAgentImpl.h"
 #include "DebuggerAgentManager.h"
 #include "ExceptionCode.h"
+#include "GraphicsContext.h"
 #include "InjectedScriptHost.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorController.h"
 #include "InspectorInstrumentation.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include "PageOverlay.h"
 #include "PageScriptDebugServer.h"
 #include "PlatformString.h"
 #include "ResourceError.h"
@@ -271,24 +273,22 @@
 {
 }
 
+// PageOverlayClient
+void WebDevToolsAgentImpl::paintPageOverlay(GraphicsContext& gc)
+{
+    InspectorController* ic = inspectorController();
+    if (ic)
+        ic->drawNodeHighlight(gc);
+}
+
 void WebDevToolsAgentImpl::highlight(Node* node)
 {
-    // InspectorController does the actuall tracking of the highlighted node
-    // and the drawing of the highlight. Here we just make sure to invalidate
-    // the rects of the old and new nodes.
-    hideHighlight();
+    m_webViewImpl->setPageOverlayClient(this);
 }
 
 void WebDevToolsAgentImpl::hideHighlight()
 {
-    // FIXME: able to invalidate a smaller rect.
-    // FIXME: Is it important to just invalidate the rect of the node region
-    // given that this is not on a critical codepath?  In order to do so, we'd
-    // have to take scrolling into account.
-    const WebSize& size = m_webViewImpl->size();
-    WebRect damagedRect(0, 0, size.width, size.height);
-    if (m_webViewImpl->client())
-        m_webViewImpl->client()->didInvalidateRect(damagedRect);
+    m_webViewImpl->setPageOverlayClient(0);
 }
 
 bool WebDevToolsAgentImpl::sendMessageToFrontend(const String& message)

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h	2011-06-11 00:39:10 UTC (rev 88582)
@@ -33,6 +33,7 @@
 
 #include "InspectorClient.h"
 
+#include "PageOverlay.h"
 #include "WebDevToolsAgentPrivate.h"
 
 #include <wtf/Forward.h>
@@ -41,6 +42,7 @@
 namespace WebCore {
 class Document;
 class Frame;
+class GraphicsContext;
 class InspectorClient;
 class InspectorController;
 class Node;
@@ -60,7 +62,8 @@
 struct WebDevToolsMessageData;
 
 class WebDevToolsAgentImpl : public WebDevToolsAgentPrivate,
-                             public WebCore::InspectorClient {
+                             public WebCore::InspectorClient,
+                             public PageOverlay::PageOverlayClient {
 public:
     WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client);
     virtual ~WebDevToolsAgentImpl();
@@ -90,6 +93,9 @@
 
     int hostId() { return m_hostId; }
 
+    // PageOverlayClient
+    virtual void paintPageOverlay(WebCore::GraphicsContext&);
+
 private:
     WebCore::InspectorController* inspectorController();
     WebCore::Frame* mainFrame();

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -104,6 +104,7 @@
 #include "IconURL.h"
 #include "InspectorController.h"
 #include "Page.h"
+#include "PageOverlay.h"
 #include "painting/GraphicsContextBuilder.h"
 #include "Performance.h"
 #include "PlatformBridge.h"
@@ -2021,7 +2022,8 @@
     if (m_frame->document() && frameView()) {
         gc.clip(dirtyRect);
         frameView()->paint(&gc, dirtyRect);
-        m_frame->page()->inspectorController()->drawNodeHighlight(gc);
+        if (viewImpl()->pageOverlay())
+            viewImpl()->pageOverlay()->paintWebFrame(gc);
     } else
         gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB);
     gc.restore();

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-06-11 00:39:10 UTC (rev 88582)
@@ -329,6 +329,7 @@
     , m_dragScrollTimer(adoptPtr(new DragScrollTimer))
 #if USE(ACCELERATED_COMPOSITING)
     , m_layerRenderer(0)
+    , m_rootGraphicsLayer(0)
     , m_isAcceleratedCompositingActive(false)
     , m_compositorCreationFailed(false)
     , m_recreatingGraphicsContext(false)
@@ -2290,6 +2291,32 @@
     m_ignoreInputEvents = newValue;
 }
 
+void WebViewImpl::setPageOverlayClient(PageOverlay::PageOverlayClient* pageOverlayClient)
+{
+    if (pageOverlayClient) {
+        if (!m_pageOverlay)
+            m_pageOverlay = PageOverlay::create(this, pageOverlayClient);
+        else
+            m_pageOverlay->setClient(pageOverlayClient);
+        m_pageOverlay->update();
+        setRootLayerNeedsDisplay();
+    } else {
+        if (m_pageOverlay) {
+            m_pageOverlay->clear();
+            m_pageOverlay = nullptr;
+            setRootLayerNeedsDisplay();
+        }
+    }
+}
+
+void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer)
+{
+    if (m_rootGraphicsLayer) {
+        if (layer->parent() != m_rootGraphicsLayer)
+            m_rootGraphicsLayer->addChild(layer);
+    }
+}
+
 #if ENABLE(NOTIFICATIONS)
 NotificationPresenterImpl* WebViewImpl::notificationPresenterImpl()
 {
@@ -2372,8 +2399,14 @@
     return (style->direction() == RTL);
 }
 
-void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer)
+void WebViewImpl::setRootGraphicsLayer(WebCore::GraphicsLayer* layer)
 {
+    m_rootGraphicsLayer = layer;
+    setRootPlatformLayer(layer ? layer->platformLayer() : 0);
+}
+
+void WebViewImpl::setRootPlatformLayer(WebCore::PlatformLayer* layer)
+{
     setIsAcceleratedCompositingActive(layer);
     if (m_layerRenderer)
         m_layerRenderer->setRootLayer(layer);
@@ -2477,6 +2510,8 @@
             m_client->didActivateAcceleratedCompositing(true);
             m_isAcceleratedCompositingActive = true;
             m_compositorCreationFailed = false;
+            if (m_pageOverlay)
+                m_pageOverlay->update();
         } else {
             m_isAcceleratedCompositingActive = false;
             m_client->didActivateAcceleratedCompositing(false);
@@ -2505,6 +2540,9 @@
     hud->setShowFPSCounter(settings()->showFPSCounter());
     hud->setShowPlatformLayerTree(settings()->showPlatformLayerTree());
 
+    if (m_pageOverlay)
+        m_pageOverlay->update();
+
     m_layerRenderer->updateAndDrawLayers();
 }
 
@@ -2528,12 +2566,14 @@
         // immediately obvious that GraphicsContext3D object will not
         // function properly until its reshape method is called.
         newContext->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
-        setRootGraphicsLayer(m_layerRenderer->rootLayer());
+        setRootPlatformLayer(m_layerRenderer->rootLayer());
         // Forces ViewHostMsg_DidActivateAcceleratedCompositing to be sent so
         // that the browser process can reacquire surfaces.
         m_client->didActivateAcceleratedCompositing(true);
+        if (m_pageOverlay)
+            m_pageOverlay->update();
     } else
-        setRootGraphicsLayer(0);
+        setRootPlatformLayer(0);
 }
 #endif
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (88581 => 88582)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-06-11 00:38:26 UTC (rev 88581)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-06-11 00:39:10 UTC (rev 88582)
@@ -48,6 +48,7 @@
 #include "IntRect.h"
 #include "LayerRendererChromium.h"
 #include "NotificationPresenterImpl.h"
+#include "PageOverlay.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -206,6 +207,11 @@
     void setIgnoreInputEvents(bool newValue);
     WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get(); }
 
+    PageOverlay* pageOverlay() const { return m_pageOverlay.get(); }
+    void setPageOverlayClient(PageOverlay::PageOverlayClient*);
+
+    void setOverlayLayer(WebCore::GraphicsLayer*);
+
     const WebPoint& lastMouseDownPoint() const
     {
         return m_lastMouseDownPoint;
@@ -345,7 +351,8 @@
 #if USE(ACCELERATED_COMPOSITING)
     bool allowsAcceleratedCompositing();
     bool pageHasRTLStyle() const;
-    void setRootGraphicsLayer(WebCore::PlatformLayer*);
+    void setRootGraphicsLayer(WebCore::GraphicsLayer*);
+    void setRootPlatformLayer(WebCore::PlatformLayer*);
     void setRootLayerNeedsDisplay();
     void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
     void invalidateRootLayerRect(const WebCore::IntRect&);
@@ -508,6 +515,7 @@
     RefPtr<WebCore::PopupContainer> m_selectPopup;
 
     OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent;
+    OwnPtr<PageOverlay> m_pageOverlay;
 
     // Whether the webview is rendering transparently.
     bool m_isTransparent;
@@ -533,6 +541,7 @@
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::IntRect m_rootLayerScrollDamage;
     RefPtr<WebCore::LayerRendererChromium> m_layerRenderer;
+    WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;
     bool m_compositorCreationFailed;
     // If true, the graphics context is being restored.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to