Title: [102406] trunk/Source/WebCore
Revision
102406
Author
[email protected]
Date
2011-12-08 17:35:25 -0800 (Thu, 08 Dec 2011)

Log Message

Add scrollAnimator getter method to WebScrollbarPainterDelegate
https://bugs.webkit.org/show_bug.cgi?id=74146

Reviewed by Beth Dakin.

* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterDelegate scrollAnimator]):
(-[WebScrollbarPainterDelegate layer]):
(-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
(-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102405 => 102406)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 01:33:41 UTC (rev 102405)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 01:35:25 UTC (rev 102406)
@@ -1,3 +1,19 @@
+2011-12-08  Anders Carlsson  <[email protected]>
+
+        Add scrollAnimator getter method to WebScrollbarPainterDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=74146
+
+        Reviewed by Beth Dakin.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPainterDelegate scrollAnimator]):
+        (-[WebScrollbarPainterDelegate layer]):
+        (-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
+        (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
+        (-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
+        (-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
+        (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
+
 2011-12-08  James Robinson  <[email protected]>
 
         Improve handling of frame removal during requestAnimationFrame callback invocation

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102405 => 102406)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-09 01:33:41 UTC (rev 102405)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-09 01:35:25 UTC (rev 102406)
@@ -398,6 +398,11 @@
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
+- (ScrollAnimatorMac*)scrollAnimator
+{
+    return _animator;
+}
+
 - (NSRect)convertRectToBacking:(NSRect)aRect
 {
     return aRect;
@@ -410,9 +415,11 @@
 
 - (CALayer *)layer
 {
-    if (!_animator)
+    ScrollAnimatorMac* animator = [self scrollAnimator];
+    if (!animator)
         return nil;
-    if (!_animator->isDrawingIntoLayer())
+
+    if (!animator->isDrawingIntoLayer())
         return nil;
 
     // FIXME: This should attempt to return an actual layer.
@@ -422,38 +429,38 @@
 
 - (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp
 {
-    if (!_animator)
+    if (![self scrollAnimator])
         return NSZeroPoint;
 
     ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
     Scrollbar* scrollbar;
     if ([scrollerPainter isHorizontal])
-        scrollbar = _animator->scrollableArea()->horizontalScrollbar();
+        scrollbar = [self scrollAnimator]->scrollableArea()->horizontalScrollbar();
     else 
-        scrollbar = _animator->scrollableArea()->verticalScrollbar();
+        scrollbar = [self scrollAnimator]->scrollableArea()->verticalScrollbar();
 
     if (!scrollbar)
         return NSZeroPoint;
 
-    return scrollbar->convertFromContainingView(_animator->scrollableArea()->currentMousePosition());
+    return scrollbar->convertFromContainingView([self scrollAnimator]->scrollableArea()->currentMousePosition());
 }
 
 - (void)setUpAlphaAnimation:(RetainPtr<WebScrollbarPartAnimation>&)scrollbarPartAnimation scrollerPainter:(ScrollbarPainter)scrollerPainter part:(WebCore::ScrollbarPart)part animateAlphaTo:(CGFloat)newAlpha duration:(NSTimeInterval)duration
 {
     // If the user has scrolled the page, then the scrollbars must be animated here. 
     // This overrides the early returns.
-    bool mustAnimate = _animator->haveScrolledSincePageLoad();
+    bool mustAnimate = [self scrollAnimator]->haveScrolledSincePageLoad();
 
-    if (_animator->scrollbarPaintTimerIsActive() && !mustAnimate)
+    if ([self scrollAnimator]->scrollbarPaintTimerIsActive() && !mustAnimate)
         return;
 
-    if (_animator->scrollableArea()->shouldSuspendScrollAnimations() && !mustAnimate) {
-        _animator->startScrollbarPaintTimer();
+    if ([self scrollAnimator]->scrollableArea()->shouldSuspendScrollAnimations() && !mustAnimate) {
+        [self scrollAnimator]->startScrollbarPaintTimer();
         return;
     }
 
     // At this point, we are definitely going to animate now, so stop the timer.
-    _animator->stopScrollbarPaintTimer();
+    [self scrollAnimator]->stopScrollbarPaintTimer();
 
     // If we are currently animating, stop
     if (scrollbarPartAnimation) {
@@ -464,16 +471,16 @@
     if (part == WebCore::ThumbPart && ![scrollerPainter isHorizontal]) {
         if (newAlpha == 1) {
             IntRect thumbRect = IntRect([scrollerPainter rectForPart:NSScrollerKnob]);
-            _animator->setVisibleScrollerThumbRect(thumbRect);
+            [self scrollAnimator]->setVisibleScrollerThumbRect(thumbRect);
         } else
-            _animator->setVisibleScrollerThumbRect(IntRect());
+            [self scrollAnimator]->setVisibleScrollerThumbRect(IntRect());
     }
 
     [NSAnimationContext beginGrouping];
     [[NSAnimationContext currentContext] setDuration:duration];
     scrollbarPartAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbarPainter:scrollerPainter 
                                                                     animate:part == ThumbPart ? ThumbAlpha : TrackAlpha
-                                                                    scrollAnimator:_animator
+                                                                    scrollAnimator:[self scrollAnimator]
                                                                     animateFrom:part == ThumbPart ? [scrollerPainter knobAlpha] : [scrollerPainter trackAlpha]
                                                                     animateTo:newAlpha 
                                                                     duration:duration]);
@@ -484,7 +491,7 @@
 
 - (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
 {
-    if (!_animator)
+    if (![self scrollAnimator])
         return;
 
     ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
@@ -496,7 +503,7 @@
 
 - (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
 {
-    if (!_animator)
+    if (![self scrollAnimator])
         return;
 
     ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
@@ -508,7 +515,7 @@
 
 - (void)scrollerImp:(id)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
 {
-    if (!_animator)
+    if (![self scrollAnimator])
         return;
 
     if (!supportsUIStateTransitionProgress())
@@ -525,7 +532,7 @@
     if (!scrollbarPartAnimation) {
         scrollbarPartAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbarPainter:scrollerPainter 
                                                                     animate:UIStateTransition
-                                                                    scrollAnimator:_animator
+                                                                    scrollAnimator:[self scrollAnimator]
                                                                     animateFrom:[scrollerPainter uiStateTransitionProgress]
                                                                     animateTo:1.0 
                                                                     duration:duration]);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to