<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Support TouchBar in WebKit"
href="https://bugs.webkit.org/show_bug.cgi?id=164437#c22">Comment # 22</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Support TouchBar in WebKit"
href="https://bugs.webkit.org/show_bug.cgi?id=164437">bug 164437</a>
from <span class="vcard"><a class="email" href="mailto:mitz@webkit.org" title="mitz@webkit.org <mitz@webkit.org>"> <span class="fn">mitz@webkit.org</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=293990&action=diff" name="attach_293990" title="Patch">attachment 293990</a> <a href="attachment.cgi?id=293990&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=293990&action=review">https://bugs.webkit.org/attachment.cgi?id=293990&action=review</a>
<span class="quote">> Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h:27
> +#if USE(APPLE_INTERNAL_SDK) && HAVE(TOUCH_BAR)</span >
Should this entire header be guarded with HAVE(TOUCH_BAR) regardless of whether you’re using the Apple-internal SDK? Seems unnecessary to have these Touch Bar things declared when the feature is not available.
<span class="quote">> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4590
> + if (!_impl->clientWantsMediaPlaybackControlsView())
> + return nil;
> + return _impl->mediaPlaybackControlsView();</span >
Maybe write this as a single return statement using the ternary operator?
<span class="quote">> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4602
> +- (void)_addMediaPlaybackControlsView:(AVFunctionBarScrubber *)mediaPlaybackControlsView
> +{
> +}
> +
> +- (void)_removeMediaPlaybackControlsView
> +{
> +}</span >
Maybe comment in these that they are for subclasses to override.
<span class="quote">> Source/WebKit2/UIProcess/API/mac/WKView.mm:1522
> + if (!_data->_impl->clientWantsMediaPlaybackControlsView())
> + return nil;
> + return _data->_impl->mediaPlaybackControlsView();</span >
Maybe write this as a single return statement using the ternary operator?
<span class="quote">> Source/WebKit2/UIProcess/API/mac/WKView.mm:1534
> +- (void)_addMediaPlaybackControlsView:(AVFunctionBarScrubber *)mediaPlaybackControlsView
> +{
> +}
> +
> +- (void)_removeMediaPlaybackControlsView
> +{
> +}</span >
Maybe comment in these that they are for subclasses to override.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h:491
> + void updateTouchBar();</span >
Can this be in the HAVE(TOUCH_BAR) section so that you don’t have to add an empty implementation below?
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:107
> +NSString * const WKMediaExitFullScreenItem = @"WKMediaExitFullScreenItem";</span >
Should this be static? Doesn’t seem to need external linkage.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:451
> + ListType _currentListType;
> +</span >
Can this be @private too? Do you even need to declare it if you @synthesize it?
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:467
> +static const double listControlSegmentWidth = 67;
> +static const double exitFullScreenButtonWidth = 64;</span >
These should be CGFloat.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:471
> +static const unsigned noListSegment = 0;
> +static const unsigned unorderedListSegment = 1;
> +static const unsigned orderedListSegment = 2;</span >
And these should be NSUInteger.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:493
> + [[segments objectAtIndex:noListSegment] accessibilitySetOverrideValue:WebCore::insertListTypeNone() forAttribute:NSAccessibilityDescriptionAttribute];
> + [[segments objectAtIndex:unorderedListSegment] accessibilitySetOverrideValue:WebCore::insertListTypeBulletedAccessibilityTitle() forAttribute:NSAccessibilityDescriptionAttribute];
> + [[segments objectAtIndex:orderedListSegment] accessibilitySetOverrideValue:WebCore::insertListTypeNumberedAccessibilityTitle() forAttribute:NSAccessibilityDescriptionAttribute];</span >
You can use array subscripting instead of -objectAtIndex: here:
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:512
> + if (insertListControl.selectedSegment == noListSegment) {</span >
Maybe use a switch statement here (and thus also avoid calling -selectedSegment up to three times).
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:554
> + BOOL _textIsBold;
> + BOOL _textIsItalic;
> + BOOL _textIsUnderlined;
> + NSTextAlignment _currentTextAlignment;
> + RetainPtr<NSColor> _textColor;
> + RetainPtr<WKTextListTouchBarViewController> _wkTextListTouchBarViewController;</span >
Can these all be @private too? Can you omit the ones that you @synthesize?
Probably don’t need wk in the name of the last one.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:642
> + _webViewImpl->handleAcceptedCandidate((NSTextCheckingResult *)candidate);</span >
I’d just declare candidate as NSTextCheckingResult * and avoid the cast here.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:688
> + return (WKTextListTouchBarViewController *)[self textListViewController];</span >
.textListViewController
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:744
> + NSTextAlignment alignment = (NSTextAlignment)[self.textAlignments.cell tagForSegment:[self.textAlignments selectedSegment]];</span >
.selectedSegment
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:802
> +namespace WebKit {</span >
Newline after?
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:844
> + if ([[item identifier] isEqualToString:NSTouchBarItemIdentifierTextFormat]) {</span >
.identifier
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:845
> + for (NSTouchBarItem *childItem in [(NSGroupTouchBarItem *)item groupTouchBar].items) {</span >
.groupTouchBar
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:889
> + [touchBar setDefaultItems:[NSMutableSet setWithObjects:isRichTextTouchBar ? m_richTextCandidateListTouchBarItem.get() : m_plainTextCandidateListTouchBarItem.get(), nil]];</span >
Can use setWithObject: and drop the trailing nil.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:959
> + if (!m_emptyCandidatesArray)
> + m_emptyCandidatesArray = adoptNS([[NSArray alloc] init]);
> + [candidateListTouchBarItem() setCandidates:m_emptyCandidatesArray.get() forSelectedRange:NSMakeRange(0, 0) inString:nil];</span >
Why do we need a member variable for the empty NSArray? Pretty sure @[ ] works just as well, and is always the same object.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>