Title: [102467] trunk/Source/WebCore
- Revision
- 102467
- Author
- ander...@apple.com
- Date
- 2011-12-09 13:08:10 -0800 (Fri, 09 Dec 2011)
Log Message
WebScrollbarPainterControllerDelegate should know about the ScrollableArea, not the ScrollAnimatorMac
https://bugs.webkit.org/show_bug.cgi?id=74204
Reviewed by Sam Weinig.
It makes more logical sense to associate the WebScrollbarPainterControllerDelegate object with its ScrollableArea, since
painting has nothing to do with animation.
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate initWithScrollableArea:]):
(-[WebScrollbarPainterControllerDelegate invalidate]):
(-[WebScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102466 => 102467)
--- trunk/Source/WebCore/ChangeLog 2011-12-09 20:52:00 UTC (rev 102466)
+++ trunk/Source/WebCore/ChangeLog 2011-12-09 21:08:10 UTC (rev 102467)
@@ -1,3 +1,24 @@
+2011-12-09 Anders Carlsson <ander...@apple.com>
+
+ WebScrollbarPainterControllerDelegate should know about the ScrollableArea, not the ScrollAnimatorMac
+ https://bugs.webkit.org/show_bug.cgi?id=74204
+
+ Reviewed by Sam Weinig.
+
+ It makes more logical sense to associate the WebScrollbarPainterControllerDelegate object with its ScrollableArea, since
+ painting has nothing to do with animation.
+
+ * platform/mac/ScrollAnimatorMac.mm:
+ (-[WebScrollbarPainterControllerDelegate initWithScrollableArea:]):
+ (-[WebScrollbarPainterControllerDelegate invalidate]):
+ (-[WebScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
+ (-[WebScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
+ (-[WebScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
+ (-[WebScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
+ (-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
+ (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+ (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
+
2011-12-09 Jarred Nicholls <jar...@sencha.com>
[JSC] Allow cached attributes in bindings that declare a custom mark function
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102466 => 102467)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 20:52:00 UTC (rev 102466)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-12-09 21:08:10 UTC (rev 102467)
@@ -176,67 +176,67 @@
@interface WebScrollbarPainterControllerDelegate : NSObject
{
- WebCore::ScrollAnimatorMac* _animator;
+ ScrollableArea* _scrollableArea;
}
-- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator;
+- (id)initWithScrollableArea:(ScrollableArea*)scrollableArea;
@end
@implementation WebScrollbarPainterControllerDelegate
-- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator
+- (id)initWithScrollableArea:(ScrollableArea*)scrollableArea
{
self = [super init];
if (!self)
return nil;
- _animator = scrollAnimator;
+ _scrollableArea = scrollableArea;
return self;
}
-- (void)scrollAnimatorDestroyed
+- (void)invalidate
{
- _animator = 0;
+ _scrollableArea = 0;
}
- (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
- if (!_animator)
+ if (!_scrollableArea)
return NSZeroRect;
- WebCore::IntSize contentsSize = _animator->scrollableArea()->contentsSize();
+ WebCore::IntSize contentsSize = _scrollableArea->contentsSize();
return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height());
}
- (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
- if (!_animator)
+ if (!_scrollableArea)
return NO;
- return _animator->scrollableArea()->inLiveResize();
+ return _scrollableArea->inLiveResize();
}
- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
- if (!_animator)
+ if (!_scrollableArea)
return NSZeroPoint;
- return _animator->scrollableArea()->currentMousePosition();
+ return _scrollableArea->currentMousePosition();
}
- (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(id)scrollerImp
{
UNUSED_PARAM(scrollerImpPair);
- if (!_animator)
+ if (!_scrollableArea)
return NSZeroPoint;
WebCore::Scrollbar* scrollbar = 0;
if ([scrollerImp isHorizontal])
- scrollbar = _animator->scrollableArea()->horizontalScrollbar();
+ scrollbar = _scrollableArea->horizontalScrollbar();
else
- scrollbar = _animator->scrollableArea()->verticalScrollbar();
+ scrollbar = _scrollableArea->verticalScrollbar();
// It is possible to have a null scrollbar here since it is possible for this delegate
// method to be called between the moment when a scrollbar has been set to 0 and the
@@ -245,7 +245,9 @@
// issue.
if (!scrollbar)
return WebCore::IntPoint();
-
+
+ ASSERT(scrollerImp == scrollbarPainterForScrollbar(scrollbar));
+
return scrollbar->convertFromContainingView(WebCore::IntPoint(pointInContentArea));
}
@@ -257,11 +259,12 @@
- (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
{
- if (!_animator)
+ if (!_scrollableArea)
return;
[scrollerImpPair setScrollerStyle:newRecommendedScrollerStyle];
- _animator->updateScrollerStyle();
+
+ static_cast<ScrollAnimatorMac*>(_scrollableArea->scrollAnimator())->updateScrollerStyle();
}
@end
@@ -577,7 +580,7 @@
m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
#if USE(SCROLLBAR_PAINTER)
- m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollAnimator:this]);
+ m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:scrollableArea]);
m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair") alloc] init] autorelease];
[m_scrollbarPainterController.get() setDelegate:m_scrollbarPainterControllerDelegate.get()];
[m_scrollbarPainterController.get() setScrollerStyle:wkRecommendedScrollerStyle()];
@@ -588,7 +591,7 @@
{
#if USE(SCROLLBAR_PAINTER)
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [m_scrollbarPainterControllerDelegate.get() scrollAnimatorDestroyed];
+ [m_scrollbarPainterControllerDelegate.get() invalidate];
[m_scrollbarPainterController.get() setDelegate:nil];
[m_horizontalScrollbarPainterDelegate.get() scrollAnimatorDestroyed];
[m_verticalScrollbarPainterDelegate.get() scrollAnimatorDestroyed];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes