Changeset 196265 in webkit
- Timestamp:
- Feb 8, 2016 11:42:42 AM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r196263 r196265 1 2016-02-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] WebKitWebView should send crossing events to the WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=153740 5 6 Reviewed by Michael Catanzaro. 7 8 Update the target element under the mouse also when only updating 9 scrollbars, so that if the mouse enters the page when the window 10 is not active, the scroll animator is notified that the mouse 11 entered the scrollable area. 12 13 * page/EventHandler.cpp: 14 (WebCore::EventHandler::handleMouseMoveEvent): Call 15 updateMouseEventTargetNode() before early returning in case of 16 only updating scrollbars. 17 1 18 2016-02-08 Jeremy Jones <jeremyj@apple.com> 2 19 -
trunk/Source/WebCore/page/EventHandler.cpp
r196256 r196265 1883 1883 scrollbar->mouseMoved(platformMouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering. 1884 1884 #endif 1885 if (onlyUpdateScrollbars) 1885 if (onlyUpdateScrollbars) { 1886 updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true); 1886 1887 return true; 1888 } 1887 1889 } 1888 1890 -
trunk/Source/WebKit2/ChangeLog
r196264 r196265 1 2016-02-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] WebKitWebView should send crossing events to the WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=153740 5 6 Reviewed by Michael Catanzaro. 7 8 We don't currently handle crossing events in the web view 9 (enter/leave). That's why if you hover a scrollbar and leave the 10 window, the scrollbar is still rendered as hovered. 11 12 * Shared/gtk/WebEventFactory.cpp: 13 (WebKit::buttonForEvent): Handle the case of GDK_ENTER_NOTIFY and 14 GDK_LEAVE_NOTIFY events. 15 (WebKit::WebEventFactory::createWebMouseEvent): Ditto. 16 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 17 (webkitWebViewBaseRealize): Add GDK_ENTER_NOTIFY_MASK and 18 GDK_LEAVE_NOTIFY_MASK flags to the web view event mask. 19 (webkitWebViewBaseCrossingNotifyEvent): Handle enter/leave notify 20 events by generating a mouse move event, ensuring the double to 21 int conversion will not cause any problem. 22 (webkit_web_view_base_class_init): Add an implementation for 23 enter_notify_event and leave_notify_event. 24 1 25 2016-02-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 26 -
trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
r196256 r196265 73 73 74 74 switch (event->type) { 75 case GDK_MOTION_NOTIFY: 75 case GDK_ENTER_NOTIFY: 76 case GDK_LEAVE_NOTIFY: 77 case GDK_MOTION_NOTIFY: { 76 78 button = WebMouseEvent::NoButton; 77 if (event->motion.state & GDK_BUTTON1_MASK) 79 GdkModifierType state; 80 gdk_event_get_state(event, &state); 81 if (state & GDK_BUTTON1_MASK) 78 82 button = WebMouseEvent::LeftButton; 79 else if ( event->motion.state & GDK_BUTTON2_MASK)83 else if (state & GDK_BUTTON2_MASK) 80 84 button = WebMouseEvent::MiddleButton; 81 else if ( event->motion.state & GDK_BUTTON3_MASK)85 else if (state & GDK_BUTTON3_MASK) 82 86 button = WebMouseEvent::RightButton; 83 87 break; 88 } 84 89 case GDK_BUTTON_PRESS: 85 90 case GDK_2BUTTON_PRESS: … … 109 114 switch (event->type) { 110 115 case GDK_MOTION_NOTIFY: 116 case GDK_ENTER_NOTIFY: 117 case GDK_LEAVE_NOTIFY: 111 118 type = WebEvent::MouseMove; 112 119 break; -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r196257 r196265 360 360 | GDK_SMOOTH_SCROLL_MASK 361 361 | GDK_POINTER_MOTION_MASK 362 | GDK_ENTER_NOTIFY_MASK 363 | GDK_LEAVE_NOTIFY_MASK 362 364 | GDK_KEY_PRESS_MASK 363 365 | GDK_KEY_RELEASE_MASK … … 832 834 833 835 priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); 836 837 return FALSE; 838 } 839 840 static gboolean webkitWebViewBaseCrossingNotifyEvent(GtkWidget* widget, GdkEventCrossing* crosssingEvent) 841 { 842 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); 843 WebKitWebViewBasePrivate* priv = webViewBase->priv; 844 845 if (priv->authenticationDialog) 846 return FALSE; 847 848 // In the case of crossing events, it's very important the actual coordinates the WebProcess receives, because once the mouse leaves 849 // the web view, the WebProcess won't receive more events until the mouse enters again in the web view. So, if the coordinates of the leave 850 // event are not accurate, the WebProcess might not know the mouse left the view. This can happen because of double to integer conversion, 851 // if the coordinates of the leave event are for example (25.2, -0.9), the WebProcess will receive (25, 0) and any hit test will succeed 852 // because those coordinates are inside the web view. 853 GtkAllocation allocation; 854 gtk_widget_get_allocation(widget, &allocation); 855 double width = allocation.width; 856 double height = allocation.height; 857 double x = crosssingEvent->x; 858 double y = crosssingEvent->y; 859 if (x < 0 && x > -1) 860 x = -1; 861 else if (x >= width && x < width + 1) 862 x = width + 1; 863 if (y < 0 && y > -1) 864 y = -1; 865 else if (y >= height && y < height + 1) 866 y = height + 1; 867 868 GdkEvent* event = reinterpret_cast<GdkEvent*>(crosssingEvent); 869 GUniquePtr<GdkEvent> copiedEvent; 870 if (x != crosssingEvent->x || y != crosssingEvent->y) { 871 copiedEvent.reset(gdk_event_copy(event)); 872 copiedEvent->crossing.x = x; 873 copiedEvent->crossing.y = y; 874 } 875 876 priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(copiedEvent ? copiedEvent.get() : event, 0 /* currentClickCount */)); 834 877 835 878 return FALSE; … … 1080 1123 widgetClass->scroll_event = webkitWebViewBaseScrollEvent; 1081 1124 widgetClass->motion_notify_event = webkitWebViewBaseMotionNotifyEvent; 1125 widgetClass->enter_notify_event = webkitWebViewBaseCrossingNotifyEvent; 1126 widgetClass->leave_notify_event = webkitWebViewBaseCrossingNotifyEvent; 1082 1127 #if ENABLE(TOUCH_EVENTS) 1083 1128 widgetClass->touch_event = webkitWebViewBaseTouchEvent;
Note: See TracChangeset
for help on using the changeset viewer.