[Webkit-unassigned] [Bug 164437] Support TouchBar in WebKit
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Nov 6 21:29:02 PST 2016
https://bugs.webkit.org/show_bug.cgi?id=164437
--- Comment #23 from Beth Dakin <bdakin at apple.com> ---
(In reply to comment #22)
> Comment on attachment 293990 [details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=293990&action=review
>
> > Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h:27
> > +#if USE(APPLE_INTERNAL_SDK) && HAVE(TOUCH_BAR)
>
> 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.
>
Yes, I think so. Fixed.
> > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4590
> > + if (!_impl->clientWantsMediaPlaybackControlsView())
> > + return nil;
> > + return _impl->mediaPlaybackControlsView();
>
> Maybe write this as a single return statement using the ternary operator?
>
Fixed.
> > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4602
> > +- (void)_addMediaPlaybackControlsView:(AVFunctionBarScrubber *)mediaPlaybackControlsView
> > +{
> > +}
> > +
> > +- (void)_removeMediaPlaybackControlsView
> > +{
> > +}
>
> Maybe comment in these that they are for subclasses to override.
>
Added comments.
> > Source/WebKit2/UIProcess/API/mac/WKView.mm:1522
> > + if (!_data->_impl->clientWantsMediaPlaybackControlsView())
> > + return nil;
> > + return _data->_impl->mediaPlaybackControlsView();
>
> Maybe write this as a single return statement using the ternary operator?
>
Fixed.
> > Source/WebKit2/UIProcess/API/mac/WKView.mm:1534
> > +- (void)_addMediaPlaybackControlsView:(AVFunctionBarScrubber *)mediaPlaybackControlsView
> > +{
> > +}
> > +
> > +- (void)_removeMediaPlaybackControlsView
> > +{
> > +}
>
> Maybe comment in these that they are for subclasses to override.
>
Added comments.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h:491
> > + void updateTouchBar();
>
> Can this be in the HAVE(TOUCH_BAR) section so that you donât have to add an
> empty implementation below?
>
Yes, fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:107
> > +NSString * const WKMediaExitFullScreenItem = @"WKMediaExitFullScreenItem";
>
> Should this be static? Doesnât seem to need external linkage.
>
Sure.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:451
> > + ListType _currentListType;
> > +
>
> Can this be @private too? Do you even need to declare it if you @synthesize
> it?
>
Looks like @synthesize takes care of it!
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:467
> > +static const double listControlSegmentWidth = 67;
> > +static const double exitFullScreenButtonWidth = 64;
>
> These should be CGFloat.
Fixed.
>
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:471
> > +static const unsigned noListSegment = 0;
> > +static const unsigned unorderedListSegment = 1;
> > +static const unsigned orderedListSegment = 2;
>
> And these should be NSUInteger.
>
Fixed.
> > 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];
>
> You can use array subscripting instead of -objectAtIndex: here:
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:512
> > + if (insertListControl.selectedSegment == noListSegment) {
>
> Maybe use a switch statement here (and thus also avoid calling
> -selectedSegment up to three times).
>
Went with a switch.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:554
> > + BOOL _textIsBold;
> > + BOOL _textIsItalic;
> > + BOOL _textIsUnderlined;
> > + NSTextAlignment _currentTextAlignment;
> > + RetainPtr<NSColor> _textColor;
> > + RetainPtr<WKTextListTouchBarViewController> _wkTextListTouchBarViewController;
>
> 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.
>
I made them @private. The compiler wasn't happy with just @synthesize.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:642
> > + _webViewImpl->handleAcceptedCandidate((NSTextCheckingResult *)candidate);
>
> Iâd just declare candidate as NSTextCheckingResult * and avoid the cast here.
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:688
> > + return (WKTextListTouchBarViewController *)[self textListViewController];
>
> .textListViewController
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:744
> > + NSTextAlignment alignment = (NSTextAlignment)[self.textAlignments.cell tagForSegment:[self.textAlignments selectedSegment]];
>
> .selectedSegment
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:802
> > +namespace WebKit {
>
> Newline after?
>
Added.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:844
> > + if ([[item identifier] isEqualToString:NSTouchBarItemIdentifierTextFormat]) {
>
> .identifier
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:845
> > + for (NSTouchBarItem *childItem in [(NSGroupTouchBarItem *)item groupTouchBar].items) {
>
> .groupTouchBar
>
Fixed.
> > Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:889
> > + [touchBar setDefaultItems:[NSMutableSet setWithObjects:isRichTextTouchBar ? m_richTextCandidateListTouchBarItem.get() : m_plainTextCandidateListTouchBarItem.get(), nil]];
>
> Can use setWithObject: and drop the trailing nil.
>
Fixed.
> > 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];
>
> Why do we need a member variable for the empty NSArray? Pretty sure @[ ]
> works just as well, and is always the same object.
So, it turns out this is broken! But @[ ] is equally broken. I think I will leave it as-if for now, and fix it with a follow-up, at which time, maybe @[ ] will work.
Patch coming soon.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161107/42b38f57/attachment.html>
More information about the webkit-unassigned
mailing list