Changeset 218052 in webkit
- Timestamp:
- Jun 10, 2017 11:33:08 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r218050 r218052 1 2017-06-10 Dan Bernstein <mitz@apple.com> 2 3 [macOS] REGRESSION: Link drag images blend into the background in Sierra and earlier 4 https://bugs.webkit.org/show_bug.cgi?id=172933 5 <rdar://problem/32580649> 6 7 Reviewed by Tim Horton. 8 9 * platform/mac/DragImageMac.mm: 10 (WebCore::createDragImageForLink): When targeting macOS Sierra and earlier, give the link 11 drag image a drop shadow that resembles the one that macOS High Sierra applies to drag 12 image layers. 13 1 14 2017-06-10 Andy Estes <aestes@apple.com> 2 15 -
trunk/Source/WebCore/platform/mac/DragImageMac.mm
r216962 r218052 155 155 } 156 156 157 158 157 const CGFloat linkImagePadding = 10; 159 158 const CGFloat linkImageDomainBaselineToTitleBaseline = 18; … … 162 161 const CGFloat linkImageFontSize = 11; 163 162 const CFIndex linkImageTitleMaximumLineCount = 2; 164 const int linkImageDragCornerOutsetX = 6; 165 const int linkImageDragCornerOutsetY = 10; 163 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 164 const int linkImageShadowRadius = 0; 165 const int linkImageShadowOffsetY = 0; 166 #else 167 const int linkImageShadowRadius = 9; 168 const int linkImageShadowOffsetY = -3; 169 #endif 170 const int linkImageDragCornerOutsetX = 6 - linkImageShadowRadius; 171 const int linkImageDragCornerOutsetY = 10 - linkImageShadowRadius + linkImageShadowOffsetY; 166 172 167 173 IntPoint dragOffsetForLinkDragImage(DragImageRef dragImage) … … 288 294 LinkImageLayout layout(url, title); 289 295 290 RetainPtr<NSImage> dragImage = adoptNS([[NSImage alloc] initWithSize:layout.boundingRect.size()]); 296 auto imageSize = layout.boundingRect.size(); 297 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 298 imageSize.expand(2 * linkImageShadowRadius, 2 * linkImageShadowRadius - linkImageShadowOffsetY); 299 #endif 300 RetainPtr<NSImage> dragImage = adoptNS([[NSImage alloc] initWithSize:imageSize]); 291 301 [dragImage lockFocus]; 292 302 293 303 GraphicsContext context((CGContextRef)[NSGraphicsContext currentContext].graphicsPort); 304 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 305 context.translate(linkImageShadowRadius, linkImageShadowRadius - linkImageShadowOffsetY); 306 context.setShadow({ 0, linkImageShadowOffsetY }, linkImageShadowRadius, { 0.f, 0.f, 0.f, .25 }); 307 #endif 294 308 context.fillRoundedRect(FloatRoundedRect(layout.boundingRect, FloatRoundedRect::Radii(linkImageCornerRadius)), Color::white); 309 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 310 context.clearShadow(); 311 #endif 295 312 296 313 for (const auto& label : layout.labels) {
Note: See TracChangeset
for help on using the changeset viewer.