Bug 222014 - Change App Highlight delegate to pass more information about the highlight for display.
Summary: Change App Highlight delegate to pass more information about the highlight fo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-16 17:53 PST by Megan Gardner
Modified: 2021-02-17 10:39 PST (History)
5 users (show)

See Also:


Attachments
Patch (14.72 KB, patch)
2021-02-16 17:55 PST, Megan Gardner
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (14.64 KB, patch)
2021-02-16 18:28 PST, Megan Gardner
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (22.49 KB, patch)
2021-02-16 19:59 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (23.16 KB, patch)
2021-02-17 00:56 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (22.55 KB, patch)
2021-02-17 01:12 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (22.58 KB, patch)
2021-02-17 02:07 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch for landing (22.58 KB, patch)
2021-02-17 09:14 PST, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2021-02-16 17:53:14 PST
Change App Highlight delegate to pass more information about the highlight for display.
Comment 1 Megan Gardner 2021-02-16 17:55:23 PST
Created attachment 420570 [details]
Patch
Comment 2 Tim Horton 2021-02-16 18:04:10 PST
Comment on attachment 420570 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.h:37
> +- (instancetype) init NS_UNAVAILABLE;

)init

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.h:39
> +@property (nonatomic, readonly, copy) NSData *data;

I think just "data" is a bit mysterious. This is the thing that you pass to "restore", right? I think we can come up with a name.

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.h:49
> +@property (nonatomic, readonly) BOOL newGroup;

This one doesn't make sense here and should be the second parameter on the method, I think

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.mm:2
> + * Copyright (C) 20201 Apple Inc. All rights reserved.

Wow that's a distant future you've got there

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h:36
> +- (void)_webView:(WKWebView *)webView storeAppHighlight:(_WKAppHighlight *)highlight WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));

I propose: _webView:didCreateHighlight:creatingNewGroup:
Comment 3 Tim Horton 2021-02-16 18:06:43 PST
> _webView:didCreateHighlight:creatingNewGroup:

or ... _webView:didCreateHighlight:inNewGroup:?
Comment 4 Megan Gardner 2021-02-16 18:08:11 PST
Comment on attachment 420570 [details]
Patch

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

>> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.h:39
>> +@property (nonatomic, readonly, copy) NSData *data;
> 
> I think just "data" is a bit mysterious. This is the thing that you pass to "restore", right? I think we can come up with a name.

I actually call it 'highlight' in much of the previous patch, but if we come up with an even better name, I'll change it everywhere.
Comment 5 Wenson Hsieh 2021-02-16 18:21:38 PST
Comment on attachment 420570 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1432
> +    _WKAppHighlight *wkHighlight = [[_WKAppHighlight alloc] initWithData:highlight.highlight->createNSData().get() text:text image:nil createNewGroup:highlight.isNewGroup == WebCore::CreateNewGroupForHighlight::Yes ? YES : NO];

It looks like this will leak.
Comment 6 Megan Gardner 2021-02-16 18:28:40 PST
Created attachment 420578 [details]
Patch
Comment 7 Megan Gardner 2021-02-16 19:59:49 PST
Created attachment 420586 [details]
Patch
Comment 8 Tim Horton 2021-02-16 20:35:53 PST
Comment on attachment 420586 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.mm:39
> +    _text = text;

Where'd the image go

> Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm:29
> +

Too many newlines
Comment 9 Megan Gardner 2021-02-17 00:56:09 PST
Created attachment 420611 [details]
Patch
Comment 10 Megan Gardner 2021-02-17 01:12:43 PST
Created attachment 420614 [details]
Patch
Comment 11 Tim Horton 2021-02-17 01:23:48 PST
Comment on attachment 420614 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1434
> +    if ([delegate respondsToSelector:@selector(_webView:storeAppHighlight:inNewGroup:)])

You should probably just bail at the top, none of this work is worth anything if you're not going to call the delegate.

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.h:41
> +@property (nonatomic, readonly, copy) NSString * text;

* is a-floating

> Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm:29
> +

This extraneous newline is still here
Comment 12 Tim Horton 2021-02-17 01:24:32 PST
Comment on attachment 420614 [details]
Patch

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

> Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlight.mm:39
> +    _text = text;

Where'd the image go? I think you missed my last set of comments
Comment 13 Megan Gardner 2021-02-17 02:07:14 PST
Created attachment 420619 [details]
Patch
Comment 14 Megan Gardner 2021-02-17 09:14:27 PST
Created attachment 420655 [details]
Patch for landing
Comment 15 EWS 2021-02-17 10:38:43 PST
Committed r273013: <https://commits.webkit.org/r273013>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 420655 [details].
Comment 16 Radar WebKit Bug Importer 2021-02-17 10:39:13 PST
<rdar://problem/74440009>