- Revision
- 195149
- Author
- [email protected]
- Date
- 2016-01-15 14:29:19 -0800 (Fri, 15 Jan 2016)
Log Message
Data detector yellow highlight location is vertically mirrored in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=152216
<rdar://problem/23848003>
Reviewed by Beth Dakin.
No new tests, because we currently have no decent mechanism for testing
where TextIndicator/Lookup/DataDetectors actually make it to the screen,
nor for synthetic force-click in WebKit1.
* editing/mac/DictionaryLookup.h:
* editing/mac/DictionaryLookup.mm:
(WebCore::showPopupOrCreateAnimationController):
(WebCore::DictionaryLookup::showPopup):
(WebCore::DictionaryLookup::animationControllerForPopup):
Add an optional function for converting between root-FrameView and
handed-in-NSView coordinates, and use it to convert textBoundingRectInRootViewCoordinates
into the coordinates of the WebView.
* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):
These assignments have no effect because they're operating on a copy, because
TextIndicator::data() does not return a reference... so remove them.
* WebView/WebView.mm:
(-[WebView _setTextIndicator:withLifetime:]):
Convert textBoundingRectInRootViewCoordinates to WebView coordinates before
converting to Window coordinates from WebView coordinates so we get flipping right.
(-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
(-[WebView _showDictionaryLookupPopup:]):
Ditto for these, except in the aforementioned conversion callback.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (195148 => 195149)
--- trunk/Source/WebCore/ChangeLog 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebCore/ChangeLog 2016-01-15 22:29:19 UTC (rev 195149)
@@ -1,3 +1,24 @@
+2016-01-15 Tim Horton <[email protected]>
+
+ Data detector yellow highlight location is vertically mirrored in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=152216
+ <rdar://problem/23848003>
+
+ Reviewed by Beth Dakin.
+
+ No new tests, because we currently have no decent mechanism for testing
+ where TextIndicator/Lookup/DataDetectors actually make it to the screen,
+ nor for synthetic force-click in WebKit1.
+
+ * editing/mac/DictionaryLookup.h:
+ * editing/mac/DictionaryLookup.mm:
+ (WebCore::showPopupOrCreateAnimationController):
+ (WebCore::DictionaryLookup::showPopup):
+ (WebCore::DictionaryLookup::animationControllerForPopup):
+ Add an optional function for converting between root-FrameView and
+ handed-in-NSView coordinates, and use it to convert textBoundingRectInRootViewCoordinates
+ into the coordinates of the WebView.
+
2016-01-15 Joseph Pecoraro <[email protected]>
Media Query (-webkit-video-playable-inline) is failing as an invalid media query _expression_
Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.h (195148 => 195149)
--- trunk/Source/WebCore/editing/mac/DictionaryLookup.h 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.h 2016-01-15 22:29:19 UTC (rev 195149)
@@ -58,10 +58,10 @@
// FIXME: Should move/unify dictionaryPopupInfoForRange here too.
- WEBCORE_EXPORT static void showPopup(const DictionaryPopupInfo&, NSView *, std::function<void(TextIndicator&)> textIndicatorInstallationCallback);
+ WEBCORE_EXPORT static void showPopup(const DictionaryPopupInfo&, NSView *, std::function<void(TextIndicator&)> textIndicatorInstallationCallback, std::function<FloatRect(FloatRect)> rootViewToViewConversionCallback = nullptr);
WEBCORE_EXPORT static void hidePopup();
- WEBCORE_EXPORT static PlatformAnimationController animationControllerForPopup(const DictionaryPopupInfo&, NSView *, std::function<void(TextIndicator&)> textIndicatorInstallationCallback);
+ WEBCORE_EXPORT static PlatformAnimationController animationControllerForPopup(const DictionaryPopupInfo&, NSView *, std::function<void(TextIndicator&)> textIndicatorInstallationCallback, std::function<FloatRect(FloatRect)> rootViewToViewConversionCallback = nullptr);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/editing/mac/DictionaryLookup.mm (195148 => 195149)
--- trunk/Source/WebCore/editing/mac/DictionaryLookup.mm 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebCore/editing/mac/DictionaryLookup.mm 2016-01-15 22:29:19 UTC (rev 195149)
@@ -205,7 +205,7 @@
return nil;
}
-static PlatformAnimationController showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback)
+static PlatformAnimationController showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback, std::function<FloatRect(FloatRect)> rootViewToViewConversionCallback)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -222,7 +222,10 @@
if ([getLULookupDefinitionModuleClass() respondsToSelector:@selector(showDefinitionForTerm:relativeToRect:ofView:options:)]) {
FloatRect firstTextRectInViewCoordinates = textIndicator.get().textRectsInBoundingRectCoordinates()[0];
- firstTextRectInViewCoordinates.moveBy(textIndicator.get().textBoundingRectInRootViewCoordinates().location());
+ FloatRect textBoundingRectInViewCoordinates = textIndicator.get().textBoundingRectInRootViewCoordinates();
+ if (rootViewToViewConversionCallback)
+ textBoundingRectInViewCoordinates = rootViewToViewConversionCallback(textBoundingRectInViewCoordinates);
+ firstTextRectInViewCoordinates.moveBy(textBoundingRectInViewCoordinates.location());
if (createAnimationController)
return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()];
@@ -247,9 +250,9 @@
return nil;
}
-void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback)
+void DictionaryLookup::showPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback, std::function<FloatRect(FloatRect)> rootViewToViewConversionCallback)
{
- showPopupOrCreateAnimationController(false, dictionaryPopupInfo, view, textIndicatorInstallationCallback);
+ showPopupOrCreateAnimationController(false, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
}
void DictionaryLookup::hidePopup()
@@ -263,9 +266,9 @@
END_BLOCK_OBJC_EXCEPTIONS;
}
-PlatformAnimationController DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback)
+PlatformAnimationController DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback, std::function<FloatRect(FloatRect)> rootViewToViewConversionCallback)
{
- return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback);
+ return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback);
}
} // namespace WebCore
Modified: trunk/Source/WebKit/mac/ChangeLog (195148 => 195149)
--- trunk/Source/WebKit/mac/ChangeLog 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-01-15 22:29:19 UTC (rev 195149)
@@ -1,3 +1,26 @@
+2016-01-15 Tim Horton <[email protected]>
+
+ Data detector yellow highlight location is vertically mirrored in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=152216
+ <rdar://problem/23848003>
+
+ Reviewed by Beth Dakin.
+
+ * WebView/WebImmediateActionController.mm:
+ (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+ (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+ These assignments have no effect because they're operating on a copy, because
+ TextIndicator::data() does not return a reference... so remove them.
+
+ * WebView/WebView.mm:
+ (-[WebView _setTextIndicator:withLifetime:]):
+ Convert textBoundingRectInRootViewCoordinates to WebView coordinates before
+ converting to Window coordinates from WebView coordinates so we get flipping right.
+
+ (-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
+ (-[WebView _showDictionaryLookupPopup:]):
+ Ditto for these, except in the aforementioned conversion callback.
+
2016-01-14 Brady Eidson <[email protected]>
Modern IDB: Support opening and deleting SQLite databases on disk.
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (195148 => 195149)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2016-01-15 22:29:19 UTC (rev 195149)
@@ -430,7 +430,6 @@
}
auto indicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorOptionDefault, TextIndicatorPresentationTransition::FadeIn);
- indicator->data().textBoundingRectInRootViewCoordinates = [_webView _convertRectFromRootView:indicator->textBoundingRectInRootViewCoordinates()];
_currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
} interactionChangedHandler:^() {
@@ -463,7 +462,6 @@
if (!linkRange)
return nullptr;
auto indicator = TextIndicator::createWithRange(*linkRange, TextIndicatorOptionDefault, TextIndicatorPresentationTransition::FadeIn);
- indicator->data().textBoundingRectInRootViewCoordinates = [_webView _convertRectFromRootView:indicator->textBoundingRectInRootViewCoordinates()];
_currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
} interactionChangedHandler:^() {
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (195148 => 195149)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2016-01-15 22:28:03 UTC (rev 195148)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2016-01-15 22:29:19 UTC (rev 195149)
@@ -8568,11 +8568,10 @@
[self _prepareForDictionaryLookup];
- DictionaryPopupInfo adjustedPopupInfo = dictionaryPopupInfo;
- adjustedPopupInfo.textIndicator.textBoundingRectInRootViewCoordinates = [self _convertRectFromRootView:adjustedPopupInfo.textIndicator.textBoundingRectInRootViewCoordinates];
-
- return DictionaryLookup::animationControllerForPopup(adjustedPopupInfo, self, [self](TextIndicator& textIndicator) {
+ return DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, self, [self](TextIndicator& textIndicator) {
[self _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
+ }, [self](FloatRect rectInRootViewCoordinates) {
+ return [self _convertRectFromRootView:rectInRootViewCoordinates];
});
}
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -8597,7 +8596,7 @@
if (!_private->textIndicatorWindow)
_private->textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
- NSRect textBoundingRectInWindowCoordinates = [self convertRect:textIndicator.textBoundingRectInRootViewCoordinates() toView:nil];
+ NSRect textBoundingRectInWindowCoordinates = [self convertRect:[self _convertRectFromRootView:textIndicator.textBoundingRectInRootViewCoordinates()] toView:nil];
NSRect textBoundingRectInScreenCoordinates = [self.window convertRectToScreen:textBoundingRectInWindowCoordinates];
_private->textIndicatorWindow->setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), lifetime);
}
@@ -8633,11 +8632,10 @@
[self _prepareForDictionaryLookup];
- DictionaryPopupInfo adjustedPopupInfo = dictionaryPopupInfo;
- adjustedPopupInfo.textIndicator.textBoundingRectInRootViewCoordinates = [self _convertRectFromRootView:adjustedPopupInfo.textIndicator.textBoundingRectInRootViewCoordinates];
-
- DictionaryLookup::showPopup(adjustedPopupInfo, self, [self](TextIndicator& textIndicator) {
+ DictionaryLookup::showPopup(dictionaryPopupInfo, self, [self](TextIndicator& textIndicator) {
[self _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
+ }, [self](FloatRect rectInRootViewCoordinates) {
+ return [self _convertRectFromRootView:rectInRootViewCoordinates];
});
}