Add notification of the end of a rubber band.
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 18:13:32 +0000 (18:13 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 18:13:32 +0000 (18:13 +0000)
<rdar://problem/8940648>

Reviewed by Anders Carlsson.

Source/WebCore:

* WebCore.exp.in:
Add additional exprots.

* page/ChromeClient.h:
(WebCore::ChromeClient::didCompleteRubberBandForMainFrame):
* page/FrameView.cpp:
(WebCore::FrameView::didCompleteRubberBand):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::didCompleteRubberBand):
* platform/ScrollView.h:
Add hook.

* platform/ScrollableArea.h:
(WebCore::ScrollableArea::inLiveResize):
(WebCore::ScrollableArea::maximumScrollPosition):
(WebCore::ScrollableArea::visibleWidth):
(WebCore::ScrollableArea::overhangAmount):
(WebCore::ScrollableArea::didCompleteRubberBand):
Reorganize and de-virtualize live resize notifications.

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
Call the new hook when the rubberband ends.

Source/WebKit2:

* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::drawHeader):
(WebKit::WebPageProxy::drawFooter):
(WebKit::WebPageProxy::didCompleteRubberBandForMainFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::didCompleteRubberBandForMainFrame):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didCompleteRubberBandForMainFrame):
* WebProcess/WebCoreSupport/WebChromeClient.h:
Pipe the notification up to the WKUIClient.

Tools:

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::initialize):
Stub out the new WKUIClient function.

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

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebUIClient.cpp
Source/WebKit2/UIProcess/WebUIClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Tools/ChangeLog
Tools/MiniBrowser/mac/BrowserWindowController.m
Tools/WebKitTestRunner/TestController.cpp

index 0e13a97..a0f431c 100644 (file)
@@ -1,3 +1,35 @@
+2011-02-02  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Add notification of the end of a rubber band.
+        <rdar://problem/8940648>
+
+        * WebCore.exp.in:
+        Add additional exprots.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::didCompleteRubberBandForMainFrame):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::didCompleteRubberBand):
+        * page/FrameView.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::didCompleteRubberBand):
+        * platform/ScrollView.h:
+        Add hook.
+
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::inLiveResize):
+        (WebCore::ScrollableArea::maximumScrollPosition):
+        (WebCore::ScrollableArea::visibleWidth):
+        (WebCore::ScrollableArea::overhangAmount):
+        (WebCore::ScrollableArea::didCompleteRubberBand):
+        Reorganize and de-virtualize live resize notifications.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+        Call the new hook when the rubberband ends.
+
 2011-02-02  Evan Martin  <evan@chromium.org>
 
         Reviewed by Tony Chang.
index d59880b..0c3e31e 100644 (file)
@@ -344,6 +344,8 @@ __ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
 __ZN7WebCore14SchemeRegistry24registerURLSchemeAsLocalERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry25registerURLSchemeAsSecureERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry32registerURLSchemeAsEmptyDocumentERKN3WTF6StringE
+__ZN7WebCore14ScrollableArea17willEndLiveResizeEv
+__ZN7WebCore14ScrollableArea19willStartLiveResizeEv
 __ZN7WebCore14SecurityOrigin14threadsafeCopyEv
 __ZN7WebCore14SecurityOrigin16createFromStringERKN3WTF6StringE
 __ZN7WebCore14SecurityOrigin18setLocalLoadPolicyENS0_15LocalLoadPolicyE
index fdd5b5a..248a0ee 100644 (file)
@@ -304,6 +304,8 @@ namespace WebCore {
 
         virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
 
+        virtual void didCompleteRubberBandForMainFrame(const IntSize&) const { }
+
     protected:
         virtual ~ChromeClient() { }
     };
index 29526e1..d5fc752 100644 (file)
@@ -2002,6 +2002,14 @@ IntRect FrameView::windowResizerRect() const
     return page->chrome()->windowResizerRect();
 }
 
+void FrameView::didCompleteRubberBand(const IntSize& initialOverhang) const
+{
+    Page* page = m_frame->page();
+    if (page->mainFrame() != m_frame)
+        return;
+    return page->chrome()->client()->didCompleteRubberBandForMainFrame(initialOverhang);
+}
+
 #if ENABLE(DASHBOARD_SUPPORT)
 void FrameView::updateDashboardRegions()
 {
index 992633f..334bafc 100644 (file)
@@ -302,8 +302,8 @@ private:
     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
     virtual bool isActive() const;
     virtual void getTickmarks(Vector<IntRect>&) const;
-
     virtual void scrollTo(const IntSize&);
+    virtual void didCompleteRubberBand(const IntSize&) const;
 
     void deferredRepaintTimerFired(Timer<FrameView>*);
     void doDeferredRepaints();
index 116167e..5f358e4 100644 (file)
@@ -320,6 +320,10 @@ int ScrollView::scrollSize(ScrollbarOrientation orientation) const
     return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0;
 }
 
+void ScrollView::didCompleteRubberBand(const IntSize&) const
+{
+}
+
 void ScrollView::setScrollOffset(const IntPoint& offset)
 {
     int horizontalOffset = offset.x();
index 3d3efe2..203c034 100644 (file)
@@ -61,7 +61,8 @@ public:
     virtual int scrollSize(ScrollbarOrientation orientation) const;
     virtual int scrollPosition(Scrollbar*) const;
     virtual void setScrollOffset(const IntPoint&);
-    
+    virtual void didCompleteRubberBand(const IntSize&) const;
+
     // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
     virtual void scrollTo(const IntSize& newOffset);
 
index 192d82b..4d24e87 100644 (file)
@@ -60,8 +60,12 @@ public:
     bool constrainsScrollingToContentEdge() const { return m_constrainsScrollingToContentEdge; }
     void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEdge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; }
 
+    bool inLiveResize() const { return m_inLiveResize; }
+    void willStartLiveResize();
+    void willEndLiveResize();
+
     ScrollAnimator* scrollAnimator() const { return m_scrollAnimator.get(); }
-    
+
     virtual int scrollSize(ScrollbarOrientation) const = 0;
     virtual int scrollPosition(Scrollbar*) const = 0;
     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
@@ -100,19 +104,13 @@ public:
     virtual IntPoint scrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
     virtual IntPoint minimumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
     virtual IntPoint maximumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
-
     virtual IntRect visibleContentRect(bool = false) const { ASSERT_NOT_REACHED(); return IntRect(); }
     virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
     virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
-
     virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); }
     virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); }
-
     virtual IntPoint currentMousePosition() const { return IntPoint(); }
-
-    virtual bool inLiveResize() const { return m_inLiveResize; }
-    virtual void willStartLiveResize();
-    virtual void willEndLiveResize();
+    virtual void didCompleteRubberBand(const IntSize&) const { ASSERT_NOT_REACHED(); }
 
 private:
     // NOTE: Only called from the ScrollAnimator.
index b25ea97..0bfaea2 100644 (file)
@@ -916,6 +916,8 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*)
         } else {
             immediateScrollToPoint(m_origOrigin);
 
+            m_scrollableArea->didCompleteRubberBand(roundedIntSize(m_startStretch));
+
             m_snapRubberBandTimer.stop();
             m_stretchScrollForce = FloatSize();
             
index 1bd0407..2f57be2 100644 (file)
@@ -1,3 +1,25 @@
+2011-02-02  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Add notification of the end of a rubber band.
+        <rdar://problem/8940648>
+
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::drawHeader):
+        (WebKit::WebPageProxy::drawFooter):
+        (WebKit::WebPageProxy::didCompleteRubberBandForMainFrame):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::didCompleteRubberBandForMainFrame):
+        * UIProcess/WebUIClient.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::didCompleteRubberBandForMainFrame):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Pipe the notification up to the WKUIClient.
+
 2011-02-03  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r77449.
index 251cde9..07d8fdb 100644 (file)
@@ -167,6 +167,7 @@ typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, co
 typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
 typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
 typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
+typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page, WKSize initialOverhang, const void* clientInfo);
 
 struct WKPageUIClient {
     int                                                                 version;
@@ -203,6 +204,7 @@ struct WKPageUIClient {
     WKPageDrawFooterCallback                                            drawFooter;
     WKPagePrintFrameCallback                                            printFrame;
     WKPageCallback                                                      runModal;
+    WKPageDidCompleteRubberBandForMainFrameCallback                     didCompleteRubberBandForMainFrame;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
index 3188d3e..4a1d0b5 100644 (file)
@@ -2487,16 +2487,21 @@ float WebPageProxy::footerHeight(WebFrameProxy* frame)
     return m_uiClient.footerHeight(this, frame);
 }
 
-void WebPageProxy::drawHeader(WebFrameProxy* frame, const WebCore::FloatRect& rect)
+void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
 {
     m_uiClient.drawHeader(this, frame, rect);
 }
 
-void WebPageProxy::drawFooter(WebFrameProxy* frame, const WebCore::FloatRect& rect)
+void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
 {
     m_uiClient.drawFooter(this, frame, rect);
 }
 
+void WebPageProxy::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang)
+{
+    m_uiClient.didCompleteRubberBandForMainFrame(this, initialOverhang);
+}
+
 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
 {
     m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
index 4646e21..bce0795 100644 (file)
@@ -467,6 +467,7 @@ private:
     void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
     void runModal() { m_uiClient.runModal(this); }
+    void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
 
     void reattachToWebProcess();
     void reattachToWebProcessWithItem(WebBackForwardListItem*);
index ef87728..f640383 100644 (file)
@@ -55,6 +55,7 @@ messages -> WebPageProxy {
     RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
     PrintFrame(uint64_t frameID) -> ()
     RunModal()
+    DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang)
 
 #if ENABLE(TILED_BACKING_STORE)
     PageDidRequestScroll(WebCore::IntSize delta)
index 2805d18..076b331 100644 (file)
@@ -327,4 +327,12 @@ void WebUIClient::runModal(WebPageProxy* page)
     m_client.runModal(toAPI(page), m_client.clientInfo);
 }
 
+void WebUIClient::didCompleteRubberBandForMainFrame(WebPageProxy* page, const IntSize& initialOverhang)
+{
+    if (!m_client.runModal)
+        return;
+
+    m_client.didCompleteRubberBandForMainFrame(toAPI(page), toAPI(initialOverhang), m_client.clientInfo);
+}
+
 } // namespace WebKit
index b873a8d..d8e0bff 100644 (file)
@@ -96,6 +96,8 @@ public:
 
     bool canRunModal() const;
     void runModal(WebPageProxy*);
+
+    void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
 };
 
 } // namespace WebKit
index 27211c2..75d493c 100644 (file)
@@ -698,4 +698,9 @@ void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& arg
     m_page->send(Messages::WebPageProxy::DidChangeViewportData(args));
 }
 
+void WebChromeClient::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) const
+{
+    m_page->send(Messages::WebPageProxy::DidCompleteRubberBandForMainFrame(initialOverhang));
+}
+
 } // namespace WebKit
index 8586f3c..a5046ff 100644 (file)
@@ -205,6 +205,8 @@ private:
 
     virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const;
 
+    virtual void didCompleteRubberBandForMainFrame(const WebCore::IntSize&) const;
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     WebPage* m_page;
index f4c71db..4cce72f 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-02  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Add notification of the end of a rubber band.
+        <rdar://problem/8940648>
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::initialize):
+        Stub out the new WKUIClient function.
+
 2011-02-03  Gabor Rapcsanyi  <rgabor@webkit.org>
 
         Unreviewed.
index 3a1ffbd..3659760 100644 (file)
@@ -645,6 +645,7 @@ static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParameters
         0, // drawFooter
         0, // printFrame
         0, // showModal
+        0, // didCompleteRubberBandForMainFrame
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }
index 535c5c0..6f5b9a7 100644 (file)
@@ -165,6 +165,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK
         0, // drawFooter
         0, // printFrame
         runModal,
+        0, // didCompleteRubberBandForMainFrame
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
 
@@ -297,6 +298,7 @@ void TestController::initialize(int argc, const char* argv[])
         0, // drawFooter
         0, // printFrame
         0, // runModal
+        0, // didCompleteRubberBandForMainFrame
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);