Title: [121284] trunk/Source
Revision
121284
Author
jam...@google.com
Date
2012-06-26 13:17:09 -0700 (Tue, 26 Jun 2012)

Log Message

[chromium] Add WebLayer API for scrolling
https://bugs.webkit.org/show_bug.cgi?id=89913

Reviewed by Adrienne Walker.

Source/Platform:

Adds WebScrollableLayer type to represent a layer that can be scrolled by the user. Currently WebContentLayers
are scrollable and no other layer types are, although this might change in the future.

* chromium/public/WebContentLayer.h:
(WebKit::WebContentLayer::WebContentLayer):
* chromium/public/WebLayer.h:
(WebLayer):
* chromium/public/WebScrollableLayer.h:
(WebKit):
(WebScrollableLayer):
(WebKit::WebScrollableLayer::WebScrollableLayer):
(WebKit::WebScrollableLayer::~WebScrollableLayer):
(WebKit::WebScrollableLayer::operator=):

Source/WebCore:

Use new WebScrollableLayer type in ScrollingCoordinatorChromium. This file peeks "under the hood" a fair amount
since we don't have WebLayer API for scrollbar layers yet.

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::scrollLayer):
(ScrollingCoordinatorPrivate):
(WebCore::createScrollbarLayer):
(WebCore::ScrollingCoordinator::setScrollLayer):
(WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):

Source/WebKit/chromium:

Use WebScrollableLayer type in NonCompositedContentHost.

* WebKit.gyp:
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::setScrollLayer):
(WebKit::reserveScrollbarLayers):
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::haveScrollLayer):
(WebKit):
(WebKit::NonCompositedContentHost::scrollLayer):
* src/NonCompositedContentHost.h:
(WebCore):
* src/WebContentLayer.cpp:
(WebKit::WebContentLayer::WebContentLayer):
* src/WebLayer.cpp:
(WebKit::WebLayer::numberOfChildren):
(WebKit):
(WebKit::WebLayer::childAt):
(WebKit::WebLayer::setAlwaysReserveTextures):
* src/WebScrollableLayer.cpp:
(WebKit):
(WebKit::WebScrollableLayer::setScrollPosition):
(WebKit::WebScrollableLayer::setScrollable):
(WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
(WebKit::WebScrollableLayer::setShouldScrollOnMainThread):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (121283 => 121284)


--- trunk/Source/Platform/ChangeLog	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/Platform/ChangeLog	2012-06-26 20:17:09 UTC (rev 121284)
@@ -1,3 +1,24 @@
+2012-06-25  James Robinson  <jam...@chromium.org>
+
+        [chromium] Add WebLayer API for scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=89913
+
+        Reviewed by Adrienne Walker.
+
+        Adds WebScrollableLayer type to represent a layer that can be scrolled by the user. Currently WebContentLayers
+        are scrollable and no other layer types are, although this might change in the future.
+
+        * chromium/public/WebContentLayer.h:
+        (WebKit::WebContentLayer::WebContentLayer):
+        * chromium/public/WebLayer.h:
+        (WebLayer):
+        * chromium/public/WebScrollableLayer.h:
+        (WebKit):
+        (WebScrollableLayer):
+        (WebKit::WebScrollableLayer::WebScrollableLayer):
+        (WebKit::WebScrollableLayer::~WebScrollableLayer):
+        (WebKit::WebScrollableLayer::operator=):
+
 2012-06-25  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r121176.

Modified: trunk/Source/Platform/chromium/public/WebContentLayer.h (121283 => 121284)


--- trunk/Source/Platform/chromium/public/WebContentLayer.h	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/Platform/chromium/public/WebContentLayer.h	2012-06-26 20:17:09 UTC (rev 121284)
@@ -27,7 +27,7 @@
 #define WebContentLayer_h
 
 #include "WebCommon.h"
-#include "WebLayer.h"
+#include "WebScrollableLayer.h"
 
 namespace WebCore {
 class ContentLayerChromium;
@@ -37,12 +37,12 @@
 class WebContentLayerClient;
 class WebContentLayerImpl;
 
-class WebContentLayer : public WebLayer {
+class WebContentLayer : public WebScrollableLayer {
 public:
     WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*);
 
     WebContentLayer() { }
-    WebContentLayer(const WebContentLayer& layer) : WebLayer(layer) { }
+    WebContentLayer(const WebContentLayer& layer) : WebScrollableLayer(layer) { }
     virtual ~WebContentLayer() { }
     WebContentLayer& operator=(const WebContentLayer& layer)
     {

Modified: trunk/Source/Platform/chromium/public/WebLayer.h (121283 => 121284)


--- trunk/Source/Platform/chromium/public/WebLayer.h	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/Platform/chromium/public/WebLayer.h	2012-06-26 20:17:09 UTC (rev 121284)
@@ -65,6 +65,9 @@
 
     WEBKIT_EXPORT WebLayer rootLayer() const;
     WEBKIT_EXPORT WebLayer parent() const;
+    WEBKIT_EXPORT size_t numberOfChildren() const;
+    WEBKIT_EXPORT WebLayer childAt(size_t) const;
+
     WEBKIT_EXPORT void addChild(const WebLayer&);
     WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index);
     WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer);
@@ -134,6 +137,11 @@
     WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
     WEBKIT_EXPORT void setDebugBorderWidth(float);
 
+    // DEPRECATED.
+    // This requests that this layer's compositor-managed textures always be reserved
+    // when determining texture limits.
+    WEBKIT_EXPORT void setAlwaysReserveTextures(bool);
+
     // Forces this layer to use a render surface. There is no benefit in doing
     // so, but this is to facilitate benchmarks and tests.
     WEBKIT_EXPORT void setForceRenderSurface(bool);

Copied: trunk/Source/Platform/chromium/public/WebScrollableLayer.h (from rev 121283, trunk/Source/WebKit/chromium/src/WebContentLayer.cpp) (0 => 121284)


--- trunk/Source/Platform/chromium/public/WebScrollableLayer.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebScrollableLayer.h	2012-06-26 20:17:09 UTC (rev 121284)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 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 APPLE 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 APPLE 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 WebScrollableLayer_h
+#define WebScrollableLayer_h
+
+#include "WebCommon.h"
+#include "WebLayer.h"
+#include "WebPoint.h"
+
+namespace WebKit {
+
+class WebScrollableLayer : public WebLayer {
+public:
+    WebScrollableLayer() { }
+    WebScrollableLayer(const WebScrollableLayer& layer) : WebLayer(layer) { }
+    virtual ~WebScrollableLayer() { }
+    WebScrollableLayer& operator=(const WebScrollableLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
+
+    WEBKIT_EXPORT void setScrollPosition(WebPoint);
+    WEBKIT_EXPORT void setScrollable(bool);
+    WEBKIT_EXPORT void setHaveWheelEventHandlers(bool);
+    WEBKIT_EXPORT void setShouldScrollOnMainThread(bool);
+
+#if WEBKIT_IMPLEMENTATION
+    WebScrollableLayer(const WTF::PassRefPtr<WebCore::LayerChromium>& layer) : WebLayer(layer) { }
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebScrollableLayer_h

Modified: trunk/Source/WebCore/ChangeLog (121283 => 121284)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 20:17:09 UTC (rev 121284)
@@ -1,3 +1,26 @@
+2012-06-25  James Robinson  <jam...@chromium.org>
+
+        [chromium] Add WebLayer API for scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=89913
+
+        Reviewed by Adrienne Walker.
+
+        Use new WebScrollableLayer type in ScrollingCoordinatorChromium. This file peeks "under the hood" a fair amount
+        since we don't have WebLayer API for scrollbar layers yet.
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+        (ScrollingCoordinatorPrivate):
+        (WebCore::createScrollbarLayer):
+        (WebCore::ScrollingCoordinator::setScrollLayer):
+        (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+        (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+        (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+
 2012-06-26  James Robinson  <jam...@chromium.org>
 
         Unreviewed, rolling out r120501.

Modified: trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp (121283 => 121284)


--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -36,7 +36,11 @@
 #include "ScrollbarLayerChromium.h"
 #include "ScrollbarTheme.h"
 #include "cc/CCProxy.h"
+#include <public/WebScrollableLayer.h>
 
+using WebKit::WebLayer;
+using WebKit::WebScrollableLayer;
+
 namespace WebCore {
 
 class ScrollingCoordinatorPrivate {
@@ -45,33 +49,34 @@
     ScrollingCoordinatorPrivate() { }
     ~ScrollingCoordinatorPrivate() { }
 
-    void setScrollLayer(LayerChromium* layer)
+    void setScrollLayer(WebScrollableLayer layer)
     {
         m_scrollLayer = layer;
 
-        int id = layer ? layer->id() : 0;
-        if (m_horizontalScrollbarLayer)
-            m_horizontalScrollbarLayer->setScrollLayerId(id);
-        if (m_verticalScrollbarLayer)
-            m_verticalScrollbarLayer->setScrollLayerId(id);
+        int id = layer.isNull() ? 0 : layer.unwrap<LayerChromium>()->id();
+        if (!m_horizontalScrollbarLayer.isNull())
+            m_horizontalScrollbarLayer.unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+        if (!m_verticalScrollbarLayer.isNull())
+            m_verticalScrollbarLayer.unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
     }
 
-    void setHorizontalScrollbarLayer(PassRefPtr<ScrollbarLayerChromium> layer)
+    void setHorizontalScrollbarLayer(WebLayer layer)
     {
         m_horizontalScrollbarLayer = layer;
     }
 
-    void setVerticalScrollbarLayer(PassRefPtr<ScrollbarLayerChromium> layer)
+    void setVerticalScrollbarLayer(WebLayer layer)
     {
         m_verticalScrollbarLayer = layer;
     }
 
-    LayerChromium* scrollLayer() const { return m_scrollLayer.get(); }
+    bool hasScrollLayer() const { return !m_scrollLayer.isNull(); }
+    WebScrollableLayer scrollLayer() const { return m_scrollLayer; }
 
 private:
-    RefPtr<LayerChromium> m_scrollLayer;
-    RefPtr<ScrollbarLayerChromium> m_horizontalScrollbarLayer;
-    RefPtr<ScrollbarLayerChromium> m_verticalScrollbarLayer;
+    WebScrollableLayer m_scrollLayer;
+    WebLayer m_horizontalScrollbarLayer;
+    WebLayer m_verticalScrollbarLayer;
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -103,15 +108,15 @@
 #endif
 }
 
-static PassRefPtr<ScrollbarLayerChromium> createScrollbarLayer(Scrollbar* scrollbar, LayerChromium* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
 
-    if (!scrollLayer) {
+    if (scrollLayer.isNull()) {
         // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
-        scrollLayer = scrollLayerForFrameView(frameView)->platformLayer();
-        ASSERT(scrollLayer);
+        scrollLayer = WebScrollableLayer(scrollLayerForFrameView(frameView)->platformLayer());
+        ASSERT(!scrollLayer.isNull());
     }
 
     // Root layer non-overlay scrollbars should be marked opaque to disable
@@ -129,15 +134,15 @@
     if (!platformSupported || scrollbar->isOverlayScrollbar()) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
-        return 0;
+        return WebLayer();
     }
 
-    RefPtr<ScrollbarLayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar, scrollLayer->id());
+    RefPtr<ScrollbarLayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar, scrollLayer.unwrap<LayerChromium>()->id());
     scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer.get());
     scrollbarGraphicsLayer->setDrawsContent(false);
     scrollbarLayer->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
 
-    return scrollbarLayer.release();
+    return WebLayer(scrollbarLayer.release());
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
@@ -158,13 +163,13 @@
 
 void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
 {
-    m_private->setScrollLayer(scrollLayer ? scrollLayer->platformLayer() : 0);
+    m_private->setScrollLayer(WebScrollableLayer(scrollLayer ? scrollLayer->platformLayer() : 0));
 }
 
 void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
 {
-    if (LayerChromium* layer = m_private->scrollLayer())
-        layer->setNonFastScrollableRegion(region);
+    if (m_private->hasScrollLayer())
+        m_private->scrollLayer().unwrap<LayerChromium>()->setNonFastScrollableRegion(region);
 }
 
 void ScrollingCoordinator::setScrollParameters(const ScrollParameters&)
@@ -174,14 +179,14 @@
 
 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
 {
-    if (LayerChromium* layer = m_private->scrollLayer())
-        layer->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
+    if (m_private->hasScrollLayer())
+        m_private->scrollLayer().setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
 }
 
 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
 {
-    if (LayerChromium* layer = m_private->scrollLayer())
-        layer->setShouldScrollOnMainThread(should);
+    if (m_private->hasScrollLayer())
+        m_private->scrollLayer().setShouldScrollOnMainThread(should);
 }
 
 bool ScrollingCoordinator::supportsFixedPositionLayers() const

Modified: trunk/Source/WebKit/chromium/ChangeLog (121283 => 121284)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-26 20:17:09 UTC (rev 121284)
@@ -1,3 +1,36 @@
+2012-06-25  James Robinson  <jam...@chromium.org>
+
+        [chromium] Add WebLayer API for scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=89913
+
+        Reviewed by Adrienne Walker.
+
+        Use WebScrollableLayer type in NonCompositedContentHost.
+
+        * WebKit.gyp:
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::setScrollLayer):
+        (WebKit::reserveScrollbarLayers):
+        (WebKit::NonCompositedContentHost::setViewport):
+        (WebKit::NonCompositedContentHost::haveScrollLayer):
+        (WebKit):
+        (WebKit::NonCompositedContentHost::scrollLayer):
+        * src/NonCompositedContentHost.h:
+        (WebCore):
+        * src/WebContentLayer.cpp:
+        (WebKit::WebContentLayer::WebContentLayer):
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::numberOfChildren):
+        (WebKit):
+        (WebKit::WebLayer::childAt):
+        (WebKit::WebLayer::setAlwaysReserveTextures):
+        * src/WebScrollableLayer.cpp:
+        (WebKit):
+        (WebKit::WebScrollableLayer::setScrollPosition):
+        (WebKit::WebScrollableLayer::setScrollable):
+        (WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
+        (WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
+
 2012-06-26  Ian Vollick  <voll...@chromium.org>
 
         [chromium] The single thread proxy should not automatically tick new animations.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (121283 => 121284)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -623,6 +623,7 @@
                 'src/WebScopedMicrotaskSuppression.cpp',
                 'src/WebScopedUserGesture.cpp',
                 'src/WebScriptController.cpp',
+                'src/WebScrollableLayer.cpp',
                 'src/WebScrollbarImpl.cpp',
                 'src/WebScrollbarImpl.h',
                 'src/WebSearchableFormData.cpp',

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (121283 => 121284)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -34,6 +34,7 @@
 #include "PlatformContextSkia.h"
 #include "WebViewImpl.h"
 #include "cc/CCLayerTreeHost.h"
+#include <public/WebFloatPoint.h>
 
 namespace WebKit {
 
@@ -80,41 +81,41 @@
         return;
     }
 
-    if (layer->platformLayer() == scrollLayer())
+    if (WebScrollableLayer(layer->platformLayer()) == scrollLayer())
         return;
 
     layer->addChildAtIndex(m_graphicsLayer.get(), 0);
-    ASSERT(scrollLayer());
+    ASSERT(haveScrollLayer());
 }
 
-static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::LayerChromium* clipLayer)
+static void reserveScrollbarLayers(WebLayer layer, WebLayer clipLayer)
 {
     // Scrollbars and corners are known to be attached outside the root clip
     // rect, so skip the clipLayer subtree.
     if (layer == clipLayer)
         return;
 
-    for (size_t i = 0; i < layer->children().size(); ++i)
-        reserveScrollbarLayers(layer->children()[i].get(), clipLayer);
+    for (size_t i = 0; i < layer.numberOfChildren(); ++i)
+        reserveScrollbarLayers(layer.childAt(i), clipLayer);
 
-    if (layer->drawsContent())
-        layer->setAlwaysReserveTextures(true);
+    if (layer.drawsContent())
+        layer.setAlwaysReserveTextures(true);
 }
 
 void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale)
 {
-    if (!scrollLayer())
+    if (!haveScrollLayer())
         return;
 
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
-
-    scrollLayer()->setScrollPosition(scrollPosition + toSize(scrollOrigin));
-    scrollLayer()->setPosition(-scrollPosition);
+    WebScrollableLayer layer = scrollLayer();
+    layer.setScrollPosition(scrollPosition + scrollOrigin);
+    layer.setPosition(WebFloatPoint(-scrollPosition));
     // Due to the possibility of pinch zoom, the noncomposited layer is always
     // assumed to be scrollable.
-    scrollLayer()->setScrollable(true);
+    layer.setScrollable(true);
     m_deviceScaleFactor = deviceScale;
     m_graphicsLayer->deviceOrPageScaleFactorChanged();
     m_graphicsLayer->setSize(contentsSize);
@@ -135,18 +136,23 @@
     } else if (visibleRectChanged)
         m_graphicsLayer->setNeedsDisplay();
 
-    WebCore::LayerChromium* clipLayer = scrollLayer()->parent();
-    WebCore::LayerChromium* rootLayer = clipLayer;
-    while (rootLayer->parent())
-        rootLayer = rootLayer->parent();
+    WebLayer clipLayer = layer.parent();
+    WebLayer rootLayer = clipLayer;
+    while (!rootLayer.parent().isNull())
+        rootLayer = rootLayer.parent();
     reserveScrollbarLayers(rootLayer, clipLayer);
 }
 
-WebCore::LayerChromium* NonCompositedContentHost::scrollLayer()
+bool NonCompositedContentHost::haveScrollLayer()
 {
+    return m_graphicsLayer->parent();
+}
+
+WebScrollableLayer NonCompositedContentHost::scrollLayer()
+{
     if (!m_graphicsLayer->parent())
-        return 0;
-    return m_graphicsLayer->parent()->platformLayer();
+        return WebScrollableLayer();
+    return WebScrollableLayer(m_graphicsLayer->parent()->platformLayer());
 }
 
 void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h (121283 => 121284)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	2012-06-26 20:17:09 UTC (rev 121284)
@@ -29,6 +29,7 @@
 #include "GraphicsLayerClient.h"
 #include "IntSize.h"
 
+#include <public/WebScrollableLayer.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -39,7 +40,6 @@
 class GraphicsContext;
 class IntPoint;
 class IntRect;
-class LayerChromium;
 }
 
 namespace WebKit {
@@ -79,7 +79,8 @@
     // size, so it is always 1 for the GraphicsLayer.
     virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; }
 
-    WebCore::LayerChromium* scrollLayer();
+    bool haveScrollLayer();
+    WebScrollableLayer scrollLayer();
 
     OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
     WebViewImpl* m_webView;

Modified: trunk/Source/WebKit/chromium/src/WebContentLayer.cpp (121283 => 121284)


--- trunk/Source/WebKit/chromium/src/WebContentLayer.cpp	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/src/WebContentLayer.cpp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -54,7 +54,7 @@
 }
 
 WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node)
-    : WebLayer(node)
+    : WebScrollableLayer(node)
 {
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebLayer.cpp (121283 => 121284)


--- trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-06-26 20:09:31 UTC (rev 121283)
+++ trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -118,6 +118,16 @@
     return WebLayer(const_cast<LayerChromium*>(m_private->parent()));
 }
 
+size_t WebLayer::numberOfChildren() const
+{
+    return m_private->children().size();
+}
+
+WebLayer WebLayer::childAt(size_t index) const
+{
+    return WebLayer(m_private->children()[index]);
+}
+
 void WebLayer::addChild(const WebLayer& child)
 {
     m_private->addChild(child);
@@ -300,6 +310,11 @@
     m_private->setDebugBorderWidth(width);
 }
 
+void WebLayer::setAlwaysReserveTextures(bool reserve)
+{
+    m_private->setAlwaysReserveTextures(reserve);
+}
+
 void WebLayer::setForceRenderSurface(bool forceRenderSurface)
 {
     m_private->setForceRenderSurface(forceRenderSurface);

Copied: trunk/Source/WebKit/chromium/src/WebScrollableLayer.cpp (from rev 121283, trunk/Source/WebKit/chromium/src/WebContentLayer.cpp) (0 => 121284)


--- trunk/Source/WebKit/chromium/src/WebScrollableLayer.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebScrollableLayer.cpp	2012-06-26 20:17:09 UTC (rev 121284)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 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 APPLE 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 APPLE 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 <public/WebScrollableLayer.h>
+
+#include "LayerChromium.h"
+
+
+namespace WebKit {
+
+void WebScrollableLayer::setScrollPosition(WebPoint position)
+{
+    m_private->setScrollPosition(position);
+}
+
+void WebScrollableLayer::setScrollable(bool scrollable)
+{
+    m_private->setScrollable(scrollable);
+}
+
+void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
+{
+    m_private->setHaveWheelEventHandlers(haveWheelEventHandlers);
+}
+
+void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
+{
+    m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread);
+}
+
+} // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to