Title: [124160] trunk/Source
Revision
124160
Author
[email protected]
Date
2012-07-30 20:02:52 -0700 (Mon, 30 Jul 2012)

Log Message

[chromium] Wrap ScrollbarLayerChromium in WebScrollbarLayer
https://bugs.webkit.org/show_bug.cgi?id=91032

Reviewed by James Robinson.

Source/Platform:

Add WebScrollbarLayer class to the Platform API.

* Platform.gypi:
* chromium/public/WebScrollbarLayer.h: Added.
(WebCore):
(WebKit):
(WebScrollbarLayer):
(WebKit::WebScrollbarLayer::WebScrollbarLayer):
(WebKit::WebScrollbarLayer::~WebScrollbarLayer):
(WebKit::WebScrollbarLayer::operator=):

Source/WebCore:

Modify ScrollingCoordinatorChromium to operate on WebScrollbarLayer
instead of ScrollbarLayerChromium. This removes the dependency on
ScrollbarLayerChromium.

No change in functionality, so no new tests.

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(ScrollingCoordinatorPrivate):
(WebCore::createScrollbarLayer):

Source/WebKit/chromium:

Add implementation of WebScrollbarLayer to the client API.

* WebKit.gyp:
* src/WebScrollbarLayer.cpp: Added.
(WebKit):
(WebKit::WebScrollbarLayer::setScrollLayer):
(WebKit::WebScrollbarLayer::create):
(WebKit::WebScrollbarLayer::WebScrollbarLayer):
(WebKit::WebScrollbarLayer::operator=):
(WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (124159 => 124160)


--- trunk/Source/Platform/ChangeLog	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/Platform/ChangeLog	2012-07-31 03:02:52 UTC (rev 124160)
@@ -1,3 +1,21 @@
+2012-07-30  Adrienne Walker  <[email protected]>
+
+        [chromium] Wrap ScrollbarLayerChromium in WebScrollbarLayer
+        https://bugs.webkit.org/show_bug.cgi?id=91032
+
+        Reviewed by James Robinson.
+
+        Add WebScrollbarLayer class to the Platform API.
+
+        * Platform.gypi:
+        * chromium/public/WebScrollbarLayer.h: Added.
+        (WebCore):
+        (WebKit):
+        (WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::~WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::operator=):
+
 2012-06-29  James Robinson  <[email protected]>
 
         [chromium] Remove WebTransformationMatrix::mapPoint overrides

Modified: trunk/Source/Platform/Platform.gypi (124159 => 124160)


--- trunk/Source/Platform/Platform.gypi	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/Platform/Platform.gypi	2012-07-31 03:02:52 UTC (rev 124160)
@@ -109,6 +109,7 @@
             'chromium/public/WebReferrerPolicy.h',
             'chromium/public/WebRenderingStats.h',
             'chromium/public/WebScrollbar.h',
+            'chromium/public/WebScrollbarLayer.h',
             'chromium/public/WebScrollbarThemeGeometry.h',
             'chromium/public/WebScrollbarThemePainter.h',
             'chromium/public/WebSessionDescriptionDescriptor.h',

Added: trunk/Source/Platform/chromium/public/WebScrollbarLayer.h (0 => 124160)


--- trunk/Source/Platform/chromium/public/WebScrollbarLayer.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebScrollbarLayer.h	2012-07-31 03:02:52 UTC (rev 124160)
@@ -0,0 +1,63 @@
+/*
+ * 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 WebScrollbarLayer_h
+#define WebScrollbarLayer_h
+
+#include "WebLayer.h"
+#include "WebScrollbarThemeGeometry.h"
+#include "WebScrollbarThemePainter.h"
+
+namespace WebCore {
+class Scrollbar;
+class ScrollbarLayerChromium;
+}
+
+namespace WebKit {
+
+class WebScrollbarLayer : public WebLayer {
+public:
+    WebScrollbarLayer() { }
+    WebScrollbarLayer(const WebScrollbarLayer& layer) : WebLayer(layer) { }
+    virtual ~WebScrollbarLayer() { }
+    WebScrollbarLayer& operator=(const WebScrollbarLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
+
+    WEBKIT_EXPORT void setScrollLayer(const WebLayer);
+
+#if WEBKIT_IMPLEMENTATION
+    static WebScrollbarLayer create(WebCore::Scrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry);
+    explicit WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
+    WebScrollbarLayer& operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
+    operator WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>() const;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebScrollbarLayer_h

Modified: trunk/Source/WebCore/ChangeLog (124159 => 124160)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 03:02:52 UTC (rev 124160)
@@ -1,3 +1,23 @@
+2012-07-30  Adrienne Walker  <[email protected]>
+
+        [chromium] Wrap ScrollbarLayerChromium in WebScrollbarLayer
+        https://bugs.webkit.org/show_bug.cgi?id=91032
+
+        Reviewed by James Robinson.
+
+        Modify ScrollingCoordinatorChromium to operate on WebScrollbarLayer
+        instead of ScrollbarLayerChromium. This removes the dependency on
+        ScrollbarLayerChromium.
+
+        No change in functionality, so no new tests.
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+        (ScrollingCoordinatorPrivate):
+        (WebCore::createScrollbarLayer):
+
 2012-07-30  Ryosuke Niwa  <[email protected]>
 
         Another Qt build fix attempt after r124098.

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


--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-07-31 03:02:52 UTC (rev 124160)
@@ -33,16 +33,17 @@
 #include "Region.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
-#include "ScrollbarLayerChromium.h"
 #include "ScrollbarThemeComposite.h"
 #include "cc/CCProxy.h"
 #include <public/WebScrollableLayer.h>
 #include <public/WebScrollbar.h>
+#include <public/WebScrollbarLayer.h>
 #include <public/WebScrollbarThemeGeometry.h>
 #include <public/WebScrollbarThemePainter.h>
 
 using WebKit::WebLayer;
 using WebKit::WebScrollableLayer;
+using WebKit::WebScrollbarLayer;
 
 namespace WebCore {
 
@@ -56,19 +57,18 @@
     {
         m_scrollLayer = layer;
 
-        int id = layer.isNull() ? 0 : layer.unwrap<LayerChromium>()->id();
         if (!m_horizontalScrollbarLayer.isNull())
-            m_horizontalScrollbarLayer.unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+            m_horizontalScrollbarLayer.setScrollLayer(layer);
         if (!m_verticalScrollbarLayer.isNull())
-            m_verticalScrollbarLayer.unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+            m_verticalScrollbarLayer.setScrollLayer(layer);
     }
 
-    void setHorizontalScrollbarLayer(WebLayer layer)
+    void setHorizontalScrollbarLayer(WebScrollbarLayer layer)
     {
         m_horizontalScrollbarLayer = layer;
     }
 
-    void setVerticalScrollbarLayer(WebLayer layer)
+    void setVerticalScrollbarLayer(WebScrollbarLayer layer)
     {
         m_verticalScrollbarLayer = layer;
     }
@@ -78,8 +78,8 @@
 
 private:
     WebScrollableLayer m_scrollLayer;
-    WebLayer m_horizontalScrollbarLayer;
-    WebLayer m_verticalScrollbarLayer;
+    WebScrollbarLayer m_horizontalScrollbarLayer;
+    WebScrollbarLayer m_verticalScrollbarLayer;
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -111,7 +111,7 @@
 #endif
 }
 
-static WebLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
@@ -137,23 +137,22 @@
     if (!platformSupported || scrollbar->isOverlayScrollbar() || scrollbar->isCustomScrollbar()) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
-        return WebLayer();
+        return WebScrollbarLayer();
     }
 
     // All Chromium scrollbar themes derive from ScrollbarThemeComposite.
     ScrollbarThemeComposite* themeComposite = static_cast<ScrollbarThemeComposite*>(scrollbar->theme());
-
-    // ScrollbarLayerChromium owns the WebScrollbar
-    OwnPtr<WebKit::WebScrollbar> webScrollbar = WebKit::WebScrollbar::create(scrollbar);
     WebKit::WebScrollbarThemePainter painter(themeComposite);
     WebKit::WebScrollbarThemeGeometry geometry(themeComposite);
 
-    RefPtr<ScrollbarLayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(webScrollbar.release(), painter, geometry, scrollLayer.unwrap<LayerChromium>()->id());
-    scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer.get());
+    WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry);
+    scrollbarLayer.setScrollLayer(scrollLayer);
+
+    scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer.unwrap<LayerChromium>());
     scrollbarGraphicsLayer->setDrawsContent(false);
-    scrollbarLayer->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+    scrollbarLayer.setOpaque(scrollbarGraphicsLayer->contentsOpaque());
 
-    return WebLayer(scrollbarLayer.release());
+    return scrollbarLayer;
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)

Modified: trunk/Source/WebKit/chromium/ChangeLog (124159 => 124160)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-31 03:02:52 UTC (rev 124160)
@@ -1,3 +1,21 @@
+2012-07-30  Adrienne Walker  <[email protected]>
+
+        [chromium] Wrap ScrollbarLayerChromium in WebScrollbarLayer
+        https://bugs.webkit.org/show_bug.cgi?id=91032
+
+        Reviewed by James Robinson.
+
+        Add implementation of WebScrollbarLayer to the client API.
+
+        * WebKit.gyp:
+        * src/WebScrollbarLayer.cpp: Added.
+        (WebKit):
+        (WebKit::WebScrollbarLayer::setScrollLayer):
+        (WebKit::WebScrollbarLayer::create):
+        (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::operator=):
+        (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):
+
 2012-07-30  Sadrul Habib Chowdhury  <[email protected]>
 
         Propagate gesture events to plugins.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (124159 => 124160)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-07-31 02:57:28 UTC (rev 124159)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-07-31 03:02:52 UTC (rev 124160)
@@ -630,6 +630,7 @@
                 'src/WebScopedMicrotaskSuppression.cpp',
                 'src/WebScopedUserGesture.cpp',
                 'src/WebScriptController.cpp',
+                'src/WebScrollbarLayer.cpp',
                 'src/WebScrollableLayer.cpp',
                 'src/WebScrollbarImpl.cpp',
                 'src/WebScrollbarImpl.h',

Added: trunk/Source/WebKit/chromium/src/WebScrollbarLayer.cpp (0 => 124160)


--- trunk/Source/WebKit/chromium/src/WebScrollbarLayer.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebScrollbarLayer.cpp	2012-07-31 03:02:52 UTC (rev 124160)
@@ -0,0 +1,62 @@
+/*
+ * 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/WebScrollbarLayer.h>
+
+#include "ScrollbarLayerChromium.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebScrollbarLayer::setScrollLayer(const WebLayer layer)
+{
+    int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id();
+    unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+}
+
+WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry geometry)
+{
+    return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
+}
+
+WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+    : WebLayer(layer)
+{
+}
+
+WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+{
+    m_private = layer;
+    return *this;
+}
+
+WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const
+{
+    return unwrap<ScrollbarLayerChromium>();
+}
+
+} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to