Diff
Modified: trunk/Source/WebCore/ChangeLog (196245 => 196246)
--- trunk/Source/WebCore/ChangeLog 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/ChangeLog 2016-02-08 03:01:07 UTC (rev 196246)
@@ -1,3 +1,65 @@
+2016-02-07 Sam Weinig <s...@webkit.org>
+
+ 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.
+
2016-02-07 Zalan Bujtas <za...@apple.com>
Outline does not clip when ancestor has overflow: hidden and requires layer.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (196245 => 196246)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-02-08 03:01:07 UTC (rev 196246)
@@ -4168,13 +4168,13 @@
A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A456FA2511AD4A830020B420 /* LabelsNodeList.h */; };
A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */ = {isa = PBXBuildFile; fileRef = A501920C132EBF2E008BFE55 /* Autocapitalize.h */; settings = {ATTRIBUTES = (Private, ); }; };
A502C5DF13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A502C5DD13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h */; };
+ A5071E801C506B66009951BE /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */; };
+ A5071E811C506B69009951BE /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */; };
A5071E851C56D0DC009951BE /* ResourceUsageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E821C56D079009951BE /* ResourceUsageData.h */; };
A5071E861C56D0DF009951BE /* ResourceUsageThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E831C56D079009951BE /* ResourceUsageThread.cpp */; };
A5071E871C56D0E1009951BE /* ResourceUsageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E841C56D079009951BE /* ResourceUsageThread.h */; };
A5071E891C56D4FE009951BE /* ResourceUsageThreadCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */; };
A5071E8B1C56FB31009951BE /* ResourceUsageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E8A1C56FAFA009951BE /* ResourceUsageData.cpp */; };
- A5071E801C506B66009951BE /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */; };
- A5071E811C506B69009951BE /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */; };
A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */; };
A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */; };
A516E8B7136E04DB0076C3C0 /* LocalizedDateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A516E8B4136E04DB0076C3C0 /* LocalizedDateCache.h */; };
@@ -10287,6 +10287,7 @@
7AF9B20918CFB5F200C64BEF /* JSVTTRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegion.h; sourceTree = "<group>"; };
7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVTTRegionList.cpp; sourceTree = "<group>"; };
7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
+ 7C0406121C66EE9C00AF0711 /* NSScrollerImpSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSScrollerImpSPI.h; sourceTree = "<group>"; };
7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoFillButtonElement.cpp; sourceTree = "<group>"; };
7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
@@ -11805,13 +11806,13 @@
A456FA2511AD4A830020B420 /* LabelsNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelsNodeList.h; sourceTree = "<group>"; };
A501920C132EBF2E008BFE55 /* Autocapitalize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Autocapitalize.h; sourceTree = "<group>"; };
A502C5DD13049B3500FC7D53 /* WebSafeGCActivityCallbackIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSafeGCActivityCallbackIOS.h; sourceTree = "<group>"; };
+ A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; };
+ A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; };
A5071E821C56D079009951BE /* ResourceUsageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUsageData.h; sourceTree = "<group>"; };
A5071E831C56D079009951BE /* ResourceUsageThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUsageThread.cpp; sourceTree = "<group>"; };
A5071E841C56D079009951BE /* ResourceUsageThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUsageThread.h; sourceTree = "<group>"; };
A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceUsageThreadCocoa.mm; sourceTree = "<group>"; };
A5071E8A1C56FAFA009951BE /* ResourceUsageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUsageData.cpp; sourceTree = "<group>"; };
- A5071E7E1C5067A0009951BE /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; };
- A5071E7F1C5067A0009951BE /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; };
A516E8B4136E04DB0076C3C0 /* LocalizedDateCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedDateCache.h; sourceTree = "<group>"; };
A516E8B5136E04DB0076C3C0 /* LocalizedDateCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalizedDateCache.mm; sourceTree = "<group>"; };
A518225417E2A0D400A9BA1D /* InspectorOverlayPage.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = InspectorOverlayPage.css; sourceTree = "<group>"; };
@@ -18872,6 +18873,7 @@
9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */,
+ 7C0406121C66EE9C00AF0711 /* NSScrollerImpSPI.h */,
F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */,
2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (196245 => 196246)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2016-02-08 03:01:07 UTC (rev 196246)
@@ -31,7 +31,7 @@
#import "FrameView.h"
#import "LayoutSize.h"
#import "Logging.h"
-#import "NSScrollerImpDetails.h"
+#import "NSScrollerImpSPI.h"
#import "PlatformWheelEvent.h"
#import "ScrollableArea.h"
#import "ScrollingCoordinator.h"
Modified: trunk/Source/WebCore/platform/ScrollbarThemeComposite.h (196245 => 196246)
--- trunk/Source/WebCore/platform/ScrollbarThemeComposite.h 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/platform/ScrollbarThemeComposite.h 2016-02-08 03:01:07 UTC (rev 196246)
@@ -29,7 +29,8 @@
#include "ScrollbarTheme.h"
#if PLATFORM(COCOA)
-typedef id ScrollbarPainter;
+OBJC_CLASS NSScrollerImp;
+typedef NSScrollerImp *ScrollbarPainter;
#else
typedef void* ScrollbarPainter;
#endif
Modified: trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h (196245 => 196246)
--- trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h 2016-02-08 03:01:07 UTC (rev 196246)
@@ -26,74 +26,6 @@
#ifndef WebCore_NSScrollerImpDetails_h
#define WebCore_NSScrollerImpDetails_h
-// Public APIs not available on versions of Mac on which we build
-
-@interface NSObject (ScrollbarPainter)
-+ (id)scrollerImpWithStyle:(NSScrollerStyle)newScrollerStyle controlSize:(NSControlSize)newControlSize horizontal:(BOOL)horizontal replacingScrollerImp:(id)previous;
-- (CGFloat)knobAlpha;
-- (void)setKnobAlpha:(CGFloat)knobAlpha;
-- (CGFloat)trackAlpha;
-- (void)setTrackAlpha:(CGFloat)trackAlpha;
-- (void)setEnabled:(BOOL)enabled;
-- (void)setBoundsSize:(NSSize)boundsSize;
-- (void)setDoubleValue:(double)doubleValue;
-- (void)setPresentationValue:(double)presentationValue;
-- (BOOL)shouldUsePresentationValue;
-- (void)setUsePresentationValue:(BOOL)usePresentationValue;
-- (void)setKnobProportion:(CGFloat)proportion;
-- (void)setKnobStyle:(NSScrollerKnobStyle)knobStyle;
-- (void)setExpanded:(BOOL)expanded;
-- (BOOL)isExpanded;
-- (void)setDelegate:(id)delegate;
-- (void)setUiStateTransitionProgress:(CGFloat)uiStateTransitionProgress;
-- (void)setExpansionTransitionProgress:(CGFloat)expansionTransitionProgress;
-- (BOOL)isHorizontal;
-- (CGFloat)trackWidth;
-- (CGFloat)trackBoxWidth;
-- (CGFloat)knobMinLength;
-- (CGFloat)trackOverlapEndInset;
-- (CGFloat)knobOverlapEndInset;
-- (CGFloat)trackEndInset;
-- (CGFloat)knobEndInset;
-- (CGFloat)uiStateTransitionProgress;
-- (CGFloat)expansionTransitionProgress;
-- (NSRect)rectForPart:(NSScrollerPart)partCode;
-- (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag alpha:(CGFloat)alpha;
-- (void)drawKnob;
-- (void)mouseEnteredScroller;
-- (void)mouseExitedScroller;
-- (void)setTracking:(BOOL)tracking;
-- (void)setNeedsDisplay:(BOOL)flag;
-@end
-
-@interface NSObject (ScrollbarPainterController)
-- (void)setDelegate:(id)delegate;
-- (void)hideOverlayScrollers;
-- (void)flashScrollers;
-- (void)lockOverlayScrollerState:(NSUInteger)state;
-- (BOOL)overlayScrollerStateIsLocked;
-- (void)unlockOverlayScrollerState;
-- (id)horizontalScrollerImp;
-- (void)setHorizontalScrollerImp:(id)horizontal;
-- (id)verticalScrollerImp;
-- (void)setVerticalScrollerImp:(id)vertical;
-- (NSScrollerStyle)scrollerStyle;
-- (void)setScrollerStyle:(NSScrollerStyle)scrollerStyle;
-- (void)contentAreaScrolled;
-- (void)contentAreaScrolledInDirection:(NSPoint)direction;
-- (void)contentAreaWillDraw;
-- (void)mouseEnteredContentArea;
-- (void)mouseExitedContentArea;
-- (void)mouseMovedInContentArea;
-- (void)startLiveResize;
-- (void)contentAreaDidResize;
-- (void)endLiveResize;
-- (void)windowOrderedIn;
-- (void)windowOrderedOut;
-- (void)beginScrollGesture;
-- (void)endScrollGesture;
-@end
-
namespace WebCore {
NSScrollerStyle recommendedScrollerStyle();
Modified: trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.mm (196245 => 196246)
--- trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.mm 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.mm 2016-02-08 03:01:07 UTC (rev 196246)
@@ -27,16 +27,16 @@
#include "config.h"
#include "NSScrollerImpDetails.h"
+
#include "Settings.h"
namespace WebCore {
-NSScrollerStyle recommendedScrollerStyle() {
+NSScrollerStyle recommendedScrollerStyle()
+{
if (Settings::usesOverlayScrollbars())
return NSScrollerStyleOverlay;
- if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)])
- return [NSScroller preferredScrollerStyle];
- return NSScrollerStyleLegacy;
+ return [NSScroller preferredScrollerStyle];
}
}
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (196245 => 196246)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2016-02-08 03:01:07 UTC (rev 196246)
@@ -34,6 +34,7 @@
#include "GraphicsLayer.h"
#include "Logging.h"
#include "NSScrollerImpDetails.h"
+#include "NSScrollerImpSPI.h"
#include "PlatformWheelEvent.h"
#include "ScrollView.h"
#include "ScrollableArea.h"
@@ -47,19 +48,19 @@
static bool supportsUIStateTransitionProgress()
{
// FIXME: This is temporary until all platforms that support ScrollbarPainter support this part of the API.
- static const bool globalSupportsUIStateTransitionProgress = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(mouseEnteredScroller)];
+ static const bool globalSupportsUIStateTransitionProgress = [[NSScrollerImp class] instancesRespondToSelector:@selector(mouseEnteredScroller)];
return globalSupportsUIStateTransitionProgress;
}
static bool supportsExpansionTransitionProgress()
{
- static const bool globalSupportsExpansionTransitionProgress = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(expansionTransitionProgress)];
+ static const bool globalSupportsExpansionTransitionProgress = [[NSScrollerImp class] instancesRespondToSelector:@selector(expansionTransitionProgress)];
return globalSupportsExpansionTransitionProgress;
}
static bool supportsContentAreaScrolledInDirection()
{
- static const bool globalSupportsContentAreaScrolledInDirection = [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@selector(contentAreaScrolledInDirection:)];
+ static const bool globalSupportsContentAreaScrolledInDirection = [[NSScrollerImpPair class] instancesRespondToSelector:@selector(contentAreaScrolledInDirection:)];
return globalSupportsContentAreaScrolledInDirection;
}
@@ -181,7 +182,7 @@
@end
-@interface WebScrollbarPainterControllerDelegate : NSObject
+@interface WebScrollbarPainterControllerDelegate : NSObject <NSScrollerImpPairDelegate>
{
ScrollableArea* _scrollableArea;
}
@@ -205,7 +206,7 @@
_scrollableArea = 0;
}
-- (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair
+- (NSRect)contentAreaRectForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
if (!_scrollableArea)
@@ -215,7 +216,7 @@
return NSMakeRect(0, 0, contentsSize.width(), contentsSize.height());
}
-- (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair
+- (BOOL)inLiveResizeForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
if (!_scrollableArea)
@@ -224,7 +225,7 @@
return _scrollableArea->inLiveResize();
}
-- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair
+- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair
{
UNUSED_PARAM(scrollerImpPair);
if (!_scrollableArea)
@@ -233,7 +234,7 @@
return _scrollableArea->lastKnownMousePosition();
}
-- (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(id)scrollerImp
+- (NSPoint)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(NSScrollerImp *)scrollerImp
{
UNUSED_PARAM(scrollerImpPair);
@@ -259,7 +260,7 @@
return scrollbar->convertFromContainingView(WebCore::IntPoint(pointInContentArea));
}
-- (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
+- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
{
UNUSED_PARAM(scrollerImpPair);
UNUSED_PARAM(rect);
@@ -273,7 +274,7 @@
_scrollableArea->scrollAnimator().contentAreaWillPaint();
}
-- (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
+- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
{
if (!_scrollableArea)
return;
@@ -381,7 +382,7 @@
@end
-@interface WebScrollbarPainterDelegate : NSObject<NSAnimationDelegate>
+@interface WebScrollbarPainterDelegate : NSObject<NSAnimationDelegate, NSScrollerImpDelegate>
{
WebCore::Scrollbar* _scrollbar;
@@ -449,7 +450,7 @@
return layer ? layer->platformLayer() : dummyLayer;
}
-- (NSPoint)mouseLocationInScrollerForScrollerImp:(id)scrollerImp
+- (NSPoint)mouseLocationInScrollerForScrollerImp:(NSScrollerImp *)scrollerImp
{
if (!_scrollbar)
return NSZeroPoint;
@@ -464,7 +465,7 @@
return rect;
}
-- (BOOL)shouldUseLayerPerPartForScrollerImp:(id)scrollerImp
+- (BOOL)shouldUseLayerPerPartForScrollerImp:(NSScrollerImp *)scrollerImp
{
UNUSED_PARAM(scrollerImp);
@@ -516,7 +517,7 @@
[scrollbarPartAnimation startAnimation];
}
-- (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
{
if (!_scrollbar)
return;
@@ -539,7 +540,7 @@
[self setUpAlphaAnimation:_knobAlphaAnimation scrollerPainter:scrollerPainter part:WebCore::ThumbPart animateAlphaTo:newKnobAlpha duration:duration];
}
-- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
{
if (!_scrollbar)
return;
@@ -550,7 +551,7 @@
[self setUpAlphaAnimation:_trackAlphaAnimation scrollerPainter:scrollerPainter part:WebCore::BackTrackPart animateAlphaTo:newTrackAlpha duration:duration];
}
-- (void)scrollerImp:(id)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration
{
if (!_scrollbar)
return;
@@ -584,7 +585,7 @@
[_uiStateTransitionAnimation startAnimation];
}
-- (void)scrollerImp:(id)scrollerImp animateExpansionTransitionWithDuration:(NSTimeInterval)duration
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateExpansionTransitionWithDuration:(NSTimeInterval)duration
{
if (!_scrollbar)
return;
@@ -614,7 +615,7 @@
[_expansionTransitionAnimation startAnimation];
}
-- (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp overlayScrollerStateChangedTo:(NSOverlayScrollerState)newOverlayScrollerState
{
UNUSED_PARAM(scrollerImp);
UNUSED_PARAM(newOverlayScrollerState);
@@ -651,8 +652,8 @@
m_scrollAnimationHelper = adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:&scrollableArea]);
- m_scrollbarPainterController = adoptNS([[NSClassFromString(@"NSScrollerImpPair") alloc] init]);
- [m_scrollbarPainterController setDelegate:(id)m_scrollbarPainterControllerDelegate.get()];
+ m_scrollbarPainterController = adoptNS([[NSScrollerImpPair alloc] init]);
+ [m_scrollbarPainterController setDelegate:m_scrollbarPainterControllerDelegate.get()];
[m_scrollbarPainterController setScrollerStyle:recommendedScrollerStyle()];
}
@@ -952,7 +953,7 @@
void ScrollAnimatorMac::lockOverlayScrollbarStateToHidden(bool shouldLockState)
{
if (shouldLockState)
- [m_scrollbarPainterController lockOverlayScrollerState:ScrollbarOverlayStateHidden];
+ [m_scrollbarPainterController lockOverlayScrollerState:NSOverlayScrollerStateHidden];
else {
[m_scrollbarPainterController unlockOverlayScrollerState];
@@ -977,7 +978,7 @@
ASSERT(!m_verticalScrollbarPainterDelegate);
m_verticalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
- [painter setDelegate:(id)m_verticalScrollbarPainterDelegate.get()];
+ [painter setDelegate:m_verticalScrollbarPainterDelegate.get()];
if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForVerticalScrollbar())
[painter setLayer:layer->platformLayer()];
@@ -1009,7 +1010,7 @@
ASSERT(!m_horizontalScrollbarPainterDelegate);
m_horizontalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
- [painter setDelegate:(id)m_horizontalScrollbarPainterDelegate.get()];
+ [painter setDelegate:m_horizontalScrollbarPainterDelegate.get()];
if (GraphicsLayer* layer = scrollbar->scrollableArea().layerForHorizontalScrollbar())
[painter setLayer:layer->platformLayer()];
@@ -1331,10 +1332,8 @@
verticalScrollbar->invalidate();
ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController verticalScrollerImp];
- ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:newStyle
- controlSize:(NSControlSize)verticalScrollbar->controlSize()
- horizontal:NO
- replacingScrollerImp:oldVerticalPainter];
+ ScrollbarPainter newVerticalPainter = [NSScrollerImp scrollerImpWithStyle:newStyle controlSize:(NSControlSize)verticalScrollbar->controlSize() horizontal:NO replacingScrollerImp:oldVerticalPainter];
+
[m_scrollbarPainterController setVerticalScrollerImp:newVerticalPainter];
macTheme->setNewPainterForScrollbar(*verticalScrollbar, newVerticalPainter);
@@ -1349,10 +1348,8 @@
horizontalScrollbar->invalidate();
ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController horizontalScrollerImp];
- ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:newStyle
- controlSize:(NSControlSize)horizontalScrollbar->controlSize()
- horizontal:YES
- replacingScrollerImp:oldHorizontalPainter];
+ ScrollbarPainter newHorizontalPainter = [NSScrollerImp scrollerImpWithStyle:newStyle controlSize:(NSControlSize)horizontalScrollbar->controlSize() horizontal:YES replacingScrollerImp:oldHorizontalPainter];
+
[m_scrollbarPainterController setHorizontalScrollerImp:newHorizontalPainter];
macTheme->setNewPainterForScrollbar(*horizontalScrollbar, newHorizontalPainter);
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (196245 => 196246)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2016-02-08 01:34:07 UTC (rev 196245)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2016-02-08 03:01:07 UTC (rev 196246)
@@ -28,10 +28,11 @@
#include "BlockExceptions.h"
#include "ColorMac.h"
+#include "GraphicsLayer.h"
#include "ImageBuffer.h"
-#include "GraphicsLayer.h"
#include "LocalCurrentGraphicsContext.h"
#include "NSScrollerImpDetails.h"
+#include "NSScrollerImpSPI.h"
#include "PlatformMouseEvent.h"
#include "ScrollAnimatorMac.h"
#include "ScrollView.h"
@@ -138,7 +139,7 @@
static bool supportsExpandedScrollbars()
{
// FIXME: This is temporary until all platforms that support ScrollbarPainter support this part of the API.
- static bool globalSupportsExpandedScrollbars = [NSClassFromString(@"NSScrollerImp") instancesRespondToSelector:@selector(setExpanded:)];
+ static bool globalSupportsExpandedScrollbars = [[NSScrollerImp class] instancesRespondToSelector:@selector(setExpanded:)];
return globalSupportsExpandedScrollbars;
}
@@ -161,7 +162,7 @@
return;
bool isHorizontal = scrollbar.orientation() == HorizontalScrollbar;
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar.controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
+ ScrollbarPainter scrollbarPainter = [NSScrollerImp scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar.controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
scrollbarMap()->add(&scrollbar, scrollbarPainter);
updateEnabledState(scrollbar);
updateScrollbarOverlayStyle(scrollbar);
@@ -224,7 +225,7 @@
int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
+ ScrollbarPainter scrollbarPainter = [NSScrollerImp scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
if (supportsExpandedScrollbars())
[scrollbarPainter setExpanded:YES];
return [scrollbarPainter trackBoxWidth];
@@ -588,7 +589,6 @@
// of shadows, and we know that WebCore won't touch this layer.
setUpOverhangAreaShadow(graphicsLayer->platformLayer());
}
-
#endif
} // namespace WebCore
Added: trunk/Source/WebCore/platform/spi/mac/NSScrollerImpSPI.h (0 => 196246)
--- trunk/Source/WebCore/platform/spi/mac/NSScrollerImpSPI.h (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/NSScrollerImpSPI.h 2016-02-08 03:01:07 UTC (rev 196246)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NSScrollerImpSPI_h
+#define NSScrollerImpSPI_h
+
+#if USE(APPKIT)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <AppKit/NSScrollerImpPair_Private.h>
+#import <AppKit/NSScrollerImp_Private.h>
+
+@interface NSScrollerImp ()
+@property(getter=isTracking) BOOL tracking;
+@end
+
+#else
+
+enum {
+ NSOverlayScrollerStateHidden = 0,
+ NSOverlayScrollerStateThumbShown = 1,
+ NSOverlayScrollerStateAllShown = 2,
+ NSOverlayScrollerStatePulseThumb = 3,
+};
+typedef NSUInteger NSOverlayScrollerState;
+
+@protocol NSScrollerImpDelegate;
+
+@interface NSScrollerImp : NSObject
++ (NSScrollerImp *)scrollerImpWithStyle:(NSScrollerStyle)newScrollerStyle controlSize:(NSControlSize)newControlSize horizontal:(BOOL)horizontal replacingScrollerImp:(id)previous;
+@property(retain) CALayer *layer;
+- (void)setNeedsDisplay:(BOOL)flag;
+@property NSScrollerKnobStyle knobStyle;
+@property(getter=isHorizontal) BOOL horizontal;
+@property NSSize boundsSize;
+@property(getter=isEnabled) BOOL enabled;
+@property double doubleValue;
+@property double presentationValue;
+@property(getter=shouldUsePresentationValue) BOOL usePresentationValue;
+@property CGFloat knobProportion;
+@property CGFloat uiStateTransitionProgress;
+@property CGFloat expansionTransitionProgress;
+@property CGFloat trackAlpha;
+@property CGFloat knobAlpha;
+@property(getter=isExpanded) BOOL expanded;
+@property(assign) id<NSScrollerImpDelegate> delegate;
+@property(readonly) CGFloat trackBoxWidth;
+@property(readonly) CGFloat trackWidth;
+@property(readonly) CGFloat trackSideInset;
+@property(readonly) CGFloat trackEndInset;
+@property(readonly) CGFloat knobEndInset;
+@property(readonly) CGFloat knobMinLength;
+@property(readonly) CGFloat knobOverlapEndInset;
+@property(readonly) CGFloat trackOverlapEndInset;
+- (NSRect)rectForPart:(NSScrollerPart)partCode;
+- (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag alpha:(CGFloat)alpha;
+- (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag;
+- (void)drawKnob;
+- (void)mouseEnteredScroller;
+- (void)mouseExitedScroller;
+@end
+
+@interface NSScrollerImp ()
+@property(getter=isTracking) BOOL tracking;
+@end
+
+@protocol NSScrollerImpDelegate
+@required
+- (NSRect)convertRectToBacking:(NSRect)aRect;
+- (NSRect)convertRectFromBacking:(NSRect)aRect;
+- (CALayer *)layer;
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration;
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration;
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp overlayScrollerStateChangedTo:(NSOverlayScrollerState)newOverlayScrollerState;
+@optional
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateUIStateTransitionWithDuration:(NSTimeInterval)duration;
+- (void)scrollerImp:(NSScrollerImp *)scrollerImp animateExpansionTransitionWithDuration:(NSTimeInterval)duration;
+- (NSPoint)mouseLocationInScrollerForScrollerImp:(NSScrollerImp *)scrollerImp;
+- (NSRect)convertRectToLayer:(NSRect)aRect;
+- (BOOL)shouldUseLayerPerPartForScrollerImp:(NSScrollerImp *)scrollerImp;
+@end
+
+@protocol NSScrollerImpPairDelegate;
+
+@interface NSScrollerImpPair : NSObject
+@property(assign) id<NSScrollerImpPairDelegate> delegate;
+@property(retain) NSScrollerImp *verticalScrollerImp;
+@property(retain) NSScrollerImp *horizontalScrollerImp;
+@property NSScrollerStyle scrollerStyle;
+- (void)flashScrollers;
+- (void)hideOverlayScrollers;
+- (void)lockOverlayScrollerState:(NSOverlayScrollerState)state;
+- (void)unlockOverlayScrollerState;
+- (BOOL)overlayScrollerStateIsLocked;
+- (void)contentAreaScrolled;
+- (void)contentAreaScrolledInDirection:(NSPoint)direction;
+- (void)contentAreaWillDraw;
+- (void)windowOrderedOut;
+- (void)windowOrderedIn;
+- (void)mouseEnteredContentArea;
+- (void)mouseExitedContentArea;
+- (void)mouseMovedInContentArea;
+- (void)startLiveResize;
+- (void)contentAreaDidResize;
+- (void)endLiveResize;
+- (void)beginScrollGesture;
+- (void)endScrollGesture;
+@end
+
+@protocol NSScrollerImpPairDelegate
+@required
+- (NSRect)contentAreaRectForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair;
+- (BOOL)inLiveResizeForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair;
+- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(NSScrollerImpPair *)scrollerImpPair;
+- (NSPoint)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(NSScrollerImp *)scrollerImp;
+- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect;
+- (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle;
+@optional
+- (BOOL)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair isContentPointVisible:(NSPoint)pointInContentArea;
+@end
+
+#endif
+
+#endif // USE(APPKIT)
+
+#endif // NSScrollerImpSPI_h