Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 #include "platform/geometry/FloatRect.h" 32 #include "platform/geometry/FloatRect.h"
33 #include "platform/geometry/IntRect.h" 33 #include "platform/geometry/IntRect.h"
34 #include "platform/mac/BlockExceptions.h" 34 #include "platform/mac/BlockExceptions.h"
35 #include "platform/mac/NSScrollerImpDetails.h" 35 #include "platform/mac/NSScrollerImpDetails.h"
36 #include "platform/scroll/ScrollableArea.h" 36 #include "platform/scroll/ScrollableArea.h"
37 #include "platform/scroll/ScrollbarTheme.h" 37 #include "platform/scroll/ScrollbarTheme.h"
38 #include "platform/scroll/ScrollbarThemeMac.h" 38 #include "platform/scroll/ScrollbarThemeMac.h"
39 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
40 #include "public/platform/WebScheduler.h" 40 #include "public/platform/WebScheduler.h"
41 #include "wtf/MathExtras.h" 41 #include "wtf/MathExtras.h"
42 #include "wtf/PassOwnPtr.h" 42 #include "wtf/PtrUtil.h"
43 #include <memory>
43 44
44 using namespace blink; 45 using namespace blink;
45 46
46 static bool supportsUIStateTransitionProgress() 47 static bool supportsUIStateTransitionProgress()
47 { 48 {
48 // FIXME: This is temporary until all platforms that support ScrollbarPainte r support this part of the API. 49 // FIXME: This is temporary until all platforms that support ScrollbarPainte r support this part of the API.
49 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)]; 50 static bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"N SScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)];
50 return globalSupportsUIStateTransitionProgress; 51 return globalSupportsUIStateTransitionProgress;
51 } 52 }
52 53
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 double m_startTime; // In seconds. 348 double m_startTime; // In seconds.
348 double m_duration; // In seconds. 349 double m_duration; // In seconds.
349 BlinkScrollbarPartAnimation* m_animation; // Weak, owns this. 350 BlinkScrollbarPartAnimation* m_animation; // Weak, owns this.
350 RefPtr<CubicBezierTimingFunction> m_timingFunction; 351 RefPtr<CubicBezierTimingFunction> m_timingFunction;
351 }; 352 };
352 353
353 } // namespace blink 354 } // namespace blink
354 355
355 @interface BlinkScrollbarPartAnimation : NSObject { 356 @interface BlinkScrollbarPartAnimation : NSObject {
356 Scrollbar* _scrollbar; 357 Scrollbar* _scrollbar;
357 OwnPtr<BlinkScrollbarPartAnimationTimer> _timer; 358 std::unique_ptr<BlinkScrollbarPartAnimationTimer> _timer;
358 RetainPtr<ScrollbarPainter> _scrollbarPainter; 359 RetainPtr<ScrollbarPainter> _scrollbarPainter;
359 FeatureToAnimate _featureToAnimate; 360 FeatureToAnimate _featureToAnimate;
360 CGFloat _startValue; 361 CGFloat _startValue;
361 CGFloat _endValue; 362 CGFloat _endValue;
362 } 363 }
363 - (id)initWithScrollbar:(Scrollbar*)scrollbar featureToAnimate:(FeatureToAnimate )featureToAnimate animateFrom:(CGFloat)startValue animateTo:(CGFloat)endValue du ration:(NSTimeInterval)duration; 364 - (id)initWithScrollbar:(Scrollbar*)scrollbar featureToAnimate:(FeatureToAnimate )featureToAnimate animateFrom:(CGFloat)startValue animateTo:(CGFloat)endValue du ration:(NSTimeInterval)duration;
364 @end 365 @end
365 366
366 @implementation BlinkScrollbarPartAnimation 367 @implementation BlinkScrollbarPartAnimation
367 368
368 - (id)initWithScrollbar:(Scrollbar*)scrollbar featureToAnimate:(FeatureToAnimate )featureToAnimate animateFrom:(CGFloat)startValue animateTo:(CGFloat)endValue du ration:(NSTimeInterval)duration 369 - (id)initWithScrollbar:(Scrollbar*)scrollbar featureToAnimate:(FeatureToAnimate )featureToAnimate animateFrom:(CGFloat)startValue animateTo:(CGFloat)endValue du ration:(NSTimeInterval)duration
369 { 370 {
370 self = [super init]; 371 self = [super init];
371 if (!self) 372 if (!self)
372 return nil; 373 return nil;
373 374
374 _timer = adoptPtr(new BlinkScrollbarPartAnimationTimer(self, duration)); 375 _timer = wrapUnique(new BlinkScrollbarPartAnimationTimer(self, duration));
375 _scrollbar = scrollbar; 376 _scrollbar = scrollbar;
376 _featureToAnimate = featureToAnimate; 377 _featureToAnimate = featureToAnimate;
377 _startValue = startValue; 378 _startValue = startValue;
378 _endValue = endValue; 379 _endValue = endValue;
379 380
380 return self; 381 return self;
381 } 382 }
382 383
383 - (void)startAnimation 384 - (void)startAnimation
384 { 385 {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 676
676 ScrollAnimatorBase* ScrollAnimatorBase::create(ScrollableArea* scrollableArea) 677 ScrollAnimatorBase* ScrollAnimatorBase::create(ScrollableArea* scrollableArea)
677 { 678 {
678 return new ScrollAnimatorMac(scrollableArea); 679 return new ScrollAnimatorMac(scrollableArea);
679 } 680 }
680 681
681 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) 682 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
682 : ScrollAnimatorBase(scrollableArea) 683 : ScrollAnimatorBase(scrollableArea)
683 , m_initialScrollbarPaintTaskFactory(CancellableTaskFactory::create(this, &S crollAnimatorMac::initialScrollbarPaintTask)) 684 , m_initialScrollbarPaintTaskFactory(CancellableTaskFactory::create(this, &S crollAnimatorMac::initialScrollbarPaintTask))
684 , m_sendContentAreaScrolledTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::sendContentAreaScrolledTask)) 685 , m_sendContentAreaScrolledTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::sendContentAreaScrolledTask))
685 , m_taskRunner(adoptPtr(Platform::current()->currentThread()->scheduler()->t imerTaskRunner()->clone())) 686 , m_taskRunner(wrapUnique(Platform::current()->currentThread()->scheduler()- >timerTaskRunner()->clone()))
686 , m_haveScrolledSincePageLoad(false) 687 , m_haveScrolledSincePageLoad(false)
687 , m_needsScrollerStyleUpdate(false) 688 , m_needsScrollerStyleUpdate(false)
688 { 689 {
689 ThreadState::current()->registerPreFinalizer(this); 690 ThreadState::current()->registerPreFinalizer(this);
690 691
691 m_scrollAnimationHelperDelegate.adoptNS([[BlinkScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]); 692 m_scrollAnimationHelperDelegate.adoptNS([[BlinkScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
692 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); 693 m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelpe r") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
693 694
694 m_scrollbarPainterControllerDelegate.adoptNS([[BlinkScrollbarPainterControll erDelegate alloc] initWithScrollableArea:scrollableArea]); 695 m_scrollbarPainterControllerDelegate.adoptNS([[BlinkScrollbarPainterControll erDelegate alloc] initWithScrollableArea:scrollableArea]);
695 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair") al loc] init] autorelease]; 696 m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair") al loc] init] autorelease];
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar()) 1101 if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar())
1101 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr ollerThumb); 1102 rectInViewCoordinates = verticalScrollbar->convertToContainingWidget(scr ollerThumb);
1102 1103
1103 if (rectInViewCoordinates == m_visibleScrollerThumbRect) 1104 if (rectInViewCoordinates == m_visibleScrollerThumbRect)
1104 return; 1105 return;
1105 1106
1106 m_visibleScrollerThumbRect = rectInViewCoordinates; 1107 m_visibleScrollerThumbRect = rectInViewCoordinates;
1107 } 1108 }
1108 1109
1109 } // namespace blink 1110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698