Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 166903005: mac: Add support for asynchronous dictionary lookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 510dec1e135d990e89ed2b10e04093964c7e7f18..13d4345b2de4721daa8a484a7d377ccbf4c9251a 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2627,6 +2627,22 @@ void RenderWidgetHostViewMac::TickPendingLatencyInfoDelay() {
[responderDelegate_ touchesEndedWithEvent:event];
}
+- (void)quickLookWithEvent:(NSEvent*)event {
+ NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
+ TextInputClientMac::GetInstance()->GetStringAtPoint(
+ renderWidgetHostView_->render_widget_host_,
+ gfx::Point(point.x, NSHeight([self frame]) - point.y),
+ ^(NSAttributedString* string, NSRect rect){
+ DCHECK([NSThread isMainThread]);
+ if (string) {
+ NSPoint stringPoint = rect.origin;
+ stringPoint.y = NSHeight([self frame]) - NSMaxY(rect);
+ [self showDefinitionForAttributedString:string atPoint:stringPoint];
+ }
+ }
+ );
+}
+
// This method handles 2 different types of hardware events.
// (Apple does not distinguish between them).
// a. Scrolling the middle wheel of a mouse.

Powered by Google App Engine
This is Rietveld 408576698