Title: [102474] trunk/Source/WebCore
Revision
102474
Author
ander...@apple.com
Date
2011-12-09 14:07:08 -0800 (Fri, 09 Dec 2011)

Log Message

Minor cleanup in ScrollAnimatorMac.mm
https://bugs.webkit.org/show_bug.cgi?id=74211

Reviewed by Andreas Kling.

* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
No need to get the scrollbar from the scroll animator anymore.

(-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
Try to get data from the scrollbar and/or the scrollable area instead of the scrollbar painter.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102473 => 102474)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 22:05:12 UTC (rev 102473)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 22:07:08 UTC (rev 102474)
@@ -1,3 +1,18 @@
+2011-12-09  Anders Carlsson  <ander...@apple.com>
+
+        Minor cleanup in ScrollAnimatorMac.mm
+        https://bugs.webkit.org/show_bug.cgi?id=74211
+
+        Reviewed by Andreas Kling.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
+        No need to get the scrollbar from the scroll animator anymore.
+
+        (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
+        (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
+        Try to get data from the scrollbar and/or the scrollable area instead of the scrollbar painter.
+
 2011-12-09  David Levin  <le...@chromium.org>
 
         Regression(r53595): Sync xhr requests in workers aren't terminated on worker close.

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102473 => 102474)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-09 22:05:12 UTC (rev 102473)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-09 22:07:08 UTC (rev 102474)
@@ -426,17 +426,9 @@
     if (!_scrollbar)
         return NSZeroPoint;
 
-    ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
-    Scrollbar* scrollbar;
-    if ([scrollerPainter isHorizontal])
-        scrollbar = [self scrollAnimator]->scrollableArea()->horizontalScrollbar();
-    else 
-        scrollbar = [self scrollAnimator]->scrollableArea()->verticalScrollbar();
+    ASSERT(scrollerImp == scrollbarPainterForScrollbar(_scrollbar));
 
-    if (!scrollbar)
-        return NSZeroPoint;
-
-    return scrollbar->convertFromContainingView([self scrollAnimator]->scrollableArea()->currentMousePosition());
+    return _scrollbar->convertFromContainingView(_scrollbar->scrollableArea()->currentMousePosition());
 }
 
 - (void)setUpAlphaAnimation:(RetainPtr<WebScrollbarPartAnimation>&)scrollbarPartAnimation scrollerPainter:(ScrollbarPainter)scrollerPainter part:(WebCore::ScrollbarPart)part animateAlphaTo:(CGFloat)newAlpha duration:(NSTimeInterval)duration
@@ -448,7 +440,7 @@
     if ([self scrollAnimator]->scrollbarPaintTimerIsActive() && !mustAnimate)
         return;
 
-    if ([self scrollAnimator]->scrollableArea()->shouldSuspendScrollAnimations() && !mustAnimate) {
+    if (_scrollbar->scrollableArea()->shouldSuspendScrollAnimations() && !mustAnimate) {
         [self scrollAnimator]->startScrollbarPaintTimer();
         return;
     }
@@ -462,7 +454,7 @@
         scrollbarPartAnimation = nil;
     }
 
-    if (part == WebCore::ThumbPart && ![scrollerPainter isHorizontal]) {
+    if (part == WebCore::ThumbPart && _scrollbar->orientation() == VerticalScrollbar) {
         if (newAlpha == 1) {
             IntRect thumbRect = IntRect([scrollerPainter rectForPart:NSScrollerKnob]);
             [self scrollAnimator]->setVisibleScrollerThumbRect(thumbRect);
@@ -510,20 +502,20 @@
 
     ASSERT(scrollerImp == scrollbarPainterForScrollbar(_scrollbar));
 
-    ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
+    ScrollbarPainter scrollbarPainter = (ScrollbarPainter)scrollerImp;
 
     // UIStateTransition always animates to 1. In case an animation is in progress this avoids a hard transition.
-    [scrollerPainter setUiStateTransitionProgress:1 - [scrollerPainter uiStateTransitionProgress]];
+    [scrollbarPainter setUiStateTransitionProgress:1 - [scrollerImp uiStateTransitionProgress]];
 
     if (!_uiStateTransitionAnimation)
         _uiStateTransitionAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar 
                                                                                 featureToAnimate:UIStateTransition
-                                                                                     animateFrom:[scrollerPainter uiStateTransitionProgress]
+                                                                                     animateFrom:[scrollbarPainter uiStateTransitionProgress]
                                                                                        animateTo:1.0
                                                                                         duration:duration]);
     else {
         // If we don't need to initialize the animation, just reset the values in case they have changed.
-        [_uiStateTransitionAnimation.get() setStartValue:[scrollerPainter uiStateTransitionProgress]];
+        [_uiStateTransitionAnimation.get() setStartValue:[scrollbarPainter uiStateTransitionProgress]];
         [_uiStateTransitionAnimation.get() setEndValue:1.0];
         [_uiStateTransitionAnimation.get() setDuration:duration];
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to