Bug 171701

Summary: [Mac] Modernize image for dragged link
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebCore Misc.Assignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, buildbot, dino, rmondello, simon.fraser, wenson_hsieh
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 171706    
Bug Blocks:    
Attachments:
Description Flags
patch
simon.fraser: review+
Patch
none
Patch none

Description Tim Horton 2017-05-04 17:34:27 PDT
Created attachment 309118 [details]
patch

[Mac] Modernize image for dragged link
Comment 1 Build Bot 2017-05-04 17:36:58 PDT
Attachment 309118 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 2 Tim Horton 2017-05-04 18:21:33 PDT
Created attachment 309124 [details]
Patch
Comment 3 Simon Fraser (smfr) 2017-05-04 18:25:59 PDT
Comment on attachment 309118 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=309118&action=review

> Source/WebCore/platform/mac/DragImageMac.mm:161
> +const float linkImagePadding = 10; // Keep in sync with DragController::LinkDragBorderInset.
> +const float linkImageDomainBaselineToTitleBaseline = 18;
> +const float linkImageCornerRadius = 5;
> +const float linkImageMaximumWidth = 400;
> +const float linkImageFontSize = 11;

Some of these should be CGFloats.

> Source/WebCore/platform/mac/DragImageMac.mm:176
> +    void layOutText(NSString *text, NSColor *, NSFont *, CFIndex maximumLines, CTLineTruncationType, CGFloat& maximumAvailableWidth, CGFloat& maximumUsedTextWidth, CGFloat& currentY);

layOutText is hard on my eyes.
Comment 4 Tim Horton 2017-05-04 18:46:20 PDT
Created attachment 309126 [details]
Patch
Comment 5 Simon Fraser (smfr) 2017-05-04 18:48:37 PDT
Comment on attachment 309126 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=309126&action=review

> Source/WebCore/platform/mac/DragImageMac.mm:176
> +    void addLine(CTLineRef, Vector<CGPoint>& origins, CFIndex lineIndex, CGFloat x, CGFloat& y, CGFloat& maximumUsedTextWidth, bool isLastLine);

Can origins be const?
Comment 6 Tim Horton 2017-05-04 18:59:12 PDT
Sure.
Comment 7 Tim Horton 2017-05-04 19:24:27 PDT
https://trac.webkit.org/changeset/216226/webkit