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

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

Issue 1396243002: Using the correct target NSView to show the dictionary bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 00c46f2bfd92ed52a9f0e6f3364e2dc6f56b4f26..c13e70c5a318e77eddb6fa45a73c492229a25469 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -183,7 +183,8 @@ static BOOL SupportsBackingPropertiesChangedNotification() {
- (void)setResponderDelegate:
(NSObject<RenderWidgetHostViewMacDelegate>*)delegate;
- (void)showLookUpDictionaryOverlayInternal:(NSAttributedString*) string
- baselinePoint:(NSPoint) baselinePoint;
+ baselinePoint:(NSPoint) baselinePoint
+ targetView:(NSView*) view;
@end
// A window subclass that allows the fullscreen window to become main and gain
@@ -2435,7 +2436,8 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
}
- (void)showLookUpDictionaryOverlayInternal:(NSAttributedString*) string
- baselinePoint:(NSPoint) baselinePoint {
+ baselinePoint:(NSPoint) baselinePoint
+ targetView:(NSView*) view {
if ([string length] == 0) {
// The PDF plugin does not support getting the attributed string at point.
// Until it does, use NSPerformService(), which opens Dictionary.app.
@@ -2453,17 +2455,19 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
- [self showDefinitionForAttributedString:string
- atPoint:baselinePoint];
+ [view showDefinitionForAttributedString:string
+ atPoint:baselinePoint];
});
}
-- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range {
+- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range
+ targetView:(NSView*)targetView {
TextInputClientMac::GetInstance()->GetStringFromRange(
renderWidgetHostView_->render_widget_host_, range,
^(NSAttributedString* string, NSPoint baselinePoint) {
[self showLookUpDictionaryOverlayInternal:string
- baselinePoint:baselinePoint];
+ baselinePoint:baselinePoint
+ targetView:targetView];
}
);
}
@@ -2474,7 +2478,8 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
gfx::Point(point.x, NSHeight([self frame]) - point.y),
^(NSAttributedString* string, NSPoint baselinePoint) {
[self showLookUpDictionaryOverlayInternal:string
- baselinePoint:baselinePoint];
+ baselinePoint:baselinePoint
+ targetView:self];
}
);
}

Powered by Google App Engine
This is Rietveld 408576698