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