+2015-04-25 Tim Horton <timothy_horton@apple.com>
+
+ Further update gesture swipe shadow style
+ https://bugs.webkit.org/show_bug.cgi?id=144215
+ <rdar://problem/19295843>
+
+ Reviewed by Dan Bernstein.
+
+ * Resources/mac/SwipeShadow.png: Removed.
+ * Resources/mac/SwipeShadow@2x.png: Removed.
+ * UIProcess/mac/ViewGestureController.h:
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::beginSwipeGesture):
+ * WebKit2.xcodeproj/project.pbxproj:
+ Use a CAGradientLayer instead of PNGs for the swipe shadow.
+
2015-04-25 Dan Bernstein <mitz@apple.com>
WebKit2 part of <rdar://problem/20697966> Avoid using TBD as an argument to NS_AVAILABLE
OBJC_CLASS _UIViewControllerOneToOneTransitionContext;
OBJC_CLASS _UIViewControllerTransitionContext;
#else
+OBJC_CLASS CAGradientLayer;
OBJC_CLASS NSEvent;
OBJC_CLASS NSView;
OBJC_CLASS WKSwipeCancellationTracker;
RetainPtr<WKSwipeCancellationTracker> m_swipeCancellationTracker;
RetainPtr<CALayer> m_swipeLayer;
RetainPtr<CALayer> m_swipeSnapshotLayer;
- RetainPtr<CALayer> m_swipeShadowLayer;
+ RetainPtr<CAGradientLayer> m_swipeShadowLayer;
RetainPtr<CALayer> m_swipeDimmingLayer;
Vector<RetainPtr<CALayer>> m_currentSwipeLiveLayers;
static const double swipeOverlayShadowOpacity = 0.66;
static const double swipeOverlayShadowRadius = 3;
#else
-static const double swipeOverlayShadowOpacity = 0.47;
+static const double swipeOverlayShadowOpacity = 0.06;
static const double swipeOverlayDimmingOpacity = 0.12;
+static const CGFloat swipeOverlayShadowWidth = 81;
#endif
static const CGFloat minimumHorizontalSwipeDistance = 15;
[m_swipeDimmingLayer setGeometryFlipped:geometryIsFlippedToRoot];
[m_swipeDimmingLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
- NSImage *shadowImage = [[NSBundle bundleForClass:[WKSwipeCancellationTracker class]] imageForResource:@"SwipeShadow"];
- FloatRect shadowRect(-shadowImage.size.width, topContentInset, shadowImage.size.width, m_webPageProxy.viewSize().height() - topContentInset);
- m_swipeShadowLayer = adoptNS([[CALayer alloc] init]);
+ FloatRect shadowRect(-swipeOverlayShadowWidth, topContentInset, swipeOverlayShadowWidth, m_webPageProxy.viewSize().height() - topContentInset);
+ m_swipeShadowLayer = adoptNS([[CAGradientLayer alloc] init]);
[m_swipeShadowLayer setName:@"Gesture Swipe Shadow Layer"];
- [m_swipeShadowLayer setBackgroundColor:[NSColor colorWithPatternImage:shadowImage].CGColor];
- [m_swipeShadowLayer setContentsScale:deviceScaleFactor];
+ [m_swipeShadowLayer setColors:@[
+ (id)CGColorCreateGenericGray(0, 1.),
+ (id)CGColorCreateGenericGray(0, 0.99),
+ (id)CGColorCreateGenericGray(0, 0.98),
+ (id)CGColorCreateGenericGray(0, 0.95),
+ (id)CGColorCreateGenericGray(0, 0.92),
+ (id)CGColorCreateGenericGray(0, 0.82),
+ (id)CGColorCreateGenericGray(0, 0.71),
+ (id)CGColorCreateGenericGray(0, 0.46),
+ (id)CGColorCreateGenericGray(0, 0.35),
+ (id)CGColorCreateGenericGray(0, 0.25),
+ (id)CGColorCreateGenericGray(0, 0.17),
+ (id)CGColorCreateGenericGray(0, 0.11),
+ (id)CGColorCreateGenericGray(0, 0.07),
+ (id)CGColorCreateGenericGray(0, 0.04),
+ (id)CGColorCreateGenericGray(0, 0.01),
+ (id)CGColorCreateGenericGray(0, 0.),
+ ]];
+ [m_swipeShadowLayer setLocations:@[
+ @0,
+ @0.03125,
+ @0.0625,
+ @0.0938,
+ @0.125,
+ @0.1875,
+ @0.25,
+ @0.375,
+ @0.4375,
+ @0.5,
+ @0.5625,
+ @0.625,
+ @0.6875,
+ @0.75,
+ @0.875,
+ @1,
+ ]];
+ [m_swipeShadowLayer setStartPoint:CGPointMake(1, 0)];
+ [m_swipeShadowLayer setEndPoint:CGPointMake(0, 0)];
[m_swipeShadowLayer setOpacity:swipeOverlayShadowOpacity];
[m_swipeShadowLayer setAnchorPoint:CGPointZero];
[m_swipeShadowLayer setFrame:shadowRect];
2DACE64E18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */; };
2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; };
2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */; };
- 2DC658351AD7237600D44508 /* SwipeShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = 2DC658331AD7237600D44508 /* SwipeShadow.png */; };
- 2DC658361AD7237600D44508 /* SwipeShadow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2DC658341AD7237600D44508 /* SwipeShadow@2x.png */; };
2DC6D9C318C44A610043BAD4 /* WKWebViewContentProviderRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */; };
2DC6D9C418C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */; };
2DD12A081A8177F3002C74E6 /* WKPageRenderingProgressEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationController.h; path = ios/SmartMagnificationController.h; sourceTree = "<group>"; };
2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmartMagnificationController.mm; path = ios/SmartMagnificationController.mm; sourceTree = "<group>"; };
2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; };
- 2DC658331AD7237600D44508 /* SwipeShadow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SwipeShadow.png; sourceTree = "<group>"; };
- 2DC658341AD7237600D44508 /* SwipeShadow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SwipeShadow@2x.png"; sourceTree = "<group>"; };
2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProviderRegistry.h; sourceTree = "<group>"; };
2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewContentProviderRegistry.mm; sourceTree = "<group>"; };
2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEvents.h; sourceTree = "<group>"; };
37F8C94F1AE22BD8007DAB9E /* mac */ = {
isa = PBXGroup;
children = (
- 2DC658331AD7237600D44508 /* SwipeShadow.png */,
- 2DC658341AD7237600D44508 /* SwipeShadow@2x.png */,
);
name = mac;
path = Resources/mac;
E17AE2C316B9C63A001C42F1 /* com.apple.WebKit.NetworkProcess.sb in Resources */,
E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */,
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
- 2DC658351AD7237600D44508 /* SwipeShadow.png in Resources */,
- 2DC658361AD7237600D44508 /* SwipeShadow@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};