Title: [88121] trunk/Source
Revision
88121
Author
[email protected]
Date
2011-06-04 12:20:00 -0700 (Sat, 04 Jun 2011)

Log Message

2011-06-04  Sam Weinig  <[email protected]>

        Reviewed by Anders Carlsson.

        WebKit2 needs to know when a scroll is happening due to the ScrollAnimator
        https://bugs.webkit.org/show_bug.cgi?id=62093

        Add additional ChromeClient functions to indicate the beginning and end of
        the various ScrollAnimator animations. Change existing notification that a
        rubber-band has completed for the main frame to be triggered for all frames.

        * page/ChromeClient.h:
        (WebCore::ChromeClient::didStartRubberBandForFrame):
        (WebCore::ChromeClient::didCompleteRubberBandForFrame):
        (WebCore::ChromeClient::didStartAnimatedScroll):
        (WebCore::ChromeClient::didCompleteAnimatedScroll):
        * page/FrameView.cpp:
        (WebCore::FrameView::didStartRubberBand):
        (WebCore::FrameView::didCompleteRubberBand):
        (WebCore::FrameView::didStartAnimatedScroll):
        (WebCore::FrameView::didCompleteAnimatedScroll):
        * page/FrameView.h:
        * platform/ScrollableArea.h:
        (WebCore::ScrollableArea::didStartRubberBand):
        (WebCore::ScrollableArea::didStartAnimatedScroll):
        (WebCore::ScrollableArea::didCompleteAnimatedScroll):
        * platform/mac/ScrollAnimatorMac.h:
        * platform/mac/ScrollAnimatorMac.mm:
        (-[ScrollAnimationHelperDelegate _immediateScrollToPoint:]):
        (WebCore::ScrollAnimatorMac::scroll):
        (WebCore::ScrollAnimatorMac::immediateScrollToPointForScrollAnimation):
        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
2011-06-04  Sam Weinig  <[email protected]>

        Reviewed by Anders Carlsson.

        WebKit2 needs to know when a scroll is happening due to the ScrollAnimator
        https://bugs.webkit.org/show_bug.cgi?id=62093

        Stub out new ChromeClient functions regarding the start and end of ScrollAnimator
        animated scrolls, and update logic for rubber-band ending to check for main frame
        now that it is called for all frames.

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::didStartRubberBandForFrame):
        (WebKit::WebChromeClient::didCompleteRubberBandForFrame):
        (WebKit::WebChromeClient::didStartAnimatedScroll):
        (WebKit::WebChromeClient::didCompleteAnimatedScroll):
        * WebProcess/WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88120 => 88121)


--- trunk/Source/WebCore/ChangeLog	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/ChangeLog	2011-06-04 19:20:00 UTC (rev 88121)
@@ -1,3 +1,36 @@
+2011-06-04  Sam Weinig  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        WebKit2 needs to know when a scroll is happening due to the ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=62093
+
+        Add additional ChromeClient functions to indicate the beginning and end of
+        the various ScrollAnimator animations. Change existing notification that a
+        rubber-band has completed for the main frame to be triggered for all frames.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::didStartRubberBandForFrame):
+        (WebCore::ChromeClient::didCompleteRubberBandForFrame):
+        (WebCore::ChromeClient::didStartAnimatedScroll):
+        (WebCore::ChromeClient::didCompleteAnimatedScroll):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::didStartRubberBand):
+        (WebCore::FrameView::didCompleteRubberBand):
+        (WebCore::FrameView::didStartAnimatedScroll):
+        (WebCore::FrameView::didCompleteAnimatedScroll):
+        * page/FrameView.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::didStartRubberBand):
+        (WebCore::ScrollableArea::didStartAnimatedScroll):
+        (WebCore::ScrollableArea::didCompleteAnimatedScroll):
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[ScrollAnimationHelperDelegate _immediateScrollToPoint:]):
+        (WebCore::ScrollAnimatorMac::scroll):
+        (WebCore::ScrollAnimatorMac::immediateScrollToPointForScrollAnimation):
+        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+
 2011-06-04  Martin Robinson  <[email protected]>
 
         Touch a file to try to fix the GTK+ build on the 32-bit bot.

Modified: trunk/Source/WebCore/page/ChromeClient.h (88120 => 88121)


--- trunk/Source/WebCore/page/ChromeClient.h	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/page/ChromeClient.h	2011-06-04 19:20:00 UTC (rev 88121)
@@ -311,7 +311,11 @@
 
         virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
 
-        virtual void didCompleteRubberBandForMainFrame(const IntSize&) const { }
+        virtual void didStartRubberBandForFrame(Frame*, const IntSize&) const { }
+        virtual void didCompleteRubberBandForFrame(Frame*, const IntSize&) const { }
+        virtual void didStartAnimatedScroll() const { }
+        virtual void didCompleteAnimatedScroll() const { }
+        
         virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
 
         enum DialogType {

Modified: trunk/Source/WebCore/page/FrameView.cpp (88120 => 88121)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-06-04 19:20:00 UTC (rev 88121)
@@ -2180,16 +2180,38 @@
     return page->chrome()->windowResizerRect();
 }
 
+void FrameView::didStartRubberBand(const IntSize& initialOverhang) const
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+    return page->chrome()->client()->didCompleteRubberBandForFrame(m_frame.get(), initialOverhang);
+}
+
 void FrameView::didCompleteRubberBand(const IntSize& initialOverhang) const
 {
     Page* page = m_frame->page();
     if (!page)
         return;
-    if (page->mainFrame() != m_frame)
+    return page->chrome()->client()->didCompleteRubberBandForFrame(m_frame.get(), initialOverhang);
+}
+
+void FrameView::didStartAnimatedScroll() const
+{
+    Page* page = m_frame->page();
+    if (!page)
         return;
-    return page->chrome()->client()->didCompleteRubberBandForMainFrame(initialOverhang);
+    return page->chrome()->client()->didStartAnimatedScroll();
 }
 
+void FrameView::didCompleteAnimatedScroll() const
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+    return page->chrome()->client()->didCompleteAnimatedScroll();
+}
+
 void FrameView::scrollbarStyleChanged()
 {
     Page* page = m_frame->page();

Modified: trunk/Source/WebCore/page/FrameView.h (88120 => 88121)


--- trunk/Source/WebCore/page/FrameView.h	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/page/FrameView.h	2011-06-04 19:20:00 UTC (rev 88121)
@@ -323,7 +323,10 @@
     virtual bool isActive() const;
     virtual void getTickmarks(Vector<IntRect>&) const;
     virtual void scrollTo(const IntSize&);
+    virtual void didStartRubberBand(const IntSize&) const;
     virtual void didCompleteRubberBand(const IntSize&) const;
+    virtual void didStartAnimatedScroll() const;
+    virtual void didCompleteAnimatedScroll() const;
     virtual void scrollbarStyleChanged();
     virtual void setVisibleScrollerThumbRect(const IntRect&);
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (88120 => 88121)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2011-06-04 19:20:00 UTC (rev 88121)
@@ -127,7 +127,12 @@
     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 void didStartRubberBand(const IntSize&) const { ASSERT_NOT_REACHED(); }
     virtual void didCompleteRubberBand(const IntSize&) const { ASSERT_NOT_REACHED(); }
+    virtual void didStartAnimatedScroll() const { }
+    virtual void didCompleteAnimatedScroll() const { }
+    
     virtual bool shouldSuspendScrollAnimations() const { return true; }
     virtual void scrollbarStyleChanged() { }
     virtual void setVisibleScrollerThumbRect(const IntRect&) { }

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (88120 => 88121)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2011-06-04 19:20:00 UTC (rev 88121)
@@ -76,6 +76,8 @@
     void immediateScrollByDeltaX(float deltaX);
     void immediateScrollByDeltaY(float deltaY);
 
+    void immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition);
+
     void setIsDrawingIntoLayer(bool b) { m_drawingIntoLayer = b; }
     bool isDrawingIntoLayer() const { return m_drawingIntoLayer; }
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (88120 => 88121)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-06-04 19:20:00 UTC (rev 88121)
@@ -48,6 +48,7 @@
 - (void)_stopRun;
 - (BOOL)_isAnimating;
 - (NSPoint)targetOrigin;
+- (CGFloat)_progress;
 @end
 
 @interface ScrollAnimationHelperDelegate : NSObject
@@ -97,7 +98,7 @@
 {
     if (!_animator)
         return;
-    _animator->immediateScrollToPoint(newPosition);
+    _animator->immediateScrollToPointForScrollAnimation(newPosition);
 }
 
 - (NSPoint)_pixelAlignProposedScrollPosition:(NSPoint)newOrigin
@@ -506,8 +507,10 @@
     if ([m_scrollAnimationHelper.get() _isAnimating]) {
         NSPoint targetOrigin = [m_scrollAnimationHelper.get() targetOrigin];
         newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targetOrigin.y) : NSMakePoint(targetOrigin.x, newPos);
-    } else
+    } else {
         newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_currentPosY) : NSMakePoint(m_currentPosX, newPos);
+        m_scrollableArea->didStartAnimatedScroll();
+    }
 
     [m_scrollAnimationHelper.get() scrollToPoint:newPoint];
     return true;
@@ -580,6 +583,17 @@
     notityPositionChanged();
 }
 
+void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition)
+{
+    ASSERT(m_scrollAnimationHelper);
+    CGFloat progress = [m_scrollAnimationHelper.get() _progress];
+    
+    immediateScrollToPoint(newPosition);
+
+    if (progress >= 1.0)
+        m_scrollableArea->didCompleteAnimatedScroll();
+}
+
 void ScrollAnimatorMac::notityPositionChanged()
 {
 #if USE(WK_SCROLLBAR_PAINTER)
@@ -1148,6 +1162,8 @@
                 return;
             }
 
+            m_scrollableArea->didStartRubberBand(roundedIntSize(m_startStretch));
+            
             m_origOrigin = (m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin()) - m_startStretch;
             m_origVelocity = m_momentumVelocity;
 

Modified: trunk/Source/WebKit2/ChangeLog (88120 => 88121)


--- trunk/Source/WebKit2/ChangeLog	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-04 19:20:00 UTC (rev 88121)
@@ -1,3 +1,21 @@
+2011-06-04  Sam Weinig  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        WebKit2 needs to know when a scroll is happening due to the ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=62093
+
+        Stub out new ChromeClient functions regarding the start and end of ScrollAnimator
+        animated scrolls, and update logic for rubber-band ending to check for main frame
+        now that it is called for all frames.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::didStartRubberBandForFrame):
+        (WebKit::WebChromeClient::didCompleteRubberBandForFrame):
+        (WebKit::WebChromeClient::didStartAnimatedScroll):
+        (WebKit::WebChromeClient::didCompleteAnimatedScroll):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2011-06-03  Brady Eidson  <[email protected]>
 
         Reviewed by Steve Falkenburg.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (88120 => 88121)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-06-04 19:20:00 UTC (rev 88121)
@@ -768,11 +768,25 @@
     m_page->send(Messages::WebPageProxy::DidChangeViewportData(args));
 }
 
-void WebChromeClient::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) const
+void WebChromeClient::didStartRubberBandForFrame(Frame*, const IntSize&) const
 {
+}
+
+void WebChromeClient::didCompleteRubberBandForFrame(Frame* frame, const IntSize& initialOverhang) const
+{
+    if (frame != frame->page()->mainFrame())
+        return;
     m_page->send(Messages::WebPageProxy::DidCompleteRubberBandForMainFrame(initialOverhang));
 }
 
+void WebChromeClient::didStartAnimatedScroll() const
+{
+}
+
+void WebChromeClient::didCompleteAnimatedScroll() const
+{
+}
+    
 void WebChromeClient::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
 {
     m_page->send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (88120 => 88121)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-06-04 18:59:11 UTC (rev 88120)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-06-04 19:20:00 UTC (rev 88121)
@@ -220,7 +220,11 @@
     
     virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const;
 
-    virtual void didCompleteRubberBandForMainFrame(const WebCore::IntSize&) const;
+    virtual void didStartRubberBandForFrame(WebCore::Frame*, const WebCore::IntSize&) const;
+    virtual void didCompleteRubberBandForFrame(WebCore::Frame*, const WebCore::IntSize&) const;
+    virtual void didStartAnimatedScroll() const;
+    virtual void didCompleteAnimatedScroll() const;
+
     virtual void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const;
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to