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

Side by Side Diff: webkit/glue/context_menu_client_impl.cc

Issue 16204: Fix 3474: Context menu issues when page is zoomed.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 MSVC_PUSH_WARNING_LEVEL(0); 9 MSVC_PUSH_WARNING_LEVEL(0);
10 #include "ContextMenu.h" 10 #include "ContextMenu.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 WebCore::ContextMenu* default_menu) { 132 WebCore::ContextMenu* default_menu) {
133 // Displaying the context menu in this function is a big hack as we don't 133 // Displaying the context menu in this function is a big hack as we don't
134 // have context, i.e. whether this is being invoked via a script or in 134 // have context, i.e. whether this is being invoked via a script or in
135 // response to user input (Mouse event WM_RBUTTONDOWN, 135 // response to user input (Mouse event WM_RBUTTONDOWN,
136 // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked 136 // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked
137 // in response to the above input events before popping up the context menu. 137 // in response to the above input events before popping up the context menu.
138 if (!webview_->context_menu_allowed()) 138 if (!webview_->context_menu_allowed())
139 return NULL; 139 return NULL;
140 140
141 WebCore::HitTestResult r = default_menu->hitTestResult(); 141 WebCore::HitTestResult r = default_menu->hitTestResult();
142 WebCore::Frame* selected_frame = r.innerNonSharedNode()->document()->frame(); 142 WebCore::Frame* selected_frame = r.innerNonSharedNode()->document()->frame();
brettw 2008/12/22 17:09:21 The un-adjusted hit test result is used several ti
143 143
144 WebCore::IntPoint menu_point = 144 WebCore::IntPoint menu_point =
145 selected_frame->view()->contentsToWindow(r.point()); 145 selected_frame->view()->contentsToWindow(r.point());
146 146
147 // Adjust for any page zoom.
148 if (selected_frame->pageZoomFactor() != 1.0f) {
149 float zoom_factor = selected_frame->pageZoomFactor();
150 menu_point.setX(static_cast<int>(menu_point.x() * zoom_factor));
151 menu_point.setY(static_cast<int>(menu_point.y() * zoom_factor));
152 r = selected_frame->eventHandler()->hitTestResultAtPoint(menu_point, false);
153 }
154
147 ContextNode::Type type = ContextNode::NONE; 155 ContextNode::Type type = ContextNode::NONE;
148 156
149 // Links, Images and Image-Links take preference over all else. 157 // Links, Images and Image-Links take preference over all else.
150 WebCore::KURL link_url = r.absoluteLinkURL(); 158 WebCore::KURL link_url = r.absoluteLinkURL();
151 if (!link_url.isEmpty()) { 159 if (!link_url.isEmpty()) {
152 type = ContextNode::LINK; 160 type = ContextNode::LINK;
153 } 161 }
154 WebCore::KURL image_url = r.absoluteImageURL(); 162 WebCore::KURL image_url = r.absoluteImageURL();
155 if (!image_url.isEmpty()) { 163 if (!image_url.isEmpty()) {
156 type = ContextNode::IMAGE; 164 type = ContextNode::IMAGE;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 279
272 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() { 280 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() {
273 return false; // TODO(jackson): Eventually include the inspector context me nu item 281 return false; // TODO(jackson): Eventually include the inspector context me nu item
274 } 282 }
275 283
276 #if defined(OS_MACOSX) 284 #if defined(OS_MACOSX)
277 void ContextMenuClientImpl::searchWithSpotlight() { 285 void ContextMenuClientImpl::searchWithSpotlight() {
278 // TODO(pinkerton): write this 286 // TODO(pinkerton): write this
279 } 287 }
280 #endif 288 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698