[BlackBerry] Extend composited in-region scrolling to iframes/frames
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2012 17:22:13 +0000 (17:22 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2012 17:22:13 +0000 (17:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97922
PR #197093

Reviewed by Yong Li.
Patch by Antonio Gomes <agomes@rim.com>
Internaly reviewed by Arvid Nilsson.

Add support for composited scrolling in a inner frame level:

1) When creating an InRegionScrollableArea, for a inner scrollable frame,
cache and camouflag the appropriated scroll layer (i.e. RenderLayerCompositor::scrollLayer);

2) Differentiate what type of scroll target we are at: BlockElement or
InnerFrame;

3) Change the signature of the public methods to support and newly passed
in ScrollTarget parameter;
As a side note, this parameter is needed in order to know what class to static_cast
the GraphicsLayer::client to: in the case of a composited scrollable inner frame, the client
is a RenderLayerCompositor; in case of a composited scrollable block element, the client
is a RenderLayerBacking.

* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScroller::setScrollPositionWebKitThread):
(BlackBerry::WebKit::InRegionScrollerPrivate::setScrollPositionWebKitThread):
* Api/InRegionScroller.h:
* Api/InRegionScroller_p.h:
(InRegionScrollerPrivate):
* WebCoreSupport/ChromeClientBlackBerry.h:
(WebCore::ChromeClientBlackBerry::allowedCompositingTriggers):
* WebKitSupport/InRegionScrollableArea.cpp:
(BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129916 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/InRegionScroller.cpp
Source/WebKit/blackberry/Api/InRegionScroller.h
Source/WebKit/blackberry/Api/InRegionScroller_p.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp

index 24da9d6..c91ce90 100644 (file)
@@ -31,6 +31,7 @@
 #include "RenderBox.h"
 #include "RenderLayer.h"
 #include "RenderLayerBacking.h"
+#include "RenderLayerCompositor.h"
 #include "RenderObject.h"
 #include "RenderView.h"
 #include "SelectionHandler.h"
@@ -64,12 +65,13 @@ bool InRegionScroller::setScrollPositionCompositingThread(unsigned camouflagedLa
     return d->setScrollPositionCompositingThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition));
 }
 
-bool InRegionScroller::setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& scrollPosition, bool supportsAcceleratedScrolling)
+bool InRegionScroller::setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& scrollPosition,
+    bool supportsAcceleratedScrolling, Platform::ScrollViewBase::ScrollTarget scrollTarget)
 {
     ASSERT(Platform::webKitThreadMessageClient()->isCurrentThread());
 
     // FIXME: Negative values won't work with map{To,From}Transform methods.
-    return d->setScrollPositionWebKitThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition), supportsAcceleratedScrolling);
+    return d->setScrollPositionWebKitThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition), supportsAcceleratedScrolling, scrollTarget);
 }
 
 InRegionScrollerPrivate::InRegionScrollerPrivate(WebPagePrivate* webPagePrivate)
@@ -132,7 +134,8 @@ bool InRegionScrollerPrivate::setScrollPositionCompositingThread(unsigned camouf
     return true;
 }
 
-bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition, bool supportsAcceleratedScrolling)
+bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition,
+    bool supportsAcceleratedScrolling, Platform::ScrollViewBase::ScrollTarget scrollTarget)
 {
     RenderLayer* layer = 0;
 
@@ -141,8 +144,14 @@ bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflaged
         ASSERT(layerWebKitThread);
         if (layerWebKitThread->owner()) {
             GraphicsLayer* graphicsLayer = layerWebKitThread->owner();
-            RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(graphicsLayer->client());
-            layer = backing->owningLayer();
+
+            if (scrollTarget == Platform::ScrollViewBase::BlockElement) {
+                RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(graphicsLayer->client());
+                layer = backing->owningLayer();
+            } else {
+                RenderLayerCompositor* compositor = static_cast<RenderLayerCompositor*>(graphicsLayer->client());
+                layer = compositor->rootRenderLayer();
+            }
         }
     } else {
         Node* node = reinterpret_cast<Node*>(camouflagedLayer);
index 3291f97..5917baa 100644 (file)
@@ -22,6 +22,7 @@
 #include "BlackBerryGlobal.h"
 
 #include <BlackBerryPlatformPrimitives.h>
+#include <interaction/ScrollViewBase.h>
 
 namespace BlackBerry {
 namespace WebKit {
@@ -36,7 +37,8 @@ public:
     ~InRegionScroller();
 
     bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/);
-    bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/, bool acceleratedScrolling);
+    bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/,
+        bool /*acceleratedScrolling*/, Platform::ScrollViewBase::ScrollTarget);
 
 private:
     friend class WebPagePrivate;
index 9988b83..cb30c7c 100644 (file)
@@ -47,7 +47,8 @@ public:
     bool isActive() const;
 
     bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition);
-    bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition, bool supportsAcceleratedScrolling);
+    bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition,
+        bool /*acceleratedScrolling*/, Platform::ScrollViewBase::ScrollTarget);
 
     void calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint&);
     const std::vector<Platform::ScrollViewBase*>& activeInRegionScrollableAreas() const;
index 5458784..1b24345 100644 (file)
@@ -1,5 +1,40 @@
 2012-09-28  Antonio Gomes  <agomes@rim.com>
 
+        [BlackBerry] Extend composited  in-region scrolling to iframes/frames
+        https://bugs.webkit.org/show_bug.cgi?id=97922
+        PR #197093
+
+        Reviewed by Yong Li.
+        Internaly reviewed by Arvid Nilsson.
+
+        Add support for composited scrolling in a inner frame level:
+
+        1) When creating an InRegionScrollableArea, for a inner scrollable frame,
+        cache and camouflag the appropriated scroll layer (i.e. RenderLayerCompositor::scrollLayer);
+
+        2) Differentiate what type of scroll target we are at: BlockElement or
+        InnerFrame;
+
+        3) Change the signature of the public methods to support and newly passed
+        in ScrollTarget parameter;
+        As a side note, this parameter is needed in order to know what class to static_cast
+        the GraphicsLayer::client to: in the case of a composited scrollable inner frame, the client
+        is a RenderLayerCompositor; in case of a composited scrollable block element, the client
+        is a RenderLayerBacking.
+
+        * Api/InRegionScroller.cpp:
+        (BlackBerry::WebKit::InRegionScroller::setScrollPositionWebKitThread):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::setScrollPositionWebKitThread):
+        * Api/InRegionScroller.h:
+        * Api/InRegionScroller_p.h:
+        (InRegionScrollerPrivate):
+        * WebCoreSupport/ChromeClientBlackBerry.h:
+        (WebCore::ChromeClientBlackBerry::allowedCompositingTriggers):
+        * WebKitSupport/InRegionScrollableArea.cpp:
+        (BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea):
+
+2012-09-28  Antonio Gomes  <agomes@rim.com>
+
         [BlackBerry] Exiting fullscreen does not set the correct scroll position
         https://bugs.webkit.org/show_bug.cgi?id=97917
         PR #212920
index 4b2c095..5b4636d 100644 (file)
@@ -25,6 +25,7 @@
 #include "RenderBox.h"
 #include "RenderLayer.h"
 #include "RenderLayerBacking.h"
+#include "RenderLayerCompositor.h"
 #include "RenderObject.h"
 #include "RenderView.h"
 #include "WebPage_p.h"
@@ -63,6 +64,9 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa
 
     if (layerRenderer->isRenderView()) { // #document case
 
+        RenderView* renderView = toRenderView(layerRenderer);
+        ASSERT(renderView);
+
         FrameView* view = toRenderView(layerRenderer)->frameView();
         ASSERT(view);
 
@@ -76,8 +80,14 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa
         m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth();
         m_scrollsVertically = view->contentsHeight() > view->visibleHeight();
 
-        m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->enclosingElement()); // FIXME: Needs composited layer for inner frames.
-        m_cachedNonCompositedScrollableNode = m_layer->enclosingElement();
+        m_supportsCompositedScrolling = true;
+
+        m_scrollTarget = InnerFrame;
+
+        ASSERT(!m_cachedNonCompositedScrollableNode);
+
+        m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(renderView->compositor()->scrollLayer()->platformLayer());
+        m_cachedCompositedScrollableLayer = renderView->compositor()->scrollLayer()->platformLayer();
 
     } else { // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)).
 
@@ -93,6 +103,8 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa
         m_scrollsHorizontally = box->scrollWidth() != box->clientWidth() && box->scrollsOverflowX();
         m_scrollsVertically = box->scrollHeight() != box->clientHeight() && box->scrollsOverflowY();
 
+        m_scrollTarget = BlockElement;
+
         // Both caches below are self-exclusive.
         if (m_layer->usesCompositedScrolling()) {
             m_forceContentToBeVerticallyScrollable = true;