- Revision
- 210075
- Author
- [email protected]
- Date
- 2016-12-21 13:30:30 -0800 (Wed, 21 Dec 2016)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (210074 => 210075)
--- trunk/Source/WebCore/ChangeLog 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebCore/ChangeLog 2016-12-21 21:30:30 UTC (rev 210075)
@@ -1,3 +1,15 @@
+2016-12-21 Beth Dakin <[email protected]>
+
+ 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.
+
+ Expose the version of setCandidates: that takes a rect.
+ * platform/spi/cocoa/NSTouchBarSPI.h:
+
2016-12-21 Michael Catanzaro <[email protected]>
Extensions3DOpenGL[ES] constructor should not be explicit
Modified: trunk/Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h (210074 => 210075)
--- trunk/Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSTouchBarSPI.h 2016-12-21 21:30:30 UTC (rev 210075)
@@ -27,6 +27,7 @@
#if USE(APPLE_INTERNAL_SDK)
+#import <AppKit/NSCandidateListTouchBarItem_Private.h>
#import <AppKit/NSFunctionBar_Private.h>
#import <AppKit/NSTextTouchBarItemController_WebKitSPI.h>
#import <AppKit/NSTouchBar_Private.h>
@@ -54,6 +55,10 @@
@end
+@interface NSCandidateListTouchBarItem ()
+- (void)setCandidates:(NSArray *)candidates forSelectedRange:(NSRange)selectedRange inString:(nullable NSString *)string rect:(NSRect)rect view:(nullable NSView *)view completionHandler:(nullable void (^)(id acceptedCandidate))completionBlock;
+@end
+
#endif // !USE(APPLE_INTERNAL_SDK)
APPKIT_EXTERN NSNotificationName const NSTouchBarWillEnterCustomization API_AVAILABLE(macosx(10.12.2));
Modified: trunk/Source/WebKit/mac/ChangeLog (210074 => 210075)
--- trunk/Source/WebKit/mac/ChangeLog 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-12-21 21:30:30 UTC (rev 210075)
@@ -1,3 +1,21 @@
+2016-12-21 Beth Dakin <[email protected]>
+
+ 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.
+
+ 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:]):
+
2016-12-20 Dean Jackson <[email protected]>
Remove INDIE_UI
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (210074 => 210075)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm 2016-12-21 21:30:30 UTC (rev 210075)
@@ -1248,7 +1248,6 @@
rectForSelectionCandidates = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
[m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:nil];
-
}
void WebEditorClient::handleAcceptedCandidateWithSoftSpaces(TextCheckingResult acceptedCandidate)
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (210074 => 210075)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2016-12-21 21:30:30 UTC (rev 210075)
@@ -5025,7 +5025,7 @@
- (void)showCandidates:(NSArray<NSTextCheckingResult *> *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock
{
- [self.candidateList setCandidates:candidates forSelectedRange:range inString:string];
+ [self.candidateList setCandidates:candidates forSelectedRange:range inString:string rect:rectOfTypedString view:view completionHandler:completionBlock];
}
- (BOOL)shouldRequestCandidates
Modified: trunk/Source/WebKit2/ChangeLog (210074 => 210075)
--- trunk/Source/WebKit2/ChangeLog 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit2/ChangeLog 2016-12-21 21:30:30 UTC (rev 210075)
@@ -1,3 +1,23 @@
+2016-12-21 Beth Dakin <[email protected]>
+
+ 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.
+
+ 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.
+
2016-12-20 Taras Tsugrii <[email protected]>
Fix undefined behavior caused by macro expansion producing 'defined'
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (210074 => 210075)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-12-21 21:30:30 UTC (rev 210075)
@@ -493,7 +493,6 @@
void forceRequestCandidatesForTesting();
bool shouldRequestCandidates() const;
- void showCandidates(NSArray *candidates, NSString *, NSRect rectOfTypedString, NSRange selectedRange, NSView *, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate));
bool windowIsFrontWindowUnderMouse(NSEvent *);
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (210074 => 210075)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-12-21 21:24:17 UTC (rev 210074)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-12-21 21:30:30 UTC (rev 210075)
@@ -1183,11 +1183,6 @@
return !m_page->editorState().isInPasswordField && candidateListTouchBarItem().candidateListVisible;
}
-void WebViewImpl::showCandidates(NSArray *candidates, NSString *string, NSRect rectOfTypedString, NSRange selectedRange, NSView *view, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate))
-{
- [candidateListTouchBarItem() setCandidates:candidates forSelectedRange:selectedRange inString:string];
-}
-
void WebViewImpl::setEditableElementIsFocused(bool editableElementIsFocused)
{
m_editableElementIsFocused = editableElementIsFocused;
@@ -1212,10 +1207,6 @@
return false;
}
-void WebViewImpl::showCandidates(NSArray *candidates, NSString *string, NSRect rectOfTypedString, NSRange selectedRange, NSView *view, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate))
-{
-}
-
void WebViewImpl::setEditableElementIsFocused(bool editableElementIsFocused)
{
m_editableElementIsFocused = editableElementIsFocused;
@@ -2994,13 +2985,10 @@
NSRange selectedRange = NSMakeRange(postLayoutData.candidateRequestStartPosition, postLayoutData.selectedTextLength);
auto weakThis = createWeakPtr();
- showCandidates(candidates, postLayoutData.paragraphContextForCandidateRequest, postLayoutData.selectionClipRect, selectedRange, m_view, [weakThis](NSTextCheckingResult *acceptedCandidate) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (!weakThis)
- return;
- weakThis->handleAcceptedCandidate(acceptedCandidate);
- });
- });
+ WebCore::IntRect offsetSelectionRect = postLayoutData.selectionClipRect;
+ offsetSelectionRect.move(0, offsetSelectionRect.height());
+
+ [candidateListTouchBarItem() setCandidates:candidates forSelectedRange:selectedRange inString:postLayoutData.paragraphContextForCandidateRequest rect:offsetSelectionRect view:m_view completionHandler:nil];
}
static WebCore::TextCheckingResult textCheckingResultFromNSTextCheckingResult(NSTextCheckingResult *nsResult)