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

Unified Diff: webkit/glue/webview_impl.cc

Issue 42377: Do correct hit testing for context menu items in WebViewImpl. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 12035)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -446,11 +446,7 @@
MakePlatformMouseEvent pme(main_frame()->frameview(), event);
// Find the right target frame. See issue 1186900.
- IntPoint doc_point(
- page_->mainFrame()->view()->windowToContents(pme.pos()));
- HitTestResult result =
- page_->mainFrame()->eventHandler()->hitTestResultAtPoint(
- doc_point, false);
+ HitTestResult result = HitTestResultForWindowPos(pme.pos());
Frame* target_frame;
if (result.innerNonSharedNode())
target_frame = result.innerNonSharedNode()->document()->frame();
@@ -1385,13 +1381,8 @@
if (!page_.get())
return;
- IntPoint point = IntPoint(x, y);
+ HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
- Frame* frame = page_->mainFrame();
-
- HitTestResult result =
- frame->eventHandler()->hitTestResultAtPoint(point, false);
-
if (result.absoluteImageURL().isEmpty()) {
// There isn't actually an image at these coordinates. Might be because
// the window scrolled while the context menu was open or because the page
@@ -1403,7 +1394,7 @@
return;
}
- frame->editor()->copyImage(result);
+ page_->mainFrame()->editor()->copyImage(result);
}
void WebViewImpl::InspectElement(int x, int y) {
@@ -1413,11 +1404,8 @@
if (x == -1 || y == -1) {
page_->inspectorController()->inspect(NULL);
} else {
- IntPoint point = IntPoint(x, y);
- HitTestResult result(point);
+ HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
- result = page_->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false);
-
if (!result.innerNonSharedNode())
return;
@@ -1713,3 +1701,10 @@
return document->focusedNode();
}
+
+HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) {
+ IntPoint doc_point(
+ page_->mainFrame()->view()->windowToContents(pos));
+ return page_->mainFrame()->eventHandler()->
+ hitTestResultAtPoint(doc_point, false);
+}
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698