summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webview_impl.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 19:11:17 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-19 19:11:17 +0000
commit63c85eee887a619b61fe4454b579237fdcaf25b9 (patch)
treeab6a3ac8b4edb0e64bda0fcc48e48e9a17753668 /webkit/glue/webview_impl.cc
parent812f6a70e4900cb641b3a72292a019eb2a765bce (diff)
downloadchromium_src-63c85eee887a619b61fe4454b579237fdcaf25b9.zip
chromium_src-63c85eee887a619b61fe4454b579237fdcaf25b9.tar.gz
chromium_src-63c85eee887a619b61fe4454b579237fdcaf25b9.tar.bz2
Do correct hit testing for context menu items in WebViewImpl.
BUG=8100 Review URL: http://codereview.chromium.org/42377 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r--webkit/glue/webview_impl.cc27
1 files changed, 11 insertions, 16 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 69ca561..8c86ff8 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -446,11 +446,7 @@ void WebViewImpl::MouseContextMenu(const WebMouseEvent& event) {
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,12 +1381,7 @@ void WebViewImpl::CopyImageAt(int x, int y) {
if (!page_.get())
return;
- IntPoint point = IntPoint(x, y);
-
- Frame* frame = page_->mainFrame();
-
- HitTestResult result =
- frame->eventHandler()->hitTestResultAtPoint(point, false);
+ HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
if (result.absoluteImageURL().isEmpty()) {
// There isn't actually an image at these coordinates. Might be because
@@ -1403,7 +1394,7 @@ void WebViewImpl::CopyImageAt(int x, int y) {
return;
}
- frame->editor()->copyImage(result);
+ page_->mainFrame()->editor()->copyImage(result);
}
void WebViewImpl::InspectElement(int x, int y) {
@@ -1413,10 +1404,7 @@ void WebViewImpl::InspectElement(int x, int y) {
if (x == -1 || y == -1) {
page_->inspectorController()->inspect(NULL);
} else {
- IntPoint point = IntPoint(x, y);
- HitTestResult result(point);
-
- result = page_->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false);
+ HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
if (!result.innerNonSharedNode())
return;
@@ -1713,3 +1701,10 @@ Node* WebViewImpl::GetFocusedNode() {
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);
+}