Changeset 210075 in webkit


Ignore:
Timestamp:
Dec 21, 2016, 1:30:30 PM (9 years ago)
Author:
Beth Dakin
Message:

Holding down on candidates in the TouchBar should show panel on screen
https://bugs.webkit.org/show_bug.cgi?id=166367
-and corresponding-
<rdar://problem/28479236>

Reviewed by Tim Horton.

Source/WebCore:

Expose the version of setCandidates: that takes a rect.

  • platform/spi/cocoa/NSTouchBarSPI.h:

Source/WebKit/mac:

Stray whitespace.

  • WebCoreSupport/WebEditorClient.mm:

(WebEditorClient::handleRequestedCandidates):

Call the version of setCandidates: that takes a rect. We need to keep the helper
function in WK1 (unlike WK2) since we also use it for testing.

  • WebView/WebView.mm:

(-[WebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):

Source/WebKit2:

The showCandidates() helper function is not needed. We can call the AppKit method
directly at the one call site.

  • UIProcess/Cocoa/WebViewImpl.h:
  • UIProcess/Cocoa/WebViewImpl.mm:

The panel should appear under the selection, so offset the selection rect.
(WebKit::WebViewImpl::handleRequestedCandidates):

No more showCandidates() since we can call it directly.
(WebKit::WebViewImpl::showCandidates): Deleted.

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r210074 r210075  
     12016-12-21  Beth Dakin  <bdakin@apple.com>
     2
     3        Holding down on candidates in the TouchBar should show panel on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=166367
     5        -and corresponding-
     6        <rdar://problem/28479236>
     7
     8        Reviewed by Tim Horton.
     9
     10        Expose the version of setCandidates: that takes a rect.
     11        * platform/spi/cocoa/NSTouchBarSPI.h:
     12
    1132016-12-21  Michael Catanzaro  <mcatanzaro@igalia.com>
    214
  • trunk/Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h

    r209395 r210075  
    2828#if USE(APPLE_INTERNAL_SDK)
    2929
     30#import <AppKit/NSCandidateListTouchBarItem_Private.h>
    3031#import <AppKit/NSFunctionBar_Private.h>
    3132#import <AppKit/NSTextTouchBarItemController_WebKitSPI.h>
     
    5556@end
    5657
     58@interface NSCandidateListTouchBarItem ()
     59- (void)setCandidates:(NSArray *)candidates forSelectedRange:(NSRange)selectedRange inString:(nullable NSString *)string rect:(NSRect)rect view:(nullable NSView *)view completionHandler:(nullable void (^)(id acceptedCandidate))completionBlock;
     60@end
     61
    5762#endif // !USE(APPLE_INTERNAL_SDK)
    5863
  • trunk/Source/WebKit/mac/ChangeLog

    r210029 r210075  
     12016-12-21  Beth Dakin  <bdakin@apple.com>
     2
     3        Holding down on candidates in the TouchBar should show panel on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=166367
     5        -and corresponding-
     6        <rdar://problem/28479236>
     7
     8        Reviewed by Tim Horton.
     9
     10        Stray whitespace.
     11        * WebCoreSupport/WebEditorClient.mm:
     12        (WebEditorClient::handleRequestedCandidates):
     13
     14        Call the version of setCandidates: that takes a rect. We need to keep the helper
     15        function in WK1 (unlike WK2) since we also use it for testing.
     16        * WebView/WebView.mm:
     17        (-[WebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):
     18
    1192016-12-20  Dean Jackson  <dino@apple.com>
    220
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r208452 r210075  
    12491249
    12501250    [m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:nil];
    1251 
    12521251}
    12531252
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r210016 r210075  
    50265026- (void)showCandidates:(NSArray<NSTextCheckingResult *> *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock
    50275027{
    5028     [self.candidateList setCandidates:candidates forSelectedRange:range inString:string];
     5028    [self.candidateList setCandidates:candidates forSelectedRange:range inString:string rect:rectOfTypedString view:view completionHandler:completionBlock];
    50295029}
    50305030
  • trunk/Source/WebKit2/ChangeLog

    r210053 r210075  
     12016-12-21  Beth Dakin  <bdakin@apple.com>
     2
     3        Holding down on candidates in the TouchBar should show panel on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=166367
     5        -and corresponding-
     6        <rdar://problem/28479236>
     7
     8        Reviewed by Tim Horton.
     9
     10        The showCandidates() helper function is not needed. We can call the AppKit method
     11        directly at the one call site.
     12        * UIProcess/Cocoa/WebViewImpl.h:
     13        * UIProcess/Cocoa/WebViewImpl.mm:
     14
     15        The panel should appear under the selection, so offset the selection rect.
     16        (WebKit::WebViewImpl::handleRequestedCandidates):
     17
     18        No more showCandidates() since we can call it directly.
     19        (WebKit::WebViewImpl::showCandidates): Deleted.
     20
    1212016-12-20  Taras Tsugrii  <ttsugrii@fb.com>
    222
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h

    r209782 r210075  
    494494    void forceRequestCandidatesForTesting();
    495495    bool shouldRequestCandidates() const;
    496     void showCandidates(NSArray *candidates, NSString *, NSRect rectOfTypedString, NSRange selectedRange, NSView *, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate));
    497496
    498497    bool windowIsFrontWindowUnderMouse(NSEvent *);
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm

    r209782 r210075  
    11841184}
    11851185
    1186 void WebViewImpl::showCandidates(NSArray *candidates, NSString *string, NSRect rectOfTypedString, NSRange selectedRange, NSView *view, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate))
    1187 {
    1188     [candidateListTouchBarItem() setCandidates:candidates forSelectedRange:selectedRange inString:string];
    1189 }
    1190 
    11911186void WebViewImpl::setEditableElementIsFocused(bool editableElementIsFocused)
    11921187{
     
    12111206{
    12121207    return false;
    1213 }
    1214 
    1215 void WebViewImpl::showCandidates(NSArray *candidates, NSString *string, NSRect rectOfTypedString, NSRange selectedRange, NSView *view, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate))
    1216 {
    12171208}
    12181209
     
    29952986    NSRange selectedRange = NSMakeRange(postLayoutData.candidateRequestStartPosition, postLayoutData.selectedTextLength);
    29962987    auto weakThis = createWeakPtr();
    2997     showCandidates(candidates, postLayoutData.paragraphContextForCandidateRequest, postLayoutData.selectionClipRect, selectedRange, m_view, [weakThis](NSTextCheckingResult *acceptedCandidate) {
    2998         dispatch_async(dispatch_get_main_queue(), ^{
    2999             if (!weakThis)
    3000                 return;
    3001             weakThis->handleAcceptedCandidate(acceptedCandidate);
    3002         });
    3003     });
     2988    WebCore::IntRect offsetSelectionRect = postLayoutData.selectionClipRect;
     2989    offsetSelectionRect.move(0, offsetSelectionRect.height());
     2990
     2991    [candidateListTouchBarItem() setCandidates:candidates forSelectedRange:selectedRange inString:postLayoutData.paragraphContextForCandidateRequest rect:offsetSelectionRect view:m_view completionHandler:nil];
    30042992}
    30052993
Note: See TracChangeset for help on using the changeset viewer.