Changeset 55389 in webkit
- Timestamp:
- Mar 1, 2010 5:12:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55386 r55389 1 2010-03-01 José Millán Soto <jmillan@igalia.com> 2 3 Reviewed by Gustavo Noronha Silva. 4 5 [GTK] Right click does not activate text entry 6 https://bugs.webkit.org/show_bug.cgi?id=29177 7 8 Stop skipping some tests which where failing because of right click 9 not being correct handled. 10 11 * platform/gtk/Skipped: 12 1 13 2010-03-01 Alex Milowski <alex@milowski.com> 2 14 -
trunk/LayoutTests/platform/gtk/Skipped
r55375 r55389 1337 1337 fast/events/js-keyboard-event-creation.html 1338 1338 fast/events/mouse-click-events.html 1339 fast/events/mouseclick-target-and-positioning.html1340 1339 fast/events/mouseup-from-button2.html 1341 1340 fast/events/offsetX-offsetY.html … … 1352 1351 fast/events/pointer-events-2.html 1353 1352 fast/events/popup-blocking-click-in-iframe.html 1354 fast/events/right-click-focus.html1355 1353 fast/events/scrollbar-double-click.html 1356 1354 fast/events/stop-load-in-unload-handler-using-document-write.html -
trunk/WebKit/gtk/ChangeLog
r55387 r55389 1 2010-03-01 José Millán Soto <jmillan@igalia.com> 2 3 Reviewed by Gustavo Noronha Silva. 4 5 [GTK] Right click does not activate text entry 6 https://bugs.webkit.org/show_bug.cgi?id=29177 7 8 Makes the frame handle the mouse click event before sending the 9 context menu event. 10 11 * webkit/webkitwebview.cpp: 12 (PopupMenuPositionFunc): 13 Function created to make the popup menu appear in the correct position, especially 14 when invoked from the keyboard. 15 (webkit_web_view_forward_context_menu_event): 16 Mouse click event is sent to frame before creating context menu, 17 PopupMenuPositionFunc used to determine the position where the menu should appear. 18 (webkit_web_view_popup_menu_handler): 19 Improved focused node position detection. Event button set to right button. 20 1 21 2010-03-01 Jakob Petsovits <jpetsovits@rim.com> 2 22 -
trunk/WebKit/gtk/webkit/webkitwebview.cpp
r55387 r55389 203 203 } 204 204 205 static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData) 206 { 207 WebKitWebView* view = WEBKIT_WEB_VIEW(userData); 208 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(view); 209 GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view)); 210 GtkRequisition menuSize; 211 212 gtk_widget_size_request(GTK_WIDGET(menu), &menuSize); 213 214 *x = priv->lastPopupXPosition; 215 if ((*x + menuSize.width) >= gdk_screen_get_width(screen)) 216 *x -= menuSize.width; 217 218 *y = priv->lastPopupYPosition; 219 if ((*y + menuSize.height) >= gdk_screen_get_height(screen)) 220 *y -= menuSize.height; 221 222 *pushIn = FALSE; 223 } 224 205 225 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event) 206 226 { 207 227 Page* page = core(webView); 208 228 page->contextMenuController()->clearContextMenu(); 209 Frame* focusedFrame = page->focusController()->focusedOrMainFrame(); 210 211 if (!focusedFrame->view()) 229 Frame* focusedFrame; 230 Frame* mainFrame = page->mainFrame(); 231 gboolean mousePressEventResult = FALSE; 232 233 if (!mainFrame->view()) 212 234 return FALSE; 213 235 214 focusedFrame->view()->setCursor(pointerCursor()); 236 mainFrame->view()->setCursor(pointerCursor()); 237 if (page->frameCount()) { 238 HitTestRequest request(HitTestRequest::Active); 239 IntPoint point = mainFrame->view()->windowToContents(event.pos()); 240 MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event); 241 242 Frame* targetFrame = EventHandler::subframeForTargetNode(mev.targetNode()); 243 if (!targetFrame) 244 targetFrame = mainFrame; 245 246 focusedFrame = page->focusController()->focusedOrMainFrame(); 247 if (targetFrame != focusedFrame) { 248 page->focusController()->setFocusedFrame(targetFrame); 249 focusedFrame = targetFrame; 250 } 251 } else 252 focusedFrame = mainFrame; 253 254 if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event)) 255 mousePressEventResult = TRUE; 256 257 215 258 bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event); 216 259 if (!handledEvent) … … 218 261 219 262 // If coreMenu is NULL, this means WebCore decided to not create 220 // the default context menu; this may still mean that the frame 221 // wants to consume the event - this happens when the page is 222 // handling the right-click for reasons other than a context menu, 223 // so we give it to it. 263 // the default context menu; this may happen when the page is 264 // handling the right-click for reasons other than the context menu. 224 265 ContextMenu* coreMenu = page->contextMenuController()->contextMenu(); 225 if (!coreMenu) { 226 Frame* frame = core(webView)->mainFrame(); 227 if (frame->view() && frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event))) 228 return TRUE; 229 230 return FALSE; 231 } 266 if (!coreMenu) 267 return mousePressEventResult; 232 268 233 269 // If we reach here, it's because WebCore is going to show the … … 263 299 264 300 gtk_menu_popup(menu, NULL, NULL, 265 NULL,266 priv, event.button() + 1, gtk_get_current_event_time());301 &PopupMenuPositionFunc, 302 webView, event.button() + 1, gtk_get_current_event_time()); 267 303 return TRUE; 268 304 } … … 274 310 // The context menu event was generated from the keyboard, so show the context menu by the current selection. 275 311 Page* page = core(WEBKIT_WEB_VIEW(widget)); 276 FrameView* view = page->mainFrame()->view(); 312 Frame* frame = page->focusController()->focusedOrMainFrame(); 313 FrameView* view = frame->view(); 277 314 if (!view) 278 315 return FALSE; 279 316 280 Position start = page->mainFrame()->selection()->selection().start();281 Position end = page->mainFrame()->selection()->selection().end();317 Position start = frame->selection()->selection().start(); 318 Position end = frame->selection()->selection().end(); 282 319 283 320 int rightAligned = FALSE; 284 321 IntPoint location; 285 322 286 if (!start.node() || !end.node()) 323 if (!start.node() || !end.node() 324 || (frame->selection()->selection().isCaret() && !frame->selection()->selection().isContentEditable())) 287 325 location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin); 288 326 else { … … 330 368 // Ideally we'd have the position of a context menu event be separate from its target node. 331 369 location = view->contentsToWindow(location) + IntSize(0, -1); 370 if (location.y() < 0) 371 location.setY(contextMenuMargin); 372 else if (location.y() > view->height()) 373 location.setY(view->height() - contextMenuMargin); 374 if (location.x() < 0) 375 location.setX(contextMenuMargin); 376 else if (location.x() > view->width()) 377 location.setX(view->width() - contextMenuMargin); 332 378 IntPoint global = location + IntSize(x, y); 333 PlatformMouseEvent event(location, global, NoButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time()); 379 380 PlatformMouseEvent event(location, global, RightButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time()); 334 381 335 382 return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
Note: See TracChangeset
for help on using the changeset viewer.