- Revision
- 177705
- Author
- [email protected]
- Date
- 2014-12-23 16:14:53 -0800 (Tue, 23 Dec 2014)
Log Message
Install a TextIndicator for link immediate actions
https://bugs.webkit.org/show_bug.cgi?id=139897
<rdar://problem/19333076>
Reviewed by Anders Carlsson.
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _defaultAnimationController]):
Install the link's TextIndicator.
(-[WKImmediateActionController menuItemDidClose:]):
Dismiss the TextIndicator and clean up when the item closes.
* WebView/WebImmediateActionController.h:
* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _clearImmediateActionState]):
Tear down the TextIndicator, just like WebKit2.
(-[WebImmediateActionController _defaultAnimationController]):
Install a TextIndicator for links.
(-[WebImmediateActionController menuItemDidClose:]):
Tear down the TextIndicator when the QL preview closes.
(-[WebImmediateActionController _menuItemForDataDetectedText]):
Directly install and uninstall the TextIndicator for DataDetectors.
(-[WebImmediateActionController _showTextIndicator]): Deleted.
(-[WebImmediateActionController _hideTextIndicator]): Deleted.
Remove the isShowingTextIndicator mechanism, just like it was removed from WebKit2.
* platform/spi/mac/QuickLookMacSPI.h:
Add a new piece of SPI.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (177704 => 177705)
--- trunk/Source/WebCore/ChangeLog 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebCore/ChangeLog 2014-12-24 00:14:53 UTC (rev 177705)
@@ -1,3 +1,14 @@
+2014-12-23 Timothy Horton <[email protected]>
+
+ Install a TextIndicator for link immediate actions
+ https://bugs.webkit.org/show_bug.cgi?id=139897
+ <rdar://problem/19333076>
+
+ Reviewed by Anders Carlsson.
+
+ * platform/spi/mac/QuickLookMacSPI.h:
+ Add a new piece of SPI.
+
2014-12-23 Sam Weinig <[email protected]>
Rename WebContext to WebProcessPool
Modified: trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h (177704 => 177705)
--- trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h 2014-12-24 00:14:53 UTC (rev 177705)
@@ -31,6 +31,7 @@
- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint;
- (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point;
- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point;
+- (void)menuItemDidClose:(NSMenuItem *)menuItem;
@end
Modified: trunk/Source/WebKit/mac/ChangeLog (177704 => 177705)
--- trunk/Source/WebKit/mac/ChangeLog 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-12-24 00:14:53 UTC (rev 177705)
@@ -1,3 +1,29 @@
+2014-12-23 Timothy Horton <[email protected]>
+
+ Install a TextIndicator for link immediate actions
+ https://bugs.webkit.org/show_bug.cgi?id=139897
+ <rdar://problem/19333076>
+
+ Reviewed by Anders Carlsson.
+
+ * WebView/WebImmediateActionController.h:
+ * WebView/WebImmediateActionController.mm:
+ (-[WebImmediateActionController _clearImmediateActionState]):
+ Tear down the TextIndicator, just like WebKit2.
+
+ (-[WebImmediateActionController _defaultAnimationController]):
+ Install a TextIndicator for links.
+
+ (-[WebImmediateActionController menuItemDidClose:]):
+ Tear down the TextIndicator when the QL preview closes.
+
+ (-[WebImmediateActionController _menuItemForDataDetectedText]):
+ Directly install and uninstall the TextIndicator for DataDetectors.
+
+ (-[WebImmediateActionController _showTextIndicator]): Deleted.
+ (-[WebImmediateActionController _hideTextIndicator]): Deleted.
+ Remove the isShowingTextIndicator mechanism, just like it was removed from WebKit2.
+
2014-12-20 Eric Carlson <[email protected]>
[iOS] add optimized fullscreen API
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h (177704 => 177705)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h 2014-12-24 00:14:53 UTC (rev 177705)
@@ -33,11 +33,6 @@
@class DDActionContext;
@class WebView;
-namespace WebCore {
-class Range;
-class TextIndicator;
-}
-
@interface WebImmediateActionController : NSObject <NSImmediateActionGestureRecognizerDelegate> {
@private
WebView *_webView;
@@ -46,8 +41,6 @@
NSImmediateActionGestureRecognizer *_immediateActionRecognizer;
RetainPtr<DDActionContext> _currentActionContext;
- RefPtr<WebCore::Range> _currentDetectedDataRange;
- RefPtr<WebCore::TextIndicator> _currentDetectedDataTextIndicator;
BOOL _isShowingTextIndicator;
BOOL _hasActivatedActionContext;
}
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (177704 => 177705)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2014-12-24 00:14:53 UTC (rev 177705)
@@ -100,6 +100,8 @@
- (void)_clearImmediateActionState
{
+ [_webView _clearTextIndicator];
+
_type = WebImmediateActionNone;
_currentActionContext = nil;
}
@@ -182,9 +184,13 @@
{
NSURL *url = ""
NSString *absoluteURLString = [url absoluteString];
- if (url && WebCore::protocolIsInHTTPFamily(absoluteURLString)) {
+ if (url && WebCore::protocolIsInHTTPFamily(absoluteURLString) && _hitTestResult.innerNode()) {
_type = WebImmediateActionLinkPreview;
+ RefPtr<Range> linkRange = rangeOfContents(*_hitTestResult.innerNode());
+ RefPtr<TextIndicator> linkTextIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::FadeIn);
+ [_webView _setTextIndicator:linkTextIndicator.get() fadeOut:NO];
+
RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
[qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
[qlPreviewLinkItem setDelegate:self];
@@ -250,6 +256,11 @@
return NSMaxYEdge;
}
+- (void)menuItemDidClose:(NSMenuItem *)menuItem
+{
+ [self _clearImmediateActionState];
+}
+
#pragma mark Data Detectors actions
- (NSMenuItem *)_menuItemForDataDetectedText
@@ -282,15 +293,14 @@
return nil;
}
- _currentDetectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::FadeIn);
+ RefPtr<TextIndicator> detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::FadeIn);
_currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
} interactionChangedHandler:^() {
- [self _showTextIndicator];
+ [_webView _setTextIndicator:detectedDataTextIndicator.get() fadeOut:NO];
} interactionStoppedHandler:^() {
- [self _hideTextIndicator];
+ [_webView _clearTextIndicator];
}];
- _currentDetectedDataRange = detectedDataRange;
[_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:detectedDataBoundingBox]];
@@ -370,28 +380,6 @@
return [_webView _animationControllerForDictionaryLookupPopupInfo:dictionaryPopupInfo];
}
-#pragma mark Text Indicator
-
-- (void)_showTextIndicator
-{
- if (_isShowingTextIndicator)
- return;
-
- if (_type == WebImmediateActionDataDetectedItem && _currentDetectedDataTextIndicator) {
- [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO];
- _isShowingTextIndicator = YES;
- }
-}
-
-- (void)_hideTextIndicator
-{
- if (!_isShowingTextIndicator)
- return;
-
- [_webView _clearTextIndicator];
- _isShowingTextIndicator = NO;
-}
-
@end
#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
Modified: trunk/Source/WebKit2/ChangeLog (177704 => 177705)
--- trunk/Source/WebKit2/ChangeLog 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebKit2/ChangeLog 2014-12-24 00:14:53 UTC (rev 177705)
@@ -1,5 +1,20 @@
2014-12-23 Timothy Horton <[email protected]>
+ Install a TextIndicator for link immediate actions
+ https://bugs.webkit.org/show_bug.cgi?id=139897
+ <rdar://problem/19333076>
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/mac/WKImmediateActionController.mm:
+ (-[WKImmediateActionController _defaultAnimationController]):
+ Install the link's TextIndicator.
+
+ (-[WKImmediateActionController menuItemDidClose:]):
+ Dismiss the TextIndicator and clean up when the item closes.
+
+2014-12-23 Timothy Horton <[email protected]>
+
Expose ElementBoundingBox on WKHitTestResult
https://bugs.webkit.org/show_bug.cgi?id=139895
<rdar://problem/19333075>
Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (177704 => 177705)
--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm 2014-12-24 00:13:48 UTC (rev 177704)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm 2014-12-24 00:14:53 UTC (rev 177705)
@@ -219,6 +219,9 @@
if (!absoluteLinkURL.isEmpty() && WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
_type = kWKImmediateActionLinkPreview;
+ if (TextIndicator *textIndicator = _hitTestResult.linkTextIndicator.get())
+ _page->setTextIndicator(textIndicator->data(), false);
+
RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
[qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
[qlPreviewLinkItem setDelegate:self];
@@ -279,6 +282,11 @@
return NSMaxYEdge;
}
+- (void)menuItemDidClose:(NSMenuItem *)menuItem
+{
+ [self _clearImmediateActionState];
+}
+
#pragma mark Data Detectors actions
- (NSMenuItem *)_menuItemForDataDetectedText