| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
| 9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 29 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 30 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 30 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| 31 #include "content/browser/bad_message.h" | 31 #include "content/browser/bad_message.h" |
| 32 #import "content/browser/cocoa/system_hotkey_helper_mac.h" | 32 #import "content/browser/cocoa/system_hotkey_helper_mac.h" |
| 33 #import "content/browser/cocoa/system_hotkey_map.h" | 33 #import "content/browser/cocoa/system_hotkey_map.h" |
| 34 #include "content/browser/compositor/resize_lock.h" | 34 #include "content/browser/compositor/resize_lock.h" |
| 35 #include "content/browser/frame_host/frame_tree.h" | 35 #include "content/browser/frame_host/frame_tree.h" |
| 36 #include "content/browser/frame_host/frame_tree_node.h" | 36 #include "content/browser/frame_host/frame_tree_node.h" |
| 37 #include "content/browser/frame_host/render_frame_host_impl.h" | 37 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 38 #include "content/browser/gpu/compositor_util.h" | 38 #include "content/browser/gpu/compositor_util.h" |
| 39 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" | |
| 40 #include "content/browser/renderer_host/render_view_host_impl.h" | 39 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 41 #include "content/browser/renderer_host/render_widget_helper.h" | 40 #include "content/browser/renderer_host/render_widget_helper.h" |
| 42 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 41 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 43 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 42 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 44 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he
lper.h" | 43 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he
lper.h" |
| 45 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" | 44 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" |
| 46 #include "content/browser/renderer_host/render_widget_resize_helper.h" | 45 #include "content/browser/renderer_host/render_widget_resize_helper.h" |
| 47 #import "content/browser/renderer_host/text_input_client_mac.h" | 46 #import "content/browser/renderer_host/text_input_client_mac.h" |
| 48 #include "content/common/accessibility_messages.h" | 47 #include "content/common/accessibility_messages.h" |
| 49 #include "content/common/edit_command.h" | 48 #include "content/common/edit_command.h" |
| 50 #include "content/common/gpu/gpu_messages.h" | 49 #include "content/common/gpu/gpu_messages.h" |
| 51 #include "content/common/input_messages.h" | 50 #include "content/common/input_messages.h" |
| 52 #include "content/common/view_messages.h" | 51 #include "content/common/view_messages.h" |
| 53 #include "content/common/webplugin_geometry.h" | 52 #include "content/common/webplugin_geometry.h" |
| 54 #include "content/public/browser/browser_context.h" | 53 #include "content/public/browser/browser_context.h" |
| 55 #include "content/public/browser/browser_plugin_guest_manager.h" | 54 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 56 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/native_web_keyboard_event.h" | 56 #include "content/public/browser/native_web_keyboard_event.h" |
| 58 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
| 59 #include "content/public/browser/notification_types.h" | 58 #include "content/public/browser/notification_types.h" |
| 60 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 59 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 61 #import "content/public/browser/render_widget_host_view_mac_delegate.h" | 60 #import "content/public/browser/render_widget_host_view_mac_delegate.h" |
| 62 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
| 63 #include "skia/ext/platform_canvas.h" | 62 #include "skia/ext/platform_canvas.h" |
| 64 #include "skia/ext/skia_utils_mac.h" | 63 #include "skia/ext/skia_utils_mac.h" |
| 65 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 64 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 66 #include "third_party/WebKit/public/web/WebInputEvent.h" | 65 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 66 #include "third_party/WebKit/public/web/mac/WebInputEventFactory.h" |
| 67 #import "third_party/mozilla/ComplexTextInputPanel.h" | 67 #import "third_party/mozilla/ComplexTextInputPanel.h" |
| 68 #include "ui/accelerated_widget_mac/io_surface_layer.h" | 68 #include "ui/accelerated_widget_mac/io_surface_layer.h" |
| 69 #include "ui/accelerated_widget_mac/surface_handle_types.h" | 69 #include "ui/accelerated_widget_mac/surface_handle_types.h" |
| 70 #include "ui/base/cocoa/animation_utils.h" | 70 #include "ui/base/cocoa/animation_utils.h" |
| 71 #import "ui/base/cocoa/fullscreen_window_manager.h" | 71 #import "ui/base/cocoa/fullscreen_window_manager.h" |
| 72 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 72 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
| 73 #include "ui/base/layout.h" | 73 #include "ui/base/layout.h" |
| 74 #include "ui/compositor/compositor.h" | 74 #include "ui/compositor/compositor.h" |
| 75 #include "ui/compositor/layer.h" | 75 #include "ui/compositor/layer.h" |
| 76 #include "ui/events/keycodes/keyboard_codes.h" | 76 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 90 using content::FrameTreeNode; | 90 using content::FrameTreeNode; |
| 91 using content::NativeWebKeyboardEvent; | 91 using content::NativeWebKeyboardEvent; |
| 92 using content::RenderFrameHost; | 92 using content::RenderFrameHost; |
| 93 using content::RenderViewHost; | 93 using content::RenderViewHost; |
| 94 using content::RenderViewHostImpl; | 94 using content::RenderViewHostImpl; |
| 95 using content::RenderWidgetHostImpl; | 95 using content::RenderWidgetHostImpl; |
| 96 using content::RenderWidgetHostViewMac; | 96 using content::RenderWidgetHostViewMac; |
| 97 using content::RenderWidgetHostViewMacEditCommandHelper; | 97 using content::RenderWidgetHostViewMacEditCommandHelper; |
| 98 using content::TextInputClientMac; | 98 using content::TextInputClientMac; |
| 99 using content::WebContents; | 99 using content::WebContents; |
| 100 using content::WebGestureEventBuilder; | |
| 101 using content::WebMouseEventBuilder; | |
| 102 using content::WebMouseWheelEventBuilder; | |
| 103 using blink::WebInputEvent; | 100 using blink::WebInputEvent; |
| 101 using blink::WebInputEventFactory; |
| 104 using blink::WebMouseEvent; | 102 using blink::WebMouseEvent; |
| 105 using blink::WebMouseWheelEvent; | 103 using blink::WebMouseWheelEvent; |
| 106 using blink::WebGestureEvent; | 104 using blink::WebGestureEvent; |
| 107 | 105 |
| 108 namespace { | 106 namespace { |
| 109 | 107 |
| 110 // Whether a keyboard event has been reserved by OSX. | 108 // Whether a keyboard event has been reserved by OSX. |
| 111 BOOL EventIsReservedBySystem(NSEvent* event) { | 109 BOOL EventIsReservedBySystem(NSEvent* event) { |
| 112 content::SystemHotkeyHelperMac* helper = | 110 content::SystemHotkeyHelperMac* helper = |
| 113 content::SystemHotkeyHelperMac::GetInstance(); | 111 content::SystemHotkeyHelperMac::GetInstance(); |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 NSPoint location = [window mouseLocationOutsideOfEventStream]; | 1279 NSPoint location = [window mouseLocationOutsideOfEventStream]; |
| 1282 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved | 1280 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved |
| 1283 location:location | 1281 location:location |
| 1284 modifierFlags:0 | 1282 modifierFlags:0 |
| 1285 timestamp:0 | 1283 timestamp:0 |
| 1286 windowNumber:window_number() | 1284 windowNumber:window_number() |
| 1287 context:nil | 1285 context:nil |
| 1288 eventNumber:0 | 1286 eventNumber:0 |
| 1289 clickCount:0 | 1287 clickCount:0 |
| 1290 pressure:0]; | 1288 pressure:0]; |
| 1291 WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_); | 1289 WebMouseEvent web_event = |
| 1290 WebInputEventFactory::mouseEvent(event, cocoa_view_); |
| 1292 if (showing) | 1291 if (showing) |
| 1293 web_event.type = WebInputEvent::MouseLeave; | 1292 web_event.type = WebInputEvent::MouseLeave; |
| 1294 ForwardMouseEvent(web_event); | 1293 ForwardMouseEvent(web_event); |
| 1295 } | 1294 } |
| 1296 | 1295 |
| 1297 bool RenderWidgetHostViewMac::IsPopup() const { | 1296 bool RenderWidgetHostViewMac::IsPopup() const { |
| 1298 return popup_type_ != blink::WebPopupTypeNone; | 1297 return popup_type_ != blink::WebPopupTypeNone; |
| 1299 } | 1298 } |
| 1300 | 1299 |
| 1301 void RenderWidgetHostViewMac::CopyFromCompositingSurface( | 1300 void RenderWidgetHostViewMac::CopyFromCompositingSurface( |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 if (responderDelegate_ && | 1974 if (responderDelegate_ && |
| 1976 [responderDelegate_ respondsToSelector:@selector(handleEvent:)]) { | 1975 [responderDelegate_ respondsToSelector:@selector(handleEvent:)]) { |
| 1977 BOOL handled = [responderDelegate_ handleEvent:theEvent]; | 1976 BOOL handled = [responderDelegate_ handleEvent:theEvent]; |
| 1978 if (handled) | 1977 if (handled) |
| 1979 return; | 1978 return; |
| 1980 } | 1979 } |
| 1981 | 1980 |
| 1982 if ([self shouldIgnoreMouseEvent:theEvent]) { | 1981 if ([self shouldIgnoreMouseEvent:theEvent]) { |
| 1983 // If this is the first such event, send a mouse exit to the host view. | 1982 // If this is the first such event, send a mouse exit to the host view. |
| 1984 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { | 1983 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { |
| 1985 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); | 1984 WebMouseEvent exitEvent = |
| 1985 WebInputEventFactory::mouseEvent(theEvent, self); |
| 1986 exitEvent.type = WebInputEvent::MouseLeave; | 1986 exitEvent.type = WebInputEvent::MouseLeave; |
| 1987 exitEvent.button = WebMouseEvent::ButtonNone; | 1987 exitEvent.button = WebMouseEvent::ButtonNone; |
| 1988 renderWidgetHostView_->ForwardMouseEvent(exitEvent); | 1988 renderWidgetHostView_->ForwardMouseEvent(exitEvent); |
| 1989 } | 1989 } |
| 1990 mouseEventWasIgnored_ = YES; | 1990 mouseEventWasIgnored_ = YES; |
| 1991 return; | 1991 return; |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 if (mouseEventWasIgnored_) { | 1994 if (mouseEventWasIgnored_) { |
| 1995 // If this is the first mouse event after a previous event that was ignored | 1995 // If this is the first mouse event after a previous event that was ignored |
| 1996 // due to the hitTest, send a mouse enter event to the host view. | 1996 // due to the hitTest, send a mouse enter event to the host view. |
| 1997 if (renderWidgetHostView_->render_widget_host_) { | 1997 if (renderWidgetHostView_->render_widget_host_) { |
| 1998 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); | 1998 WebMouseEvent enterEvent = |
| 1999 WebInputEventFactory::mouseEvent(theEvent, self); |
| 1999 enterEvent.type = WebInputEvent::MouseMove; | 2000 enterEvent.type = WebInputEvent::MouseMove; |
| 2000 enterEvent.button = WebMouseEvent::ButtonNone; | 2001 enterEvent.button = WebMouseEvent::ButtonNone; |
| 2001 if (renderWidgetHostView_->render_widget_host_->delegate() && | 2002 if (renderWidgetHostView_->render_widget_host_->delegate() && |
| 2002 renderWidgetHostView_->render_widget_host_->delegate() | 2003 renderWidgetHostView_->render_widget_host_->delegate() |
| 2003 ->GetInputEventRouter()) { | 2004 ->GetInputEventRouter()) { |
| 2004 renderWidgetHostView_->render_widget_host_->delegate() | 2005 renderWidgetHostView_->render_widget_host_->delegate() |
| 2005 ->GetInputEventRouter() | 2006 ->GetInputEventRouter() |
| 2006 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); | 2007 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); |
| 2007 } else { | 2008 } else { |
| 2008 renderWidgetHostView_->ForwardMouseEvent(enterEvent); | 2009 renderWidgetHostView_->ForwardMouseEvent(enterEvent); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2027 // wants to handle them. But it won't work without implementing method | 2028 // wants to handle them. But it won't work without implementing method |
| 2028 // - (NSUInteger)characterIndexForPoint:. | 2029 // - (NSUInteger)characterIndexForPoint:. |
| 2029 // See: http://code.google.com/p/chromium/issues/detail?id=47141 | 2030 // See: http://code.google.com/p/chromium/issues/detail?id=47141 |
| 2030 // Instead of sending mouse events to the input method first, we now just | 2031 // Instead of sending mouse events to the input method first, we now just |
| 2031 // simply confirm all ongoing composition here. | 2032 // simply confirm all ongoing composition here. |
| 2032 if (type == NSLeftMouseDown || type == NSRightMouseDown || | 2033 if (type == NSLeftMouseDown || type == NSRightMouseDown || |
| 2033 type == NSOtherMouseDown) { | 2034 type == NSOtherMouseDown) { |
| 2034 [self confirmComposition]; | 2035 [self confirmComposition]; |
| 2035 } | 2036 } |
| 2036 | 2037 |
| 2037 WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self); | 2038 WebMouseEvent event = WebInputEventFactory::mouseEvent(theEvent, self); |
| 2038 if (renderWidgetHostView_->render_widget_host_->delegate() && | 2039 if (renderWidgetHostView_->render_widget_host_->delegate() && |
| 2039 renderWidgetHostView_->render_widget_host_->delegate() | 2040 renderWidgetHostView_->render_widget_host_->delegate() |
| 2040 ->GetInputEventRouter()) { | 2041 ->GetInputEventRouter()) { |
| 2041 renderWidgetHostView_->render_widget_host_->delegate() | 2042 renderWidgetHostView_->render_widget_host_->delegate() |
| 2042 ->GetInputEventRouter() | 2043 ->GetInputEventRouter() |
| 2043 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); | 2044 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); |
| 2044 } else { | 2045 } else { |
| 2045 renderWidgetHostView_->ForwardMouseEvent(event); | 2046 renderWidgetHostView_->ForwardMouseEvent(event); |
| 2046 } | 2047 } |
| 2047 } | 2048 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 if ([event phase] != NSEventPhaseEnded && | 2361 if ([event phase] != NSEventPhaseEnded && |
| 2361 [event phase] != NSEventPhaseCancelled) { | 2362 [event phase] != NSEventPhaseCancelled) { |
| 2362 return; | 2363 return; |
| 2363 } | 2364 } |
| 2364 | 2365 |
| 2365 if (renderWidgetHostView_->render_widget_host_) { | 2366 if (renderWidgetHostView_->render_widget_host_) { |
| 2366 // History-swiping is not possible if the logic reaches this point. | 2367 // History-swiping is not possible if the logic reaches this point. |
| 2367 // Allow rubber-banding in both directions. | 2368 // Allow rubber-banding in both directions. |
| 2368 bool canRubberbandLeft = true; | 2369 bool canRubberbandLeft = true; |
| 2369 bool canRubberbandRight = true; | 2370 bool canRubberbandRight = true; |
| 2370 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( | 2371 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( |
| 2371 event, self, canRubberbandLeft, canRubberbandRight); | 2372 event, self, canRubberbandLeft, canRubberbandRight); |
| 2372 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); | 2373 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); |
| 2373 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); | 2374 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); |
| 2374 } | 2375 } |
| 2375 | 2376 |
| 2376 if (endWheelMonitor_) { | 2377 if (endWheelMonitor_) { |
| 2377 [NSEvent removeMonitor:endWheelMonitor_]; | 2378 [NSEvent removeMonitor:endWheelMonitor_]; |
| 2378 endWheelMonitor_ = nil; | 2379 endWheelMonitor_ = nil; |
| 2379 } | 2380 } |
| 2380 } | 2381 } |
| 2381 | 2382 |
| 2382 - (void)beginGestureWithEvent:(NSEvent*)event { | 2383 - (void)beginGestureWithEvent:(NSEvent*)event { |
| 2383 [responderDelegate_ beginGestureWithEvent:event]; | 2384 [responderDelegate_ beginGestureWithEvent:event]; |
| 2384 gestureBeginEvent_.reset( | 2385 gestureBeginEvent_.reset( |
| 2385 new WebGestureEvent(WebGestureEventBuilder::Build(event, self))); | 2386 new WebGestureEvent(WebInputEventFactory::gestureEvent(event, self))); |
| 2386 | 2387 |
| 2387 // If the page is at the minimum zoom level, require a threshold be reached | 2388 // If the page is at the minimum zoom level, require a threshold be reached |
| 2388 // before the pinch has an effect. | 2389 // before the pinch has an effect. |
| 2389 if (renderWidgetHostView_->page_at_minimum_scale_) { | 2390 if (renderWidgetHostView_->page_at_minimum_scale_) { |
| 2390 pinchHasReachedZoomThreshold_ = false; | 2391 pinchHasReachedZoomThreshold_ = false; |
| 2391 pinchUnusedAmount_ = 1; | 2392 pinchUnusedAmount_ = 1; |
| 2392 } | 2393 } |
| 2393 } | 2394 } |
| 2394 | 2395 |
| 2395 - (void)endGestureWithEvent:(NSEvent*)event { | 2396 - (void)endGestureWithEvent:(NSEvent*)event { |
| 2396 [responderDelegate_ endGestureWithEvent:event]; | 2397 [responderDelegate_ endGestureWithEvent:event]; |
| 2397 gestureBeginEvent_.reset(); | 2398 gestureBeginEvent_.reset(); |
| 2398 | 2399 |
| 2399 if (!renderWidgetHostView_->render_widget_host_) | 2400 if (!renderWidgetHostView_->render_widget_host_) |
| 2400 return; | 2401 return; |
| 2401 | 2402 |
| 2402 if (gestureBeginPinchSent_) { | 2403 if (gestureBeginPinchSent_) { |
| 2403 WebGestureEvent endEvent(WebGestureEventBuilder::Build(event, self)); | 2404 WebGestureEvent endEvent(WebInputEventFactory::gestureEvent(event, self)); |
| 2404 endEvent.type = WebInputEvent::GesturePinchEnd; | 2405 endEvent.type = WebInputEvent::GesturePinchEnd; |
| 2405 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(endEvent); | 2406 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(endEvent); |
| 2406 gestureBeginPinchSent_ = NO; | 2407 gestureBeginPinchSent_ = NO; |
| 2407 } | 2408 } |
| 2408 } | 2409 } |
| 2409 | 2410 |
| 2410 - (void)touchesMovedWithEvent:(NSEvent*)event { | 2411 - (void)touchesMovedWithEvent:(NSEvent*)event { |
| 2411 [responderDelegate_ touchesMovedWithEvent:event]; | 2412 [responderDelegate_ touchesMovedWithEvent:event]; |
| 2412 } | 2413 } |
| 2413 | 2414 |
| 2414 - (void)touchesBeganWithEvent:(NSEvent*)event { | 2415 - (void)touchesBeganWithEvent:(NSEvent*)event { |
| 2415 [responderDelegate_ touchesBeganWithEvent:event]; | 2416 [responderDelegate_ touchesBeganWithEvent:event]; |
| 2416 } | 2417 } |
| 2417 | 2418 |
| 2418 - (void)touchesCancelledWithEvent:(NSEvent*)event { | 2419 - (void)touchesCancelledWithEvent:(NSEvent*)event { |
| 2419 [responderDelegate_ touchesCancelledWithEvent:event]; | 2420 [responderDelegate_ touchesCancelledWithEvent:event]; |
| 2420 } | 2421 } |
| 2421 | 2422 |
| 2422 - (void)touchesEndedWithEvent:(NSEvent*)event { | 2423 - (void)touchesEndedWithEvent:(NSEvent*)event { |
| 2423 [responderDelegate_ touchesEndedWithEvent:event]; | 2424 [responderDelegate_ touchesEndedWithEvent:event]; |
| 2424 } | 2425 } |
| 2425 | 2426 |
| 2426 - (void)smartMagnifyWithEvent:(NSEvent*)event { | 2427 - (void)smartMagnifyWithEvent:(NSEvent*)event { |
| 2427 const WebGestureEvent& smartMagnifyEvent = | 2428 const WebGestureEvent& smartMagnifyEvent = |
| 2428 WebGestureEventBuilder::Build(event, self); | 2429 WebInputEventFactory::gestureEvent(event, self); |
| 2429 if (renderWidgetHostView_ && renderWidgetHostView_->render_widget_host_) { | 2430 if (renderWidgetHostView_ && renderWidgetHostView_->render_widget_host_) { |
| 2430 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent( | 2431 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent( |
| 2431 smartMagnifyEvent); | 2432 smartMagnifyEvent); |
| 2432 } | 2433 } |
| 2433 } | 2434 } |
| 2434 | 2435 |
| 2435 // This is invoked only on 10.8 or newer when the user taps a word using | 2436 // This is invoked only on 10.8 or newer when the user taps a word using |
| 2436 // three fingers. | 2437 // three fingers. |
| 2437 - (void)quickLookWithEvent:(NSEvent*)event { | 2438 - (void)quickLookWithEvent:(NSEvent*)event { |
| 2438 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; | 2439 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 handler:^(NSEvent* blockEvent) { | 2492 handler:^(NSEvent* blockEvent) { |
| 2492 [self shortCircuitScrollWheelEvent:blockEvent]; | 2493 [self shortCircuitScrollWheelEvent:blockEvent]; |
| 2493 return blockEvent; | 2494 return blockEvent; |
| 2494 }]; | 2495 }]; |
| 2495 } | 2496 } |
| 2496 | 2497 |
| 2497 // This is responsible for content scrolling! | 2498 // This is responsible for content scrolling! |
| 2498 if (renderWidgetHostView_->render_widget_host_) { | 2499 if (renderWidgetHostView_->render_widget_host_) { |
| 2499 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; | 2500 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; |
| 2500 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self]; | 2501 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self]; |
| 2501 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( | 2502 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( |
| 2502 event, self, canRubberbandLeft, canRubberbandRight); | 2503 event, self, canRubberbandLeft, canRubberbandRight); |
| 2503 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); | 2504 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); |
| 2504 if (renderWidgetHostView_->render_widget_host_->delegate() && | 2505 if (renderWidgetHostView_->render_widget_host_->delegate() && |
| 2505 renderWidgetHostView_->render_widget_host_->delegate() | 2506 renderWidgetHostView_->render_widget_host_->delegate() |
| 2506 ->GetInputEventRouter()) { | 2507 ->GetInputEventRouter()) { |
| 2507 renderWidgetHostView_->render_widget_host_->delegate() | 2508 renderWidgetHostView_->render_widget_host_->delegate() |
| 2508 ->GetInputEventRouter() | 2509 ->GetInputEventRouter() |
| 2509 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent); | 2510 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent); |
| 2510 } else { | 2511 } else { |
| 2511 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); | 2512 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2532 | 2533 |
| 2533 // Send a GesturePinchBegin event if none has been sent yet. | 2534 // Send a GesturePinchBegin event if none has been sent yet. |
| 2534 if (!gestureBeginPinchSent_) { | 2535 if (!gestureBeginPinchSent_) { |
| 2535 WebGestureEvent beginEvent(*gestureBeginEvent_); | 2536 WebGestureEvent beginEvent(*gestureBeginEvent_); |
| 2536 beginEvent.type = WebInputEvent::GesturePinchBegin; | 2537 beginEvent.type = WebInputEvent::GesturePinchBegin; |
| 2537 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(beginEvent); | 2538 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(beginEvent); |
| 2538 gestureBeginPinchSent_ = YES; | 2539 gestureBeginPinchSent_ = YES; |
| 2539 } | 2540 } |
| 2540 | 2541 |
| 2541 // Send a GesturePinchUpdate event. | 2542 // Send a GesturePinchUpdate event. |
| 2542 WebGestureEvent updateEvent = WebGestureEventBuilder::Build(event, self); | 2543 WebGestureEvent updateEvent = |
| 2544 WebInputEventFactory::gestureEvent(event, self); |
| 2543 updateEvent.data.pinchUpdate.zoomDisabled = !pinchHasReachedZoomThreshold_; | 2545 updateEvent.data.pinchUpdate.zoomDisabled = !pinchHasReachedZoomThreshold_; |
| 2544 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(updateEvent); | 2546 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(updateEvent); |
| 2545 } | 2547 } |
| 2546 | 2548 |
| 2547 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { | 2549 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
| 2548 NSWindow* oldWindow = [self window]; | 2550 NSWindow* oldWindow = [self window]; |
| 2549 | 2551 |
| 2550 NSNotificationCenter* notificationCenter = | 2552 NSNotificationCenter* notificationCenter = |
| 2551 [NSNotificationCenter defaultCenter]; | 2553 [NSNotificationCenter defaultCenter]; |
| 2552 | 2554 |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3407 | 3409 |
| 3408 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3410 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3409 // regions that are not draggable. (See ControlRegionView in | 3411 // regions that are not draggable. (See ControlRegionView in |
| 3410 // native_app_window_cocoa.mm). This requires the render host view to be | 3412 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3411 // draggable by default. | 3413 // draggable by default. |
| 3412 - (BOOL)mouseDownCanMoveWindow { | 3414 - (BOOL)mouseDownCanMoveWindow { |
| 3413 return YES; | 3415 return YES; |
| 3414 } | 3416 } |
| 3415 | 3417 |
| 3416 @end | 3418 @end |
| OLD | NEW |