Title: [218052] trunk/Source/WebCore
- Revision
- 218052
- Author
- [email protected]
- Date
- 2017-06-10 11:33:08 -0700 (Sat, 10 Jun 2017)
Log Message
[macOS] REGRESSION: Link drag images blend into the background in Sierra and earlier
https://bugs.webkit.org/show_bug.cgi?id=172933
<rdar://problem/32580649>
Reviewed by Tim Horton.
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageForLink): When targeting macOS Sierra and earlier, give the link
drag image a drop shadow that resembles the one that macOS High Sierra applies to drag
image layers.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (218051 => 218052)
--- trunk/Source/WebCore/ChangeLog 2017-06-10 18:01:40 UTC (rev 218051)
+++ trunk/Source/WebCore/ChangeLog 2017-06-10 18:33:08 UTC (rev 218052)
@@ -1,3 +1,16 @@
+2017-06-10 Dan Bernstein <[email protected]>
+
+ [macOS] REGRESSION: Link drag images blend into the background in Sierra and earlier
+ https://bugs.webkit.org/show_bug.cgi?id=172933
+ <rdar://problem/32580649>
+
+ Reviewed by Tim Horton.
+
+ * platform/mac/DragImageMac.mm:
+ (WebCore::createDragImageForLink): When targeting macOS Sierra and earlier, give the link
+ drag image a drop shadow that resembles the one that macOS High Sierra applies to drag
+ image layers.
+
2017-06-10 Andy Estes <[email protected]>
[QuickLook] PreviewLoader needs to check if its ResourceLoader has reached the terminal state before calling didReceiveResponse() and friends
Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (218051 => 218052)
--- trunk/Source/WebCore/platform/mac/DragImageMac.mm 2017-06-10 18:01:40 UTC (rev 218051)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm 2017-06-10 18:33:08 UTC (rev 218052)
@@ -154,7 +154,6 @@
return [[NSWorkspace sharedWorkspace] iconForFileType:extension];
}
-
const CGFloat linkImagePadding = 10;
const CGFloat linkImageDomainBaselineToTitleBaseline = 18;
const CGFloat linkImageCornerRadius = 5;
@@ -161,8 +160,15 @@
const CGFloat linkImageMaximumWidth = 400;
const CGFloat linkImageFontSize = 11;
const CFIndex linkImageTitleMaximumLineCount = 2;
-const int linkImageDragCornerOutsetX = 6;
-const int linkImageDragCornerOutsetY = 10;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+const int linkImageShadowRadius = 0;
+const int linkImageShadowOffsetY = 0;
+#else
+const int linkImageShadowRadius = 9;
+const int linkImageShadowOffsetY = -3;
+#endif
+const int linkImageDragCornerOutsetX = 6 - linkImageShadowRadius;
+const int linkImageDragCornerOutsetY = 10 - linkImageShadowRadius + linkImageShadowOffsetY;
IntPoint dragOffsetForLinkDragImage(DragImageRef dragImage)
{
@@ -287,11 +293,22 @@
{
LinkImageLayout layout(url, title);
- RetainPtr<NSImage> dragImage = adoptNS([[NSImage alloc] initWithSize:layout.boundingRect.size()]);
+ auto imageSize = layout.boundingRect.size();
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ imageSize.expand(2 * linkImageShadowRadius, 2 * linkImageShadowRadius - linkImageShadowOffsetY);
+#endif
+ RetainPtr<NSImage> dragImage = adoptNS([[NSImage alloc] initWithSize:imageSize]);
[dragImage lockFocus];
GraphicsContext context((CGContextRef)[NSGraphicsContext currentContext].graphicsPort);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ context.translate(linkImageShadowRadius, linkImageShadowRadius - linkImageShadowOffsetY);
+ context.setShadow({ 0, linkImageShadowOffsetY }, linkImageShadowRadius, { 0.f, 0.f, 0.f, .25 });
+#endif
context.fillRoundedRect(FloatRoundedRect(layout.boundingRect, FloatRoundedRect::Radii(linkImageCornerRadius)), Color::white);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ context.clearShadow();
+#endif
for (const auto& label : layout.labels) {
GraphicsContextStateSaver saver(context);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes