Title: [102409] trunk/Source/WebCore
- Revision
- 102409
- Author
- [email protected]
- Date
- 2011-12-08 17:54:06 -0800 (Thu, 08 Dec 2011)
Log Message
WebScrollbarPainterDelegate should have a pointer to its Scrollbar
https://bugs.webkit.org/show_bug.cgi?id=74149
Reviewed by Darin Adler.
This is another step towards making the scroll animation code more robust.
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterDelegate initWithScrollbar:WebCore::]):
(-[WebScrollbarPainterDelegate scrollAnimator]):
(-[WebScrollbarPainterDelegate layer]):
(-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
(-[WebScrollbarPainterDelegate scrollAnimatorDestroyed]):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102408 => 102409)
--- trunk/Source/WebCore/ChangeLog 2011-12-09 01:46:49 UTC (rev 102408)
+++ trunk/Source/WebCore/ChangeLog 2011-12-09 01:54:06 UTC (rev 102409)
@@ -1,3 +1,24 @@
+2011-12-08 Anders Carlsson <[email protected]>
+
+ WebScrollbarPainterDelegate should have a pointer to its Scrollbar
+ https://bugs.webkit.org/show_bug.cgi?id=74149
+
+ Reviewed by Darin Adler.
+
+ This is another step towards making the scroll animation code more robust.
+
+ * platform/mac/ScrollAnimatorMac.mm:
+ (-[WebScrollbarPainterDelegate initWithScrollbar:WebCore::]):
+ (-[WebScrollbarPainterDelegate scrollAnimator]):
+ (-[WebScrollbarPainterDelegate layer]):
+ (-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
+ (-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
+ (-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
+ (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
+ (-[WebScrollbarPainterDelegate scrollAnimatorDestroyed]):
+ (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
+ (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
+
2011-12-08 Rakesh KN <[email protected]>
keyboard event doesn't fire while moving mouse with button pressed
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102408 => 102409)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 01:46:49 UTC (rev 102408)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 01:54:06 UTC (rev 102409)
@@ -359,7 +359,7 @@
@interface WebScrollbarPainterDelegate : NSObject<NSAnimationDelegate>
{
- WebCore::ScrollAnimatorMac* _animator;
+ WebCore::Scrollbar* _scrollbar;
RetainPtr<WebScrollbarPartAnimation> _verticalKnobAnimation;
RetainPtr<WebScrollbarPartAnimation> _horizontalKnobAnimation;
@@ -370,19 +370,19 @@
RetainPtr<WebScrollbarPartAnimation> _verticalUIStateTransitionAnimation;
RetainPtr<WebScrollbarPartAnimation> _horizontalUIStateTransitionAnimation;
}
-- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator;
+- (id)initWithScrollbar:(WebCore::Scrollbar*)scrollbar;
- (void)cancelAnimations;
@end
@implementation WebScrollbarPainterDelegate
-- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator
+- (id)initWithScrollbar:(WebCore::Scrollbar*)scrollbar
{
self = [super init];
if (!self)
return nil;
- _animator = scrollAnimator;
+ _scrollbar = scrollbar;
return self;
}
@@ -400,7 +400,7 @@
- (ScrollAnimatorMac*)scrollAnimator
{
- return _animator;
+ return static_cast<ScrollAnimatorMac*>(_scrollbar->scrollableArea()->scrollAnimator());
}
- (NSRect)convertRectToBacking:(NSRect)aRect
@@ -415,11 +415,10 @@
- (CALayer *)layer
{
- ScrollAnimatorMac* animator = [self scrollAnimator];
- if (!animator)
+ if (!_scrollbar)
return nil;
- if (!animator->isDrawingIntoLayer())
+ if (![self scrollAnimator]->isDrawingIntoLayer())
return nil;
// FIXME: This should attempt to return an actual layer.
@@ -429,7 +428,7 @@
- (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp
{
- if (![self scrollAnimator])
+ if (!_scrollbar)
return NSZeroPoint;
ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
@@ -491,7 +490,7 @@
- (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
{
- if (![self scrollAnimator])
+ if (!_scrollbar)
return;
ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
@@ -503,7 +502,7 @@
- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
{
- if (![self scrollAnimator])
+ if (!_scrollbar)
return;
ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
@@ -515,7 +514,7 @@
- (void)scrollerImp:(id)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
{
- if (![self scrollAnimator])
+ if (!_scrollbar)
return;
if (!supportsUIStateTransitionProgress())
@@ -556,7 +555,7 @@
- (void)scrollAnimatorDestroyed
{
- _animator = 0;
+ _scrollbar = 0;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[_verticalKnobAnimation.get() scrollAnimatorDestroyed];
[_horizontalKnobAnimation.get() scrollAnimatorDestroyed];
@@ -869,7 +868,7 @@
return;
ASSERT(!m_verticalScrollbarPainterDelegate);
- m_verticalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollAnimator:this]);
+ m_verticalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
[painter setDelegate:m_verticalScrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setVerticalScrollerImp:painter];
@@ -907,7 +906,7 @@
return;
ASSERT(!m_horizontalScrollbarPainterDelegate);
- m_horizontalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollAnimator:this]);
+ m_horizontalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
[painter setDelegate:m_horizontalScrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setHorizontalScrollerImp:painter];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes