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

Unified Diff: third_party/WebKit/Source/web/mac/WebSubstringUtil.mm

Issue 2278283002: Implement Mac Pop-up Dictionary for OOPIF. (Closed)
Patch Set: Added Tests and Modified DEPS Created 4 years, 4 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: third_party/WebKit/Source/web/mac/WebSubstringUtil.mm
diff --git a/third_party/WebKit/Source/web/mac/WebSubstringUtil.mm b/third_party/WebKit/Source/web/mac/WebSubstringUtil.mm
index c32db74669ef2c763a1399629e7f4166298cc9fb..c04030c9edb5551cd519e8d517893860aa33e40c 100644
--- a/third_party/WebKit/Source/web/mac/WebSubstringUtil.mm
+++ b/third_party/WebKit/Source/web/mac/WebSubstringUtil.mm
@@ -53,6 +53,9 @@
#include "public/web/WebHitTestResult.h"
#include "public/web/WebRange.h"
#include "public/web/WebView.h"
+#include "public/web/WebWidget.h"
+#include "web/WebFrameWidgetBase.h"
+#include "web/WebFrameWidgetImpl.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebViewImpl.h"
@@ -136,9 +139,15 @@ WebPoint getBaselinePoint(FrameView* frameView, const EphemeralRange& range, NSA
namespace blink {
-NSAttributedString* WebSubstringUtil::attributedWordAtPoint(WebView* view, WebPoint point, WebPoint& baselinePoint)
+NSAttributedString* WebSubstringUtil::attributedWordAtPoint(WebView* view, WebWidget* widget, WebPoint point, WebPoint& baselinePoint)
{
- HitTestResult result = static_cast<WebViewImpl*>(view)->coreHitTestResultAt(point);
+ WebViewImpl* viewImpl = static_cast<WebViewImpl*>(view);
+
+ // Either this call is for a main frame's WebView or a local roots WebFrameWidgetImpl.
+ if (!viewImpl->mainFrameImpl() && !widget)
+ return nil;
+
+ HitTestResult result = viewImpl->mainFrameImpl() ? viewImpl->coreHitTestResultAt(point) : static_cast<WebFrameWidgetImpl*>(widget)->coreHitTestResultAt(point);
if (!result.innerNode())
return nil;
LocalFrame* frame = result.innerNode()->document().frame();

Powered by Google App Engine
This is Rietveld 408576698