Title: [103182] trunk/Source/WebCore
Revision
103182
Author
ander...@apple.com
Date
2011-12-18 11:52:41 -0800 (Sun, 18 Dec 2011)

Log Message

The scrolling coordinator should keep track of the main frame geometry
https://bugs.webkit.org/show_bug.cgi?id=74816

Reviewed by Andreas Kling.

* page/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::syncFrameGeometry):
Update the frame geometry accordingly when it changes.

* page/ScrollingCoordinator.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):
Call ScrollingCoordinator::syncFrameGeometry.

(WebCore::RenderLayerCompositor::scrollingCoordinator):
Add new getter.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103181 => 103182)


--- trunk/Source/WebCore/ChangeLog	2011-12-18 19:45:42 UTC (rev 103181)
+++ trunk/Source/WebCore/ChangeLog	2011-12-18 19:52:41 UTC (rev 103182)
@@ -1,3 +1,23 @@
+2011-12-18  Anders Carlsson  <ander...@apple.com>
+
+        The scrolling coordinator should keep track of the main frame geometry
+        https://bugs.webkit.org/show_bug.cgi?id=74816
+
+        Reviewed by Andreas Kling.
+
+        * page/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::syncFrameGeometry):
+        Update the frame geometry accordingly when it changes.
+
+        * page/ScrollingCoordinator.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+        (WebCore::RenderLayerCompositor::updateRootLayerPosition):
+        Call ScrollingCoordinator::syncFrameGeometry.
+
+        (WebCore::RenderLayerCompositor::scrollingCoordinator):
+        Add new getter.
+
 2011-12-17  Sam Weinig  <s...@webkit.org>
 
         Move timestamp down from PlatformEvent subclasses to the base class

Modified: trunk/Source/WebCore/page/ScrollingCoordinator.cpp (103181 => 103182)


--- trunk/Source/WebCore/page/ScrollingCoordinator.cpp	2011-12-18 19:45:42 UTC (rev 103181)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.cpp	2011-12-18 19:52:41 UTC (rev 103182)
@@ -29,7 +29,12 @@
 
 #include "ScrollingCoordinator.h"
 
+#include "Frame.h"
+#include "FrameView.h"
+#include "IntRect.h"
+#include "Page.h"
 #include <wtf/Functional.h>
+#include <wtf/MainThread.h>
 #include <wtf/PassRefPtr.h>
 
 namespace WebCore {
@@ -55,6 +60,27 @@
     m_page = 0;
 }
 
+void ScrollingCoordinator::syncFrameGeometry(Frame* frame)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    if (frame != m_page->mainFrame())
+        return;
+
+    IntRect visibleContentRect = frame->view()->visibleContentRect();
+    IntSize contentsSize = frame->view()->contentsSize();
+
+    MutexLocker locker(m_mainFrameGeometryMutex);
+    if (m_mainFrameVisibleContentRect == visibleContentRect && m_mainFrameContentsSize == contentsSize)
+        return;
+
+    m_mainFrameVisibleContentRect = visibleContentRect;
+    m_mainFrameContentsSize = contentsSize;
+
+    // FIXME: Inform the scrolling thread that the frame geometry has changed.
+}
+
 bool ScrollingCoordinator::handleWheelEvent(const PlatformWheelEvent&)
 {
     // FIXME: Implement.

Modified: trunk/Source/WebCore/page/ScrollingCoordinator.h (103181 => 103182)


--- trunk/Source/WebCore/page/ScrollingCoordinator.h	2011-12-18 19:45:42 UTC (rev 103181)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.h	2011-12-18 19:52:41 UTC (rev 103182)
@@ -28,12 +28,14 @@
 
 #if ENABLE(THREADED_SCROLLING)
 
+#include "IntRect.h"
 #include <wtf/Forward.h>
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/Threading.h>
 
 namespace WebCore {
 
+class Frame;
 class Page;
 class PlatformWheelEvent;
 
@@ -44,6 +46,10 @@
 
     void pageDestroyed();
 
+    // Should be called whenever the geometry of the given frame changes,
+    // including the visible content rect and the content size.
+    void syncFrameGeometry(Frame*);
+
     // Can be called from any thread. Will try to handle the wheel event on the scrolling thread,
     // and return false if the event must be sent again to the WebCore event handler.
     bool handleWheelEvent(const PlatformWheelEvent&);
@@ -58,6 +64,10 @@
 
 private:
     Page* m_page;
+
+    Mutex m_mainFrameGeometryMutex;
+    IntRect m_mainFrameVisibleContentRect;
+    IntSize m_mainFrameContentsSize;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (103181 => 103182)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-12-18 19:45:42 UTC (rev 103181)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-12-18 19:52:41 UTC (rev 103182)
@@ -56,6 +56,10 @@
 #include "HTMLMediaElement.h"
 #endif
 
+#if ENABLE(THREADED_SCROLLING)
+#include "ScrollingCoordinator.h"
+#endif
+
 #if PROFILE_LAYER_REBUILD
 #include <wtf/CurrentTime.h>
 #endif
@@ -979,6 +983,11 @@
         if (m_layerForOverhangAreas)
             m_layerForOverhangAreas->setSize(frameView->frameRect().size());
 #endif
+
+#if ENABLE(THREADED_SCROLLING)
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->syncFrameGeometry(frameView->frame());
+#endif
     }
 }
 
@@ -1232,6 +1241,11 @@
         FrameView* frameView = m_renderView->frameView();
         m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size());
     }
+
+#if ENABLE(THREADED_SCROLLING)
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        scrollingCoordinator->syncFrameGeometry(m_renderView->frameView()->frame());
+#endif
 }
 
 void RenderLayerCompositor::didStartAcceleratedAnimation(CSSPropertyID property)
@@ -2000,6 +2014,18 @@
         rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
 }
 
+#if ENABLE(THREADED_SCROLLING)
+ScrollingCoordinator* RenderLayerCompositor::scrollingCoordinator() const
+{
+    if (Frame* frame = m_renderView->frameView()->frame()) {
+        if (Page* page = frame->page())
+            return page->scrollingCoordinator();
+    }
+
+    return 0;
+}
+#endif
+
 } // namespace WebCore
 
 #endif // USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (103181 => 103182)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-12-18 19:45:42 UTC (rev 103181)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-12-18 19:52:41 UTC (rev 103182)
@@ -40,6 +40,9 @@
 #if ENABLE(VIDEO)
 class RenderVideo;
 #endif
+#if ENABLE(THREADED_SCROLLING)
+class ScrollingCoordinator;
+#endif
 
 enum CompositingUpdateType {
     CompositingUpdateAfterLayoutOrStyleChange,
@@ -293,6 +296,10 @@
     bool requiresOverhangAreasLayer() const;
 #endif
 
+#if ENABLE(THREADED_SCROLLING)
+    ScrollingCoordinator* scrollingCoordinator() const;
+#endif
+
 private:
     RenderView* m_renderView;
     OwnPtr<GraphicsLayer> m_rootContentLayer;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to