Title: [120125] trunk/Source/WebCore
Revision
120125
Author
e...@google.com
Date
2012-06-12 14:46:28 -0700 (Tue, 12 Jun 2012)

Log Message

[chromium] ScrollingCoordinator::setScrollLayer should update scroll layer ids
https://bugs.webkit.org/show_bug.cgi?id=88882

Reviewed by James Robinson.

Tested manually, as scrollbar layers are currently only created when
threaded compositing is enabled and none of those layout tests trigger
this bug.

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(WebCore::createScrollbarLayer):
(WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
* platform/graphics/chromium/ScrollbarLayerChromium.h:
(WebCore::ScrollbarLayerChromium::setScrollLayerId):
(ScrollbarLayerChromium):
* platform/graphics/chromium/TreeSynchronizer.cpp:
(WebCore::TreeSynchronizer::updateScrollbarLayerPointersRecursive):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120124 => 120125)


--- trunk/Source/WebCore/ChangeLog	2012-06-12 21:44:54 UTC (rev 120124)
+++ trunk/Source/WebCore/ChangeLog	2012-06-12 21:46:28 UTC (rev 120125)
@@ -1,3 +1,28 @@
+2012-06-12  Adrienne Walker  <e...@google.com>
+
+        [chromium] ScrollingCoordinator::setScrollLayer should update scroll layer ids
+        https://bugs.webkit.org/show_bug.cgi?id=88882
+
+        Reviewed by James Robinson.
+
+        Tested manually, as scrollbar layers are currently only created when
+        threaded compositing is enabled and none of those layout tests trigger
+        this bug.
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+        (ScrollingCoordinatorPrivate):
+        (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+        (WebCore::createScrollbarLayer):
+        (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+        (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+        * platform/graphics/chromium/ScrollbarLayerChromium.h:
+        (WebCore::ScrollbarLayerChromium::setScrollLayerId):
+        (ScrollbarLayerChromium):
+        * platform/graphics/chromium/TreeSynchronizer.cpp:
+        (WebCore::TreeSynchronizer::updateScrollbarLayerPointersRecursive):
+
 2012-06-12  Mark Mentovai  <m...@chromium.org>
 
         [chromium mac] Don't include things in subframeworks of

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


--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-06-12 21:44:54 UTC (rev 120124)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-06-12 21:46:28 UTC (rev 120125)
@@ -45,11 +45,33 @@
     ScrollingCoordinatorPrivate() { }
     ~ScrollingCoordinatorPrivate() { }
 
-    void setScrollLayer(LayerChromium* layer) { m_scrollLayer = layer; }
+    void setScrollLayer(LayerChromium* layer)
+    {
+        m_scrollLayer = layer;
+
+        int id = layer ? layer->id() : 0;
+        if (m_horizontalScrollbarLayer)
+            m_horizontalScrollbarLayer->setScrollLayerId(id);
+        if (m_verticalScrollbarLayer)
+            m_verticalScrollbarLayer->setScrollLayerId(id);
+    }
+
+    void setHorizontalScrollbarLayer(PassRefPtr<ScrollbarLayerChromium> layer)
+    {
+        m_horizontalScrollbarLayer = layer;
+    }
+
+    void setVerticalScrollbarLayer(PassRefPtr<ScrollbarLayerChromium> layer)
+    {
+        m_verticalScrollbarLayer = layer;
+    }
+
     LayerChromium* scrollLayer() const { return m_scrollLayer.get(); }
 
 private:
     RefPtr<LayerChromium> m_scrollLayer;
+    RefPtr<ScrollbarLayerChromium> m_horizontalScrollbarLayer;
+    RefPtr<ScrollbarLayerChromium> m_verticalScrollbarLayer;
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -81,7 +103,7 @@
 #endif
 }
 
-static void scrollbarLayerDidChange(Scrollbar* scrollbar, LayerChromium* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static PassRefPtr<ScrollbarLayerChromium> createScrollbarLayer(Scrollbar* scrollbar, LayerChromium* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
@@ -108,13 +130,15 @@
     if (scrollbar->isCustomScrollbar() || !CCProxy::hasImplThread() || !platformSupported) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
-        return;
+        return 0;
     }
 
     RefPtr<ScrollbarLayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar, scrollLayer->id());
     scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer.get());
     scrollbarGraphicsLayer->setDrawsContent(false);
     scrollbarLayer->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+
+    return scrollbarLayer.release();
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
@@ -122,7 +146,7 @@
     if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
-    scrollbarLayerDidChange(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView);
+    m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
 }
 
 void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* verticalScrollbarLayer)
@@ -130,7 +154,7 @@
     if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
-    scrollbarLayerDidChange(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView);
+    m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView));
 }
 
 void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)

Modified: trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h (120124 => 120125)


--- trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h	2012-06-12 21:44:54 UTC (rev 120124)
+++ trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h	2012-06-12 21:46:28 UTC (rev 120125)
@@ -43,6 +43,8 @@
     virtual void pushPropertiesTo(CCLayerImpl*);
 
     int scrollLayerId() const { return m_scrollLayerId; }
+    void setScrollLayerId(int id) { m_scrollLayerId = id; }
+
     virtual ScrollbarLayerChromium* toScrollbarLayerChromium() { return this; }
 
 protected:

Modified: trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp (120124 => 120125)


--- trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp	2012-06-12 21:44:54 UTC (rev 120124)
+++ trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp	2012-06-12 21:46:28 UTC (rev 120125)
@@ -114,6 +114,9 @@
     CCScrollbarLayerImpl* ccScrollbarLayerImpl = static_cast<CCScrollbarLayerImpl*>(newLayers.get(scrollbarLayer->id()));
     ASSERT(ccScrollbarLayerImpl);
     ccScrollbarLayerImpl->setScrollLayer(newLayers.get(scrollbarLayer->scrollLayerId()));
+
+    // Scrollbar layers in the tree should always point to a valid scroll layer
+    ASSERT(newLayers.get(scrollbarLayer->scrollLayerId()));
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to