Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / PageOverlay.cpp
index d9583aa..60463ae 100644 (file)
  */
 
 #include "config.h"
-#include "PageOverlay.h"
+#include "web/PageOverlay.h"
 
-#include "WebPageOverlay.h"
-#include "WebViewClient.h"
-#include "WebViewImpl.h"
-#include "core/page/Page.h"
 #include "core/frame/Settings.h"
+#include "core/page/Page.h"
+#include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/GraphicsLayerClient.h"
 #include "public/platform/WebLayer.h"
-
-using namespace WebCore;
+#include "public/web/WebPageOverlay.h"
+#include "public/web/WebViewClient.h"
+#include "web/WebViewImpl.h"
 
 namespace blink {
 
@@ -63,7 +62,7 @@ PageOverlay::PageOverlay(WebViewImpl* viewImpl, WebPageOverlay* overlay)
 {
 }
 
-class OverlayGraphicsLayerClientImpl : public WebCore::GraphicsLayerClient {
+class OverlayGraphicsLayerClientImpl : public GraphicsLayerClient {
 public:
     static PassOwnPtr<OverlayGraphicsLayerClientImpl> create(WebPageOverlay* overlay)
     {
@@ -72,7 +71,7 @@ public:
 
     virtual ~OverlayGraphicsLayerClientImpl() { }
 
-    virtual void notifyAnimationStarted(const GraphicsLayer*, double wallClockTime, double monotonicTime) OVERRIDE { }
+    virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime) OVERRIDE { }
 
     virtual void paintContents(const GraphicsLayer*, GraphicsContext& gc, GraphicsLayerPaintingPhase, const IntRect& inClip)
     {
@@ -101,6 +100,8 @@ void PageOverlay::clear()
 
     if (m_layer) {
         m_layer->removeFromParent();
+        if (Page* page = m_viewImpl->page())
+            page->inspectorController().didRemovePageOverlay(m_layer.get());
         m_layer = nullptr;
         m_layerClient = nullptr;
     }
@@ -115,14 +116,12 @@ void PageOverlay::update()
         m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_layerClient.get());
         m_layer->setDrawsContent(true);
 
-        // Compositor hit-testing does not know how to deal with layers that may be
-        // transparent to events (see http://crbug.com/269598). So require
-        // scrolling and touches on this layer to go to the main thread.
+        if (Page* page = m_viewImpl->page())
+            page->inspectorController().willAddPageOverlay(m_layer.get());
+
+        // This is required for contents of overlay to stay in sync with the page while scrolling.
         WebLayer* platformLayer = m_layer->platformLayer();
         platformLayer->setShouldScrollOnMainThread(true);
-        WebVector<WebRect> webRects(static_cast<size_t>(1));
-        webRects[0] = WebRect(0, 0, INT_MAX, INT_MAX);
-        platformLayer->setTouchEventHandlerRegion(webRects);
     }
 
     FloatSize size(m_viewImpl->size());