Commit 98581bb3 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

RemoteRWHVMac: Add dictionary lookup support

Split the RWHVCocoa showLookUpDictionaryOverlayInternal,
showLookUpDictionaryOverlayFromRange, and
showLookUpDictionaryOverlayAtPoint into browser-side and AppShim-side
components.

Remove RenderWidgetHostViewMacDictionaryHelper, because it ends up
having no effect. It is used to specify a target NSView on which to
draw the dictionary overlay, but it is only used for the PDF plugin,
which is incapable of drawing the dictionary overlay (because it
can't look up the point in the view at which it is supposed to be
drawn).

This should be a cut-and-paste with no functional effects.

Bug: 821651
Change-Id: Ie443bdc76a5e0b28d2f6595fcff0601f8ce4a228
Reviewed-on: https://chromium-review.googlesource.com/1000765
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549421}
parent 89ad7704
......@@ -1410,8 +1410,6 @@ jumbo_source_set("browser") {
"renderer_host/render_widget_host_view_child_frame.h",
"renderer_host/render_widget_host_view_mac.h",
"renderer_host/render_widget_host_view_mac.mm",
"renderer_host/render_widget_host_view_mac_dictionary_helper.h",
"renderer_host/render_widget_host_view_mac_dictionary_helper.mm",
"renderer_host/render_widget_host_view_mac_editcommand_helper.h",
"renderer_host/render_widget_host_view_mac_editcommand_helper.mm",
"renderer_host/render_widget_targeter.cc",
......
......@@ -36,10 +36,6 @@
#include "ui/events/base_event_utils.h"
#include "ui/gfx/geometry/dip_util.h"
#if defined(OS_MACOSX)
#import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h"
#endif
#if defined(USE_AURA)
#include "content/browser/renderer_host/ui_events_helper.h"
#include "ui/aura/env.h"
......@@ -572,25 +568,13 @@ void RenderWidgetHostViewGuest::SetActive(bool active) {
}
void RenderWidgetHostViewGuest::ShowDefinitionForSelection() {
if (!guest_)
return;
gfx::Rect guest_bounds = GetViewBounds();
RenderWidgetHostView* rwhv = guest_->GetOwnerRenderWidgetHostView();
gfx::Rect embedder_bounds;
if (rwhv)
embedder_bounds = rwhv->GetViewBounds();
gfx::Vector2d guest_offset = gfx::Vector2d(
// Horizontal offset of guest from embedder.
guest_bounds.x() - embedder_bounds.x(),
// Vertical offset from guest's top to embedder's bottom edge.
embedder_bounds.bottom() - guest_bounds.y());
RenderWidgetHostViewMacDictionaryHelper helper(platform_view_.get());
helper.SetTargetView(rwhv);
helper.set_offset(guest_offset);
helper.ShowDefinitionForSelection();
// Note that if there were a dictionary overlay, that dictionary overlay
// would target |guest_|. This path does not actually support getting the
// attributed string and its point on the page, so it will not create an
// overlay (it will open Dictionary.app), so the target NSView need not be
// specified.
// https://crbug.com/152438
platform_view_->ShowDefinitionForSelection();
}
void RenderWidgetHostViewGuest::SpeakSelection() {
......
......@@ -11,10 +11,12 @@
#include "base/macros.h"
#include "base/strings/string16.h"
#include "content/common/mac/attributed_string_coder.h"
#include "third_party/blink/public/web/web_popup_type.h"
#include "third_party/skia/include/core/SkColor.h"
namespace gfx {
class Point;
class Range;
class Rect;
} // namespace gfx
......@@ -75,6 +77,16 @@ class RenderWidgetHostNSViewBridge {
// Set the cursor type to display.
virtual void DisplayCursor(const WebCursor& cursor) = 0;
// Open the dictionary overlay for the currently selected string. This
// will roundtrip to the NSView to determine the selected range.
virtual void ShowDictionaryOverlayForSelection() = 0;
// Open the dictionary overlay for the specified string at the specified
// point.
virtual void ShowDictionaryOverlay(
const mac::AttributedStringCoder::EncodedString& encoded_string,
gfx::Point baseline_point) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewBridge);
};
......
......@@ -47,6 +47,10 @@ class RenderWidgetHostViewNSViewBridgeLocal
void SetSelectedRange(const gfx::Range& range) override;
void SetShowingContextMenu(bool showing) override;
void DisplayCursor(const WebCursor& cursor) override;
void ShowDictionaryOverlayForSelection() override;
void ShowDictionaryOverlay(
const mac::AttributedStringCoder::EncodedString& encoded_string,
gfx::Point baseline_point) override;
private:
bool IsPopup() const {
......@@ -238,6 +242,26 @@ void RenderWidgetHostViewNSViewBridgeLocal::DisplayCursor(
[cocoa_view_ updateCursor:non_const_cursor.GetNativeCursor()];
}
void RenderWidgetHostViewNSViewBridgeLocal::
ShowDictionaryOverlayForSelection() {
NSRange selection_range = [cocoa_view_ selectedRange];
[cocoa_view_ showLookUpDictionaryOverlayFromRange:selection_range];
}
void RenderWidgetHostViewNSViewBridgeLocal::ShowDictionaryOverlay(
const mac::AttributedStringCoder::EncodedString& encoded_string,
gfx::Point baseline_point) {
NSAttributedString* string =
mac::AttributedStringCoder::Decode(&encoded_string);
if ([string length] == 0)
return;
NSPoint flipped_baseline_point = {
baseline_point.x(), [cocoa_view_ frame].size.height - baseline_point.y(),
};
[cocoa_view_ showDefinitionForAttributedString:string
atPoint:flipped_baseline_point];
}
} // namespace
// static
......
......@@ -6,6 +6,7 @@
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_NS_VIEW_CLIENT_H_
#include "base/macros.h"
#include "content/common/mac/attributed_string_coder.h"
namespace content {
......@@ -68,6 +69,11 @@ class RenderWidgetHostNSViewClient {
virtual void OnNSViewSmartMagnify(
const blink::WebGestureEvent& smart_magnify_event) = 0;
virtual void OnNSViewLookUpDictionaryOverlayAtPoint(
const gfx::PointF& root_point) = 0;
virtual void OnNSViewLookUpDictionaryOverlayFromRange(
const gfx::Range& range) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewClient);
};
......
......@@ -197,9 +197,7 @@ struct DidOverscrollParams;
actualRange:(NSRangePointer)actualRange;
- (void)tabletEvent:(NSEvent*)theEvent;
- (void)quickLookWithEvent:(NSEvent*)event;
- (void)showLookUpDictionaryOverlayAtPoint:(NSPoint)point;
- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range
targetView:(NSView*)targetView;
- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range;
- (BOOL)suppressNextKeyUpForTesting:(int)keyCode;
// Query the display::Display from the view's NSWindow's NSScreen and forward
// it to the RenderWidgetHostNSViewClient (only if the screen is non-nil).
......
......@@ -22,7 +22,6 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h"
#import "content/browser/renderer_host/text_input_client_mac.h"
#include "content/public/browser/browser_context.h"
......@@ -146,10 +145,6 @@ void ExtractUnderlines(NSAttributedString* string,
- (void)windowChangedGlobalFrame:(NSNotification*)notification;
- (void)windowDidBecomeKey:(NSNotification*)notification;
- (void)windowDidResignKey:(NSNotification*)notification;
- (void)showLookUpDictionaryOverlayInternal:
(mac::AttributedStringCoder::EncodedString)encodedString
baselinePoint:(gfx::Point)baselinePoint
targetView:(NSView*)view;
- (void)sendViewBoundsInWindowToClient;
- (void)sendWindowFrameInScreenToClient;
@end
......@@ -884,112 +879,16 @@ void ExtractUnderlines(NSAttributedString* string,
client_->OnNSViewSmartMagnify(smartMagnifyEvent);
}
- (void)showLookUpDictionaryOverlayInternal:
(mac::AttributedStringCoder::EncodedString)encodedString
baselinePoint:(gfx::Point)baselinePoint
targetView:(NSView*)view {
NSAttributedString* string =
mac::AttributedStringCoder::Decode(&encodedString);
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.
// TODO(shuchen): Support GetStringAtPoint() & GetStringFromRange() for PDF.
// See https://crbug.com/152438.
NSString* text = nil;
if (auto* selection = renderWidgetHostView_->GetTextSelection())
text = base::SysUTF16ToNSString(selection->selected_text());
if ([text length] == 0)
return;
scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard;
NSArray* types = [NSArray arrayWithObject:NSStringPboardType];
[pasteboard->get() declareTypes:types owner:nil];
if ([pasteboard->get() setString:text forType:NSStringPboardType])
NSPerformService(@"Look Up in Dictionary", pasteboard->get());
return;
}
NSPoint flippedBaselinePoint = {
baselinePoint.x(), [view frame].size.height - baselinePoint.y(),
};
[view showDefinitionForAttributedString:string atPoint:flippedBaselinePoint];
}
- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range
targetView:(NSView*)targetView {
content::RenderWidgetHostViewBase* focusedView =
renderWidgetHostView_->GetFocusedViewForTextSelection();
if (!focusedView)
return;
RenderWidgetHostImpl* widgetHost =
RenderWidgetHostImpl::From(focusedView->GetRenderWidgetHost());
if (!widgetHost)
return;
int32_t targetWidgetProcessId = widgetHost->GetProcess()->GetID();
int32_t targetWidgetRoutingId = widgetHost->GetRoutingID();
TextInputClientMac::GetInstance()->GetStringFromRange(
widgetHost, gfx::Range(range),
base::BindBlock(^(
const mac::AttributedStringCoder::EncodedString& encodedString,
gfx::Point baselinePoint) {
if (!content::RenderWidgetHost::FromID(targetWidgetProcessId,
targetWidgetRoutingId)) {
// By the time we get here |widgetHost| might have been destroyed.
// (See https://crbug.com/737032).
return;
}
if (auto* rwhv = widgetHost->GetView())
baselinePoint = rwhv->TransformPointToRootCoordSpace(baselinePoint);
[self showLookUpDictionaryOverlayInternal:encodedString
baselinePoint:baselinePoint
targetView:targetView];
}));
}
- (void)showLookUpDictionaryOverlayAtPoint:(NSPoint)point {
gfx::PointF rootPoint(point.x, NSHeight([self frame]) - point.y);
gfx::PointF transformedPoint;
if (!renderWidgetHostView_->host() ||
!renderWidgetHostView_->host()->delegate() ||
!renderWidgetHostView_->host()->delegate()->GetInputEventRouter())
return;
RenderWidgetHostImpl* widgetHost =
renderWidgetHostView_->host()
->delegate()
->GetInputEventRouter()
->GetRenderWidgetHostAtPoint(renderWidgetHostView_, rootPoint,
&transformedPoint);
if (!widgetHost)
return;
int32_t targetWidgetProcessId = widgetHost->GetProcess()->GetID();
int32_t targetWidgetRoutingId = widgetHost->GetRoutingID();
TextInputClientMac::GetInstance()->GetStringAtPoint(
widgetHost, gfx::ToFlooredPoint(transformedPoint),
base::BindBlock(^(
const mac::AttributedStringCoder::EncodedString& encodedString,
gfx::Point baselinePoint) {
if (!content::RenderWidgetHost::FromID(targetWidgetProcessId,
targetWidgetRoutingId)) {
// By the time we get here |widgetHost| might have been destroyed.
// (See https://crbug.com/737032).
return;
}
if (auto* rwhv = widgetHost->GetView())
baselinePoint = rwhv->TransformPointToRootCoordSpace(baselinePoint);
[self showLookUpDictionaryOverlayInternal:encodedString
baselinePoint:baselinePoint
targetView:self];
}));
- (void)showLookUpDictionaryOverlayFromRange:(NSRange)range {
client_->OnNSViewLookUpDictionaryOverlayFromRange(gfx::Range(range));
}
// This is invoked only on 10.8 or newer when the user taps a word using
// three fingers.
- (void)quickLookWithEvent:(NSEvent*)event {
NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
[self showLookUpDictionaryOverlayAtPoint:point];
gfx::PointF rootPoint(point.x, NSHeight([self frame]) - point.y);
client_->OnNSViewLookUpDictionaryOverlayAtPoint(rootPoint);
}
// This method handles 2 different types of hardware events.
......@@ -1204,7 +1103,7 @@ void ExtractUnderlines(NSAttributedString* string,
}
- (BOOL)canBecomeKeyView {
if (!renderWidgetHostView_->host())
if (clientWasDestroyed_)
return NO;
return canBeKeyView_;
......
......@@ -298,6 +298,10 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
void OnNSViewGestureEnd(blink::WebGestureEvent end_event) override;
void OnNSViewSmartMagnify(
const blink::WebGestureEvent& smart_magnify_event) override;
void OnNSViewLookUpDictionaryOverlayAtPoint(
const gfx::PointF& root_point) override;
void OnNSViewLookUpDictionaryOverlayFromRange(
const gfx::Range& range) override;
// BrowserCompositorMacClient implementation.
SkColor BrowserCompositorMacGetGutterColor() const override;
......@@ -372,6 +376,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
void OnResizeDueToAutoResizeComplete(const gfx::Size& new_size,
uint64_t sequence_number);
void OnGotStringForDictionaryOverlay(
int32_t targetWidgetProcessId,
int32_t targetWidgetRoutingId,
const mac::AttributedStringCoder::EncodedString& encodedString,
gfx::Point baselinePoint);
// Gets a textual view of the page's contents, and passes it to the callback
// provided.
using SpeechCallback = base::OnceCallback<void(const base::string16&)>;
......
......@@ -27,7 +27,6 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#import "content/browser/renderer_host/render_widget_host_ns_view_bridge.h"
#import "content/browser/renderer_host/render_widget_host_view_cocoa.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h"
#import "content/browser/renderer_host/text_input_client_mac.h"
#include "content/common/text_input_state.h"
#include "content/common/view_messages.h"
......@@ -461,13 +460,13 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
// |updated_view| is the last view to change its TextInputState which can be
// used to start/stop monitoring composition info when it has a focused
// editable text input field.
RenderWidgetHostImpl* widgetHost =
RenderWidgetHostImpl* widget_host =
RenderWidgetHostImpl::From(updated_view->GetRenderWidgetHost());
// We might end up here when |updated_view| has had active TextInputState and
// then got destroyed. In that case, |updated_view->GetRenderWidgetHost()|
// returns nullptr.
if (!widgetHost)
if (!widget_host)
return;
// Set the monitor state based on the text input focus state.
......@@ -476,8 +475,8 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
bool need_monitor_composition =
has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE;
widgetHost->RequestCompositionUpdates(false /* immediate_request */,
need_monitor_composition);
widget_host->RequestCompositionUpdates(false /* immediate_request */,
need_monitor_composition);
if (has_focus) {
SetTextInputActive(true);
......@@ -1118,8 +1117,8 @@ void RenderWidgetHostViewMac::SetActive(bool active) {
}
void RenderWidgetHostViewMac::ShowDefinitionForSelection() {
RenderWidgetHostViewMacDictionaryHelper helper(this);
helper.ShowDefinitionForSelection();
// This will round-trip to the NSView to determine the selection range.
ns_view_bridge_->ShowDictionaryOverlayForSelection();
}
void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) {
......@@ -1409,6 +1408,92 @@ void RenderWidgetHostViewMac::OnNSViewSmartMagnify(
host()->ForwardGestureEvent(smart_magnify_event);
}
void RenderWidgetHostViewMac::OnNSViewLookUpDictionaryOverlayFromRange(
const gfx::Range& range) {
content::RenderWidgetHostViewBase* focused_view =
GetFocusedViewForTextSelection();
if (!focused_view)
return;
RenderWidgetHostImpl* widget_host =
RenderWidgetHostImpl::From(focused_view->GetRenderWidgetHost());
if (!widget_host)
return;
int32_t target_widget_process_id = widget_host->GetProcess()->GetID();
int32_t target_widget_routing_id = widget_host->GetRoutingID();
TextInputClientMac::GetInstance()->GetStringFromRange(
widget_host, range,
base::BindOnce(&RenderWidgetHostViewMac::OnGotStringForDictionaryOverlay,
weak_factory_.GetWeakPtr(), target_widget_process_id,
target_widget_routing_id));
}
void RenderWidgetHostViewMac::OnNSViewLookUpDictionaryOverlayAtPoint(
const gfx::PointF& root_point) {
if (!host() || !host()->delegate() ||
!host()->delegate()->GetInputEventRouter())
return;
gfx::PointF transformed_point;
RenderWidgetHostImpl* widget_host =
host()->delegate()->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
this, root_point, &transformed_point);
if (!widget_host)
return;
int32_t target_widget_process_id = widget_host->GetProcess()->GetID();
int32_t target_widget_routing_id = widget_host->GetRoutingID();
TextInputClientMac::GetInstance()->GetStringAtPoint(
widget_host, gfx::ToFlooredPoint(transformed_point),
base::BindOnce(&RenderWidgetHostViewMac::OnGotStringForDictionaryOverlay,
weak_factory_.GetWeakPtr(), target_widget_process_id,
target_widget_routing_id));
}
void RenderWidgetHostViewMac::OnGotStringForDictionaryOverlay(
int32_t target_widget_process_id,
int32_t target_widget_routing_id,
const mac::AttributedStringCoder::EncodedString& encoded_string,
gfx::Point baseline_point) {
if (encoded_string.string().empty()) {
// The PDF plugin does not support getting the attributed string at point.
// Until it does, use NSPerformService(), which opens Dictionary.app.
// TODO(shuchen): Support GetStringAtPoint() & GetStringFromRange() for PDF.
// https://crbug.com/152438
// This often just opens a blank dictionary, not the definition of |string|.
// https://crbug.com/830047
// This path will be taken, inappropriately, when a lookup gesture was
// performed at a location that doesn't have text, but some text is
// selected.
// https://crbug.com/830906
if (auto* selection = GetTextSelection()) {
const base::string16& selected_text = selection->selected_text();
NSString* ns_selected_text = base::SysUTF16ToNSString(selected_text);
if ([ns_selected_text length] == 0)
return;
scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard;
NSArray* types = [NSArray arrayWithObject:NSStringPboardType];
[pasteboard->get() declareTypes:types owner:nil];
if ([pasteboard->get() setString:ns_selected_text
forType:NSStringPboardType]) {
NSPerformService(@"Look Up in Dictionary", pasteboard->get());
}
}
} else {
// By the time we get here |widget_host| might have been destroyed.
// https://crbug.com/737032
auto* widget_host = content::RenderWidgetHost::FromID(
target_widget_process_id, target_widget_routing_id);
if (widget_host) {
if (auto* rwhv = widget_host->GetView())
baseline_point = rwhv->TransformPointToRootCoordSpace(baseline_point);
}
if (ns_view_bridge_)
ns_view_bridge_->ShowDictionaryOverlay(encoded_string, baseline_point);
}
}
Class GetRenderWidgetHostViewCocoaClassForTesting() {
return [RenderWidgetHostViewCocoa class];
}
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_DICTIONARY_HELPER_H_
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_DICTIONARY_HELPER_H_
#include "base/macros.h"
#include "ui/gfx/geometry/vector2d.h"
namespace content {
class RenderWidgetHostView;
class RenderWidgetHostViewMac;
// A helper class to bring up definition of word for a RWHV.
//
// This is triggered by "Lookup in Dictionary" context menu item.
// Either uses Dictionary.app or a light-weight dictionary panel, based on
// system settings.
class RenderWidgetHostViewMacDictionaryHelper {
public:
explicit RenderWidgetHostViewMacDictionaryHelper(RenderWidgetHostView* view);
// Overrides the view to use to bring up dictionary panel.
// This |target_view| can be different from |view_|, |view_| is used to get
// the current selection value where |target_view| is used to bring up the
// cocoa dictionary panel.
void SetTargetView(RenderWidgetHostView* target_view);
void set_offset(const gfx::Vector2d& offset) { offset_ = offset; }
// Brings up either Dictionary.app or a light-weight dictionary panel,
// depending on system settings.
void ShowDefinitionForSelection();
private:
// This class shows definition for this view.
RenderWidgetHostViewMac* view_;
// This view is use to bring up the dictionary panel. Generally this is the
// same as |view_|. One can override the view to use via SetTargetView().
RenderWidgetHostViewMac* target_view_;
// The extra offset to use while positioning the dicitonary panel.
gfx::Vector2d offset_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacDictionaryHelper);
};
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_DICTIONARY_HELPER_H_
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h"
#include "base/strings/sys_string_conversions.h"
#import "content/browser/renderer_host/render_widget_host_view_cocoa.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
namespace content {
RenderWidgetHostViewMacDictionaryHelper::
RenderWidgetHostViewMacDictionaryHelper(RenderWidgetHostView* view)
: view_(static_cast<RenderWidgetHostViewMac*>(view)),
target_view_(static_cast<RenderWidgetHostViewMac*>(view)) {
}
void RenderWidgetHostViewMacDictionaryHelper::SetTargetView(
RenderWidgetHostView* target_view) {
target_view_ = static_cast<RenderWidgetHostViewMac*>(target_view);
}
void RenderWidgetHostViewMacDictionaryHelper::ShowDefinitionForSelection() {
NSRange selection_range = [view_->cocoa_view() selectedRange];
NSView* view = target_view_->cocoa_view();
[view_->cocoa_view() showLookUpDictionaryOverlayFromRange:selection_range
targetView:view];
}
} // namespace content
......@@ -8,7 +8,6 @@
#include "base/memory/ref_counted.h"
#include "base/strings/sys_string_conversions.h"
#import "content/browser/renderer_host/render_widget_host_view_cocoa.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/mac/attributed_string_coder.h"
......@@ -75,12 +74,9 @@ void TestTextInputClientMessageFilter::SetStringForRangeCallback(
void AskForLookUpDictionaryForRange(RenderWidgetHostView* tab_view,
const gfx::Range& range) {
RenderWidgetHostViewCocoa* cocoa_view =
static_cast<RenderWidgetHostViewMac*>(tab_view)->cocoa_view();
// Explicitly ask for the dictionary for the given range.
[cocoa_view showLookUpDictionaryOverlayFromRange:range.ToNSRange()
targetView:cocoa_view];
RenderWidgetHostViewMac* tab_view_mac =
static_cast<RenderWidgetHostViewMac*>(tab_view);
tab_view_mac->OnNSViewLookUpDictionaryOverlayFromRange(range);
}
size_t GetOpenNSWindowsCount() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment