Changeset 196246 in webkit


Ignore:
Timestamp:
Feb 7, 2016 7:01:07 PM (8 years ago)
Author:
weinig@apple.com
Message:

Use modern SPI header idiom for NSScrollerImp and NSScrollerImpPair
https://bugs.webkit.org/show_bug.cgi?id=153969

Reviewed by Dan Bernstein.

  • WebCore.xcodeproj/project.pbxproj:

Add new file NSScrollerImpSPI.h

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

Use new include of NSScrollerImpSPI.h.

  • platform/ScrollbarThemeComposite.h:

Define ScrollbarPainter more precisely as NSScrollerImp * now that the type is available to us.

  • platform/mac/NSScrollerImpDetails.h:

Remove NSObject category based SPI usage with the modern one NSScrollerImpSPI.h

  • platform/mac/NSScrollerImpDetails.mm:

(WebCore::recommendedScrollerStyle):
Simplify recommendedScrollerStyle() now that all OS's we ship on have +[NSScroller preferredScrollerStyle].

  • platform/mac/ScrollAnimatorMac.mm:

(supportsUIStateTransitionProgress):
(supportsExpansionTransitionProgress):
(supportsContentAreaScrolledInDirection):
Stop using NSClassFromString now that we can reference the classes explicitly.

(-[WebScrollbarPainterControllerDelegate invalidate]):
(-[WebScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
(-[WebScrollbarPainterDelegate layer]):
(-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
(-[WebScrollbarPainterDelegate convertRectToLayer:]):
(-[WebScrollbarPainterDelegate shouldUseLayerPerPartForScrollerImp:]):
(-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
(-[WebScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
Add proper conforming to protocols and replace ids with proper types.

  • platform/mac/ScrollbarThemeMac.mm:

(WebCore::supportsExpandedScrollbars):
(WebCore::ScrollbarThemeMac::registerScrollbar):
(WebCore::ScrollbarThemeMac::scrollbarThickness):
(WebCore::ScrollbarThemeMac::setUpContentShadowLayer):
Stop using NSClassFromString now that we can reference the classes explicitly.

  • platform/spi/mac/NSScrollerImpSPI.h: Added.
Location:
trunk/Source/WebCore
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r196244 r196246  
     12016-02-07  Sam Weinig  <sam@webkit.org>
     2
     3        Use modern SPI header idiom for NSScrollerImp and NSScrollerImpPair
     4        https://bugs.webkit.org/show_bug.cgi?id=153969
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * WebCore.xcodeproj/project.pbxproj:
     9        Add new file NSScrollerImpSPI.h
     10
     11        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     12        Use new include of NSScrollerImpSPI.h.
     13
     14        * platform/ScrollbarThemeComposite.h:
     15        Define ScrollbarPainter more precisely as NSScrollerImp * now that the type is available to us.
     16
     17        * platform/mac/NSScrollerImpDetails.h:
     18        Remove NSObject category based SPI usage with the modern one NSScrollerImpSPI.h
     19
     20        * platform/mac/NSScrollerImpDetails.mm:
     21        (WebCore::recommendedScrollerStyle):
     22        Simplify recommendedScrollerStyle() now that all OS's we ship on have +[NSScroller preferredScrollerStyle].
     23
     24        * platform/mac/ScrollAnimatorMac.mm:
     25        (supportsUIStateTransitionProgress):
     26        (supportsExpansionTransitionProgress):
     27        (supportsContentAreaScrolledInDirection):
     28        Stop using NSClassFromString now that we can reference the classes explicitly.
     29
     30        (-[WebScrollbarPainterControllerDelegate invalidate]):
     31        (-[WebScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
     32        (-[WebScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
     33        (-[WebScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
     34        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
     35        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
     36        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
     37        (-[WebScrollbarPainterDelegate layer]):
     38        (-[WebScrollbarPainterDelegate mouseLocationInScrollerForScrollerImp:]):
     39        (-[WebScrollbarPainterDelegate convertRectToLayer:]):
     40        (-[WebScrollbarPainterDelegate shouldUseLayerPerPartForScrollerImp:]):
     41        (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
     42        (-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
     43        (-[WebScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
     44        (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
     45        (-[WebScrollbarPainterDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
     46        (-[WebScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):
     47        (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
     48        (WebCore::ScrollAnimatorMac::lockOverlayScrollbarStateToHidden):
     49        (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
     50        (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
     51        (WebCore::ScrollAnimatorMac::updateScrollerStyle):
     52        Add proper conforming to protocols and replace ids with proper types.
     53
     54        * platform/mac/ScrollbarThemeMac.mm:
     55        (WebCore::supportsExpandedScrollbars):
     56        (WebCore::ScrollbarThemeMac::registerScrollbar):
     57        (WebCore::ScrollbarThemeMac::scrollbarThickness):
     58        (WebCore::ScrollbarThemeMac::setUpContentShadowLayer):
     59        Stop using NSClassFromString now that we can reference the classes explicitly.
     60
     61        * platform/spi/mac/NSScrollerImpSPI.h: Added.
     62
    1632016-02-07  Zalan Bujtas  <zalan@apple.com>
    264
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r196128 r196246  
    41694169                A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */ = {isa = PBXBuildFile; fileRef = A501920C132EBF2E008BFE55 /* Autocapitalize.h */; settings = {ATTRIBUTES = (Private, ); }; };
    41704170                A502C5DF13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A502C5DD13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h */; };
     4171                A5071E801C506B66009951BE /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */; };
     4172                A5071E811C506B69009951BE /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */; };
    41714173                A5071E851C56D0DC009951BE /* ResourceUsageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E821C56D079009951BE /* ResourceUsageData.h */; };
    41724174                A5071E861C56D0DF009951BE /* ResourceUsageThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E831C56D079009951BE /* ResourceUsageThread.cpp */; };
     
    41744176                A5071E891C56D4FE009951BE /* ResourceUsageThreadCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */; };
    41754177                A5071E8B1C56FB31009951BE /* ResourceUsageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E8A1C56FAFA009951BE /* ResourceUsageData.cpp */; };
    4176                 A5071E801C506B66009951BE /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */; };
    4177                 A5071E811C506B69009951BE /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */; };
    41784178                A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */; };
    41794179                A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */; };
     
    1028810288                7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVTTRegionList.cpp; sourceTree = "<group>"; };
    1028910289                7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
     10290                7C0406121C66EE9C00AF0711 /* NSScrollerImpSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSScrollerImpSPI.h; sourceTree = "<group>"; };
    1029010291                7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoFillButtonElement.cpp; sourceTree = "<group>"; };
    1029110292                7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
     
    1180611807                A501920C132EBF2E008BFE55 /* Autocapitalize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Autocapitalize.h; sourceTree = "<group>"; };
    1180711808                A502C5DD13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSafeGCActivityCallbackIOS.h; sourceTree = "<group>"; };
     11809                A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; };
     11810                A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; };
    1180811811                A5071E821C56D079009951BE /* ResourceUsageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUsageData.h; sourceTree = "<group>"; };
    1180911812                A5071E831C56D079009951BE /* ResourceUsageThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUsageThread.cpp; sourceTree = "<group>"; };
     
    1181111814                A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceUsageThreadCocoa.mm; sourceTree = "<group>"; };
    1181211815                A5071E8A1C56FAFA009951BE /* ResourceUsageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUsageData.cpp; sourceTree = "<group>"; };
    11813                 A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; };
    11814                 A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; };
    1181511816                A516E8B4136E04DB0076C3C0 /* LocalizedDateCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedDateCache.h; sourceTree = "<group>"; };
    1181611817                A516E8B5136E04DB0076C3C0 /* LocalizedDateCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalizedDateCache.mm; sourceTree = "<group>"; };
     
    1887318874                                937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
    1887418875                                93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */,
     18876                                7C0406121C66EE9C00AF0711 /* NSScrollerImpSPI.h */,
    1887518877                                F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */,
    1887618878                                2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r196226 r196246  
    3232#import "LayoutSize.h"
    3333#import "Logging.h"
    34 #import "NSScrollerImpDetails.h"
     34#import "NSScrollerImpSPI.h"
    3535#import "PlatformWheelEvent.h"
    3636#import "ScrollableArea.h"
  • trunk/Source/WebCore/platform/ScrollbarThemeComposite.h

    r189144 r196246  
    3030
    3131#if PLATFORM(COCOA)
    32 typedef id ScrollbarPainter;
     32OBJC_CLASS NSScrollerImp;
     33typedef NSScrollerImp *ScrollbarPainter;
    3334#else
    3435typedef void* ScrollbarPainter;
  • trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h

    r194318 r196246  
    2727#define WebCore_NSScrollerImpDetails_h
    2828
    29 // Public APIs not available on versions of Mac on which we build
    30 
    31 @interface NSObject (ScrollbarPainter)
    32 + (id)scrollerImpWithStyle:(NSScrollerStyle)newScrollerStyle controlSize:(NSControlSize)newControlSize horizontal:(BOOL)horizontal replacingScrollerImp:(id)previous;
    33 - (CGFloat)knobAlpha;
    34 - (void)setKnobAlpha:(CGFloat)knobAlpha;
    35 - (CGFloat)trackAlpha;
    36 - (void)setTrackAlpha:(CGFloat)trackAlpha;
    37 - (void)setEnabled:(BOOL)enabled;
    38 - (void)setBoundsSize:(NSSize)boundsSize;
    39 - (void)setDoubleValue:(double)doubleValue;
    40 - (void)setPresentationValue:(double)presentationValue;
    41 - (BOOL)shouldUsePresentationValue;
    42 - (void)setUsePresentationValue:(BOOL)usePresentationValue;
    43 - (void)setKnobProportion:(CGFloat)proportion;
    44 - (void)setKnobStyle:(NSScrollerKnobStyle)knobStyle;
    45 - (void)setExpanded:(BOOL)expanded;
    46 - (BOOL)isExpanded;
    47 - (void)setDelegate:(id)delegate;
    48 - (void)setUiStateTransitionProgress:(CGFloat)uiStateTransitionProgress;
    49 - (void)setExpansionTransitionProgress:(CGFloat)expansionTransitionProgress;
    50 - (BOOL)isHorizontal;
    51 - (CGFloat)trackWidth;
    52 - (CGFloat)trackBoxWidth;
    53 - (CGFloat)knobMinLength;
    54 - (CGFloat)trackOverlapEndInset;
    55 - (CGFloat)knobOverlapEndInset;
    56 - (CGFloat)trackEndInset;
    57 - (CGFloat)knobEndInset;
    58 - (CGFloat)uiStateTransitionProgress;
    59 - (CGFloat)expansionTransitionProgress;
    60 - (NSRect)rectForPart:(NSScrollerPart)partCode;
    61 - (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag alpha:(CGFloat)alpha;
    62 - (void)drawKnob;
    63 - (void)mouseEnteredScroller;
    64 - (void)mouseExitedScroller;
    65 - (void)setTracking:(BOOL)tracking;
    66 - (void)setNeedsDisplay:(BOOL)flag;
    67 @end
    68 
    69 @interface NSObject (ScrollbarPainterController)
    70 - (void)setDelegate:(id)delegate;
    71 - (void)hideOverlayScrollers;
    72 - (void)flashScrollers;
    73 - (void)lockOverlayScrollerState:(NSUInteger)state;
    74 - (BOOL)overlayScrollerStateIsLocked;
    75 - (void)unlockOverlayScrollerState;
    76 - (id)horizontalScrollerImp;
    77 - (void)setHorizontalScrollerImp:(id)horizontal;
    78 - (id)verticalScrollerImp;
    79 - (void)setVerticalScrollerImp:(id)vertical;
    80 - (NSScrollerStyle)scrollerStyle;
    81 - (void)setScrollerStyle:(NSScrollerStyle)scrollerStyle;
    82 - (void)contentAreaScrolled;
    83 - (void)contentAreaScrolledInDirection:(NSPoint)direction;
    84 - (void)contentAreaWillDraw;
    85 - (void)mouseEnteredContentArea;
    86 - (void)mouseExitedContentArea;
    87 - (void)mouseMovedInContentArea;
    88 - (void)startLiveResize;
    89 - (void)contentAreaDidResize;
    90 - (void)endLiveResize;
    91 - (void)windowOrderedIn;
    92 - (void)windowOrderedOut;
    93 - (void)beginScrollGesture;
    94 - (void)endScrollGesture;
    95 @end
    96 
    9729namespace WebCore {
    9830
  • trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.mm

    r147860 r196246  
    2828#include "config.h"
    2929#include "NSScrollerImpDetails.h"
     30
    3031#include "Settings.h"
    3132
    3233namespace WebCore {
    3334
    34 NSScrollerStyle recommendedScrollerStyle() {
     35NSScrollerStyle recommendedScrollerStyle()
     36{
    3537    if (Settings::usesOverlayScrollbars())
    3638        return NSScrollerStyleOverlay;
    37     if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)])
    38         return [NSScroller preferredScrollerStyle];
    39     return NSScrollerStyleLegacy;
     39    return [NSScroller preferredScrollerStyle];
    4040}
    4141
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r195810 r196246  
    3535#include "Logging.h"
    3636#include "NSScrollerImpDetails.h"
     37#include "NSScrollerImpSPI.h"
    3738#include "PlatformWheelEvent.h"
    3839#include "ScrollView.h"
     
    4849{
    4950    // FIXME: This is temporary until all platforms that support ScrollbarPainter support this part of the API.
    50     static const bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)];
     51    static const bool globalSupportsUIStateTransitionProgress = [[NSScrollerImp class] instancesRespondToSelector:@selector(mouseEnteredScroller)];
    5152    return globalSupportsUIStateTransitionProgress;
    5253}
     
    5455static bool supportsExpansionTransitionProgress()
    5556{
    56     static const bool globalSupportsExpansionTransitionProgress = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(expansionTransitionProgress)];
     57    static const bool globalSupportsExpansionTransitionProgress = [[NSScrollerImp class] instancesRespondToSelector:@selector(expansionTransitionProgress)];
    5758    return globalSupportsExpansionTransitionProgress;
    5859}
     
    6061static bool supportsContentAreaScrolledInDirection()
    6162{
    62     static const bool globalSupportsContentAreaScrolledInDirection = [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@selector(contentAreaScrolledInDirection:)];
     63    static const bool globalSupportsContentAreaScrolledInDirection = [[NSScrollerImpPair class] instancesRespondToSelector:@selector(contentAreaScrolledInDirection:)];
    6364    return globalSupportsContentAreaScrolledInDirection;
    6465}
     
    182183@end
    183184
    184 @interface WebScrollbarPainterControllerDelegate : NSObject
     185@interface WebScrollbarPainterControllerDelegate : NSObject <NSScrollerImpPairDelegate>
    185186{
    186187    ScrollableArea* _scrollableArea;
     
    206207}
    207208
    208 - (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair
     209- (NSRect)contentAreaRectForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
    209210{
    210211    UNUSED_PARAM(scrollerImpPair);
     
    216217}
    217218
    218 - (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair
     219- (BOOL)inLiveResizeForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
    219220{
    220221    UNUSED_PARAM(scrollerImpPair);
     
    225226}
    226227
    227 - (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair
     228- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
    228229{
    229230    UNUSED_PARAM(scrollerImpPair);
     
    234235}
    235236
    236 - (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(id)scrollerImp
     237- (NSPoint)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(NSScrollerImp *)scrollerImp
    237238{
    238239    UNUSED_PARAM(scrollerImpPair);
     
    260261}
    261262
    262 - (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
     263- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
    263264{
    264265    UNUSED_PARAM(scrollerImpPair);
     
    274275}
    275276
    276 - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
     277- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
    277278{
    278279    if (!_scrollableArea)
     
    382383@end
    383384
    384 @interface WebScrollbarPainterDelegate : NSObject<NSAnimationDelegate>
     385@interface WebScrollbarPainterDelegate : NSObject<NSAnimationDelegate, NSScrollerImpDelegate>
    385386{
    386387    WebCore::Scrollbar* _scrollbar;
     
    450451}
    451452
    452 - (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp
     453- (NSPoint)mouseLocationInScrollerForScrollerImp:(NSScrollerImp *)scrollerImp
    453454{
    454455    if (!_scrollbar)
     
    465466}
    466467
    467 - (BOOL)shouldUseLayerPerPartForScrollerImp:(id)scrollerImp
     468- (BOOL)shouldUseLayerPerPartForScrollerImp:(NSScrollerImp *)scrollerImp
    468469{
    469470    UNUSED_PARAM(scrollerImp);
     
    517518}
    518519
    519 - (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
     520- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
    520521{
    521522    if (!_scrollbar)
     
    540541}
    541542
    542 - (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
     543- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
    543544{
    544545    if (!_scrollbar)
     
    551552}
    552553
    553 - (void)scrollerImp:(id)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
     554- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
    554555{
    555556    if (!_scrollbar)
     
    585586}
    586587
    587 - (void)scrollerImp:(id)scrollerImp animateExpansionTransitionWithDuration:(NSTimeInterval)duration
     588- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateExpansionTransitionWithDuration:(NSTimeInterval)duration
    588589{
    589590    if (!_scrollbar)
     
    615616}
    616617
    617 - (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState
     618- (void)scrollerImp:(NSScrollerImp *)scrollerImp overlayScrollerStateChangedTo:(NSOverlayScrollerState)newOverlayScrollerState
    618619{
    619620    UNUSED_PARAM(scrollerImp);
     
    652653
    653654    m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:&scrollableArea]);
    654     m_scrollbarPainterController = adoptNS([[NSClassFromString(@"NSScrollerImpPair") alloc] init]);
    655     [m_scrollbarPainterController setDelegate:(id)m_scrollbarPainterControllerDelegate.get()];
     655    m_scrollbarPainterController = adoptNS([[NSScrollerImpPair alloc] init]);
     656    [m_scrollbarPainterController setDelegate:m_scrollbarPainterControllerDelegate.get()];
    656657    [m_scrollbarPainterController setScrollerStyle:recommendedScrollerStyle()];
    657658}
     
    953954{
    954955    if (shouldLockState)
    955         [m_scrollbarPainterController lockOverlayScrollerState:ScrollbarOverlayStateHidden];
     956        [m_scrollbarPainterController lockOverlayScrollerState:NSOverlayScrollerStateHidden];
    956957    else {
    957958        [m_scrollbarPainterController unlockOverlayScrollerState];
     
    978979    m_verticalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
    979980
    980     [painter setDelegate:(id)m_verticalScrollbarPainterDelegate.get()];
     981    [painter setDelegate:m_verticalScrollbarPainterDelegate.get()];
    981982    if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForVerticalScrollbar())
    982983        [painter setLayer:layer->platformLayer()];
     
    10101011    m_horizontalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
    10111012
    1012     [painter setDelegate:(id)m_horizontalScrollbarPainterDelegate.get()];
     1013    [painter setDelegate:m_horizontalScrollbarPainterDelegate.get()];
    10131014    if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForHorizontalScrollbar())
    10141015        [painter setLayer:layer->platformLayer()];
     
    13321333
    13331334        ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController verticalScrollerImp];
    1334         ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:newStyle
    1335                                                                                     controlSize:(NSControlSize)verticalScrollbar->controlSize()
    1336                                                                                     horizontal:NO
    1337                                                                                     replacingScrollerImp:oldVerticalPainter];
     1335        ScrollbarPainter newVerticalPainter = [NSScrollerImp scrollerImpWithStyle:newStyle controlSize:(NSControlSize)verticalScrollbar->controlSize() horizontal:NO replacingScrollerImp:oldVerticalPainter];
     1336
    13381337        [m_scrollbarPainterController setVerticalScrollerImp:newVerticalPainter];
    13391338        macTheme->setNewPainterForScrollbar(*verticalScrollbar, newVerticalPainter);
     
    13501349
    13511350        ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController horizontalScrollerImp];
    1352         ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:newStyle
    1353                                                                                     controlSize:(NSControlSize)horizontalScrollbar->controlSize()
    1354                                                                                     horizontal:YES
    1355                                                                                     replacingScrollerImp:oldHorizontalPainter];
     1351        ScrollbarPainter newHorizontalPainter = [NSScrollerImp scrollerImpWithStyle:newStyle controlSize:(NSControlSize)horizontalScrollbar->controlSize() horizontal:YES replacingScrollerImp:oldHorizontalPainter];
     1352
    13561353        [m_scrollbarPainterController setHorizontalScrollerImp:newHorizontalPainter];
    13571354        macTheme->setNewPainterForScrollbar(*horizontalScrollbar, newHorizontalPainter);
  • trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm

    r194318 r196246  
    2929#include "BlockExceptions.h"
    3030#include "ColorMac.h"
     31#include "GraphicsLayer.h"
    3132#include "ImageBuffer.h"
    32 #include "GraphicsLayer.h"
    3333#include "LocalCurrentGraphicsContext.h"
    3434#include "NSScrollerImpDetails.h"
     35#include "NSScrollerImpSPI.h"
    3536#include "PlatformMouseEvent.h"
    3637#include "ScrollAnimatorMac.h"
     
    139140{
    140141    // FIXME: This is temporary until all platforms that support ScrollbarPainter support this part of the API.
    141     static bool globalSupportsExpandedScrollbars = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(setExpanded:)];
     142    static bool globalSupportsExpandedScrollbars = [[NSScrollerImp class] instancesRespondToSelector:@selector(setExpanded:)];
    142143    return globalSupportsExpandedScrollbars;
    143144}
     
    162163
    163164    bool isHorizontal = scrollbar.orientation() == HorizontalScrollbar;
    164     ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar.controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
     165    ScrollbarPainter scrollbarPainter = [NSScrollerImp scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar.controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
    165166    scrollbarMap()->add(&scrollbar, scrollbarPainter);
    166167    updateEnabledState(scrollbar);
     
    225226{
    226227    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    227     ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
     228    ScrollbarPainter scrollbarPainter = [NSScrollerImp scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
    228229    if (supportsExpandedScrollbars())
    229230        [scrollbarPainter setExpanded:YES];
     
    589590    setUpOverhangAreaShadow(graphicsLayer->platformLayer());
    590591}
    591 
    592592#endif
    593593
Note: See TracChangeset for help on using the changeset viewer.