Scrollbars still show sometimes even when WKPageSetSuppressScrollbarAnimations()
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2013 02:29:22 +0000 (02:29 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2013 02:29:22 +0000 (02:29 +0000)
is set
https://bugs.webkit.org/show_bug.cgi?id=116493
-and corresponding-
<rdar://problem/13912871>

Reviewed by Dean Jackson.

We need to be more aggressive with our approach since AppKit may still ask the
scrollbars to paint here.

scrollbarAnimationsAreSuppressed() will allow us to find out if the setting has
been set.
* page/FrameView.cpp:
(WebCore::FrameView::scrollbarAnimationsAreSuppressed):
* page/FrameView.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::scrollbarAnimationsAreSuppressed):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollbarAnimationsAreSuppressed):
* rendering/RenderLayer.h:
(RenderLayer):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollbarAnimationsAreSuppressed):
* rendering/RenderListBox.h:

Don’t allow animations if scrollbars are suppressed.
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):

Call cancelAnimations() to prevent a just-started animation from continuing.
(WebCore::ScrollAnimatorMac::finishCurrentScrollAnimations):

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

Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h

index 5098d58..405b600 100644 (file)
@@ -1,3 +1,38 @@
+2013-05-20  Beth Dakin  <bdakin@apple.com>
+
+        Scrollbars still show sometimes even when WKPageSetSuppressScrollbarAnimations() 
+        is set
+        https://bugs.webkit.org/show_bug.cgi?id=116493
+        -and corresponding-
+        <rdar://problem/13912871>
+
+        Reviewed by Dean Jackson.
+
+        We need to be more aggressive with our approach since AppKit may still ask the 
+        scrollbars to paint here.
+
+        scrollbarAnimationsAreSuppressed() will allow us to find out if the setting has 
+        been set.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollbarAnimationsAreSuppressed):
+        * page/FrameView.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::scrollbarAnimationsAreSuppressed):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollbarAnimationsAreSuppressed):
+        * rendering/RenderLayer.h:
+        (RenderLayer):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::scrollbarAnimationsAreSuppressed):
+        * rendering/RenderListBox.h:
+
+        Don’t allow animations if scrollbars are suppressed.
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
+
+        Call cancelAnimations() to prevent a just-started animation from continuing.
+        (WebCore::ScrollAnimatorMac::finishCurrentScrollAnimations):
+
 2013-05-20  Andreas Kling  <akling@apple.com>
 
         Avoid caret repaints if we're not showing carets anyway.
index 6b01ccc..7e3f218 100644 (file)
@@ -907,6 +907,14 @@ GraphicsLayer* FrameView::setWantsLayerForBottomOverHangArea(bool wantsLayer) co
 
 #endif // ENABLE(RUBBER_BANDING)
 
+bool FrameView::scrollbarAnimationsAreSuppressed() const
+{
+    Page* page = frame() ? frame()->page() : 0;
+    if (!page)
+        return true;
+    return page->shouldSuppressScrollbarAnimations();
+}
+
 bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush)
 {
     RenderView* renderView = this->renderView();
index 89abb0a..27d19b5 100644 (file)
@@ -419,6 +419,8 @@ public:
     virtual void willStartLiveResize() OVERRIDE;
     virtual void willEndLiveResize() OVERRIDE;
 
+    virtual bool scrollbarAnimationsAreSuppressed() const OVERRIDE;
+
     void addPaintPendingMilestones(LayoutMilestones);
     void firePaintRelatedMilestones();
     LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
index cd42607..f24b406 100644 (file)
@@ -82,6 +82,7 @@ public:
     void contentAreaDidHide() const;
 
     void finishCurrentScrollAnimations() const;
+    virtual bool scrollbarAnimationsAreSuppressed() const { return false; }
 
     virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation);
     virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation);
index f4cb8d3..97ae394 100644 (file)
@@ -501,6 +501,12 @@ enum FeatureToAnimate {
     ASSERT(scrollerImp == scrollbarPainterForScrollbar(_scrollbar));
 
     ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
+    if (_scrollbar->scrollableArea()->scrollbarAnimationsAreSuppressed()) {
+        [scrollerImp setKnobAlpha:0];
+        _scrollbar->invalidate();
+        return;
+    }
+
     [self setUpAlphaAnimation:_knobAlphaAnimation scrollerPainter:scrollerPainter part:WebCore::ThumbPart animateAlphaTo:newKnobAlpha duration:duration];
 }
 
@@ -880,9 +886,10 @@ void ScrollAnimatorMac::mayBeginScrollGesture() const
 
 void ScrollAnimatorMac::finishCurrentScrollAnimations()
 {
-    if (isScrollbarOverlayAPIAvailable()) {
+    cancelAnimations();
+
+    if (isScrollbarOverlayAPIAvailable())
         [m_scrollbarPainterController.get() hideOverlayScrollers];
-    }
 }
 
 void ScrollAnimatorMac::didAddVerticalScrollbar(Scrollbar* scrollbar)
index 9911000..5ef0900 100644 (file)
@@ -1395,6 +1395,14 @@ IntRect RenderLayer::scrollableAreaBoundingBox() const
     return renderer()->absoluteBoundingBoxRect();
 }
 
+bool RenderLayer::scrollbarAnimationsAreSuppressed() const
+{
+    RenderView* view = renderer()->view();
+    if (!view)
+        return false;
+    return view->frameView()->scrollbarsCanBeActive();
+}
+
 RenderLayer* RenderLayer::enclosingTransformedAncestor() const
 {
     RenderLayer* curr = parent();
index 602be57..662f53c 100644 (file)
@@ -1037,6 +1037,7 @@ private:
     virtual bool shouldSuspendScrollAnimations() const;
     virtual bool scrollbarsCanBeActive() const;
     virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
+    virtual bool scrollbarAnimationsAreSuppressed() const OVERRIDE;
 
     // Rectangle encompassing the scroll corner and resizer rect.
     IntRect scrollCornerAndResizerRect() const;
index bd63410..33e3ed7 100644 (file)
@@ -845,6 +845,14 @@ bool RenderListBox::scrollbarsCanBeActive() const
     return view->frameView()->scrollbarsCanBeActive();
 }
 
+bool RenderListBox::scrollbarAnimationsAreSuppressed() const
+{
+    RenderView* view = this->view();
+    if (!view)
+        return false;
+    return view->frameView()->scrollbarAnimationsAreSuppressed();
+}
+
 ScrollableArea* RenderListBox::enclosingScrollableArea() const
 {
     // FIXME: Return a RenderLayer that's scrollable.
index e8e0059..f4f5849 100644 (file)
@@ -122,6 +122,7 @@ private:
     virtual bool isHandlingWheelEvent() const OVERRIDE;
     virtual bool shouldSuspendScrollAnimations() const OVERRIDE;
     virtual bool scrollbarsCanBeActive() const OVERRIDE;
+    virtual bool scrollbarAnimationsAreSuppressed() const OVERRIDE;
 
     virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
     virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;