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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1331013004: [KeyEvent Mac] Move WebInputEventFactory into chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix forward declaration so it is only OBJC Created 5 years, 3 months 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
OLDNEW
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
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
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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 NSPoint location = [window mouseLocationOutsideOfEventStream]; 1282 NSPoint location = [window mouseLocationOutsideOfEventStream];
1281 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved 1283 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
1282 location:location 1284 location:location
1283 modifierFlags:0 1285 modifierFlags:0
1284 timestamp:0 1286 timestamp:0
1285 windowNumber:window_number() 1287 windowNumber:window_number()
1286 context:nil 1288 context:nil
1287 eventNumber:0 1289 eventNumber:0
1288 clickCount:0 1290 clickCount:0
1289 pressure:0]; 1291 pressure:0];
1290 WebMouseEvent web_event = 1292 WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_);
1291 WebInputEventFactory::mouseEvent(event, cocoa_view_);
1292 if (showing) 1293 if (showing)
1293 web_event.type = WebInputEvent::MouseLeave; 1294 web_event.type = WebInputEvent::MouseLeave;
1294 ForwardMouseEvent(web_event); 1295 ForwardMouseEvent(web_event);
1295 } 1296 }
1296 1297
1297 bool RenderWidgetHostViewMac::IsPopup() const { 1298 bool RenderWidgetHostViewMac::IsPopup() const {
1298 return popup_type_ != blink::WebPopupTypeNone; 1299 return popup_type_ != blink::WebPopupTypeNone;
1299 } 1300 }
1300 1301
1301 void RenderWidgetHostViewMac::CopyFromCompositingSurface( 1302 void RenderWidgetHostViewMac::CopyFromCompositingSurface(
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 if (responderDelegate_ && 1971 if (responderDelegate_ &&
1971 [responderDelegate_ respondsToSelector:@selector(handleEvent:)]) { 1972 [responderDelegate_ respondsToSelector:@selector(handleEvent:)]) {
1972 BOOL handled = [responderDelegate_ handleEvent:theEvent]; 1973 BOOL handled = [responderDelegate_ handleEvent:theEvent];
1973 if (handled) 1974 if (handled)
1974 return; 1975 return;
1975 } 1976 }
1976 1977
1977 if ([self shouldIgnoreMouseEvent:theEvent]) { 1978 if ([self shouldIgnoreMouseEvent:theEvent]) {
1978 // If this is the first such event, send a mouse exit to the host view. 1979 // If this is the first such event, send a mouse exit to the host view.
1979 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { 1980 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) {
1980 WebMouseEvent exitEvent = 1981 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self);
1981 WebInputEventFactory::mouseEvent(theEvent, self);
1982 exitEvent.type = WebInputEvent::MouseLeave; 1982 exitEvent.type = WebInputEvent::MouseLeave;
1983 exitEvent.button = WebMouseEvent::ButtonNone; 1983 exitEvent.button = WebMouseEvent::ButtonNone;
1984 renderWidgetHostView_->ForwardMouseEvent(exitEvent); 1984 renderWidgetHostView_->ForwardMouseEvent(exitEvent);
1985 } 1985 }
1986 mouseEventWasIgnored_ = YES; 1986 mouseEventWasIgnored_ = YES;
1987 return; 1987 return;
1988 } 1988 }
1989 1989
1990 if (mouseEventWasIgnored_) { 1990 if (mouseEventWasIgnored_) {
1991 // If this is the first mouse event after a previous event that was ignored 1991 // If this is the first mouse event after a previous event that was ignored
1992 // due to the hitTest, send a mouse enter event to the host view. 1992 // due to the hitTest, send a mouse enter event to the host view.
1993 if (renderWidgetHostView_->render_widget_host_) { 1993 if (renderWidgetHostView_->render_widget_host_) {
1994 WebMouseEvent enterEvent = 1994 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self);
1995 WebInputEventFactory::mouseEvent(theEvent, self);
1996 enterEvent.type = WebInputEvent::MouseMove; 1995 enterEvent.type = WebInputEvent::MouseMove;
1997 enterEvent.button = WebMouseEvent::ButtonNone; 1996 enterEvent.button = WebMouseEvent::ButtonNone;
1998 if (renderWidgetHostView_->render_widget_host_->delegate() && 1997 if (renderWidgetHostView_->render_widget_host_->delegate() &&
1999 renderWidgetHostView_->render_widget_host_->delegate() 1998 renderWidgetHostView_->render_widget_host_->delegate()
2000 ->GetInputEventRouter()) { 1999 ->GetInputEventRouter()) {
2001 renderWidgetHostView_->render_widget_host_->delegate() 2000 renderWidgetHostView_->render_widget_host_->delegate()
2002 ->GetInputEventRouter() 2001 ->GetInputEventRouter()
2003 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); 2002 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent);
2004 } else { 2003 } else {
2005 renderWidgetHostView_->ForwardMouseEvent(enterEvent); 2004 renderWidgetHostView_->ForwardMouseEvent(enterEvent);
(...skipping 18 matching lines...) Expand all
2024 // wants to handle them. But it won't work without implementing method 2023 // wants to handle them. But it won't work without implementing method
2025 // - (NSUInteger)characterIndexForPoint:. 2024 // - (NSUInteger)characterIndexForPoint:.
2026 // See: http://code.google.com/p/chromium/issues/detail?id=47141 2025 // See: http://code.google.com/p/chromium/issues/detail?id=47141
2027 // Instead of sending mouse events to the input method first, we now just 2026 // Instead of sending mouse events to the input method first, we now just
2028 // simply confirm all ongoing composition here. 2027 // simply confirm all ongoing composition here.
2029 if (type == NSLeftMouseDown || type == NSRightMouseDown || 2028 if (type == NSLeftMouseDown || type == NSRightMouseDown ||
2030 type == NSOtherMouseDown) { 2029 type == NSOtherMouseDown) {
2031 [self confirmComposition]; 2030 [self confirmComposition];
2032 } 2031 }
2033 2032
2034 WebMouseEvent event = WebInputEventFactory::mouseEvent(theEvent, self); 2033 WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self);
2035 if (renderWidgetHostView_->render_widget_host_->delegate() && 2034 if (renderWidgetHostView_->render_widget_host_->delegate() &&
2036 renderWidgetHostView_->render_widget_host_->delegate() 2035 renderWidgetHostView_->render_widget_host_->delegate()
2037 ->GetInputEventRouter()) { 2036 ->GetInputEventRouter()) {
2038 renderWidgetHostView_->render_widget_host_->delegate() 2037 renderWidgetHostView_->render_widget_host_->delegate()
2039 ->GetInputEventRouter() 2038 ->GetInputEventRouter()
2040 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); 2039 ->RouteMouseEvent(renderWidgetHostView_.get(), &event);
2041 } else { 2040 } else {
2042 renderWidgetHostView_->ForwardMouseEvent(event); 2041 renderWidgetHostView_->ForwardMouseEvent(event);
2043 } 2042 }
2044 } 2043 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 if ([event phase] != NSEventPhaseEnded && 2356 if ([event phase] != NSEventPhaseEnded &&
2358 [event phase] != NSEventPhaseCancelled) { 2357 [event phase] != NSEventPhaseCancelled) {
2359 return; 2358 return;
2360 } 2359 }
2361 2360
2362 if (renderWidgetHostView_->render_widget_host_) { 2361 if (renderWidgetHostView_->render_widget_host_) {
2363 // History-swiping is not possible if the logic reaches this point. 2362 // History-swiping is not possible if the logic reaches this point.
2364 // Allow rubber-banding in both directions. 2363 // Allow rubber-banding in both directions.
2365 bool canRubberbandLeft = true; 2364 bool canRubberbandLeft = true;
2366 bool canRubberbandRight = true; 2365 bool canRubberbandRight = true;
2367 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( 2366 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2368 event, self, canRubberbandLeft, canRubberbandRight); 2367 event, self, canRubberbandLeft, canRubberbandRight);
2369 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2368 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2370 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); 2369 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent);
2371 } 2370 }
2372 2371
2373 if (endWheelMonitor_) { 2372 if (endWheelMonitor_) {
2374 [NSEvent removeMonitor:endWheelMonitor_]; 2373 [NSEvent removeMonitor:endWheelMonitor_];
2375 endWheelMonitor_ = nil; 2374 endWheelMonitor_ = nil;
2376 } 2375 }
2377 } 2376 }
2378 2377
2379 - (void)beginGestureWithEvent:(NSEvent*)event { 2378 - (void)beginGestureWithEvent:(NSEvent*)event {
2380 [responderDelegate_ beginGestureWithEvent:event]; 2379 [responderDelegate_ beginGestureWithEvent:event];
2381 gestureBeginEvent_.reset( 2380 gestureBeginEvent_.reset(
2382 new WebGestureEvent(WebInputEventFactory::gestureEvent(event, self))); 2381 new WebGestureEvent(WebGestureEventBuilder::Build(event, self)));
2383 2382
2384 // If the page is at the minimum zoom level, require a threshold be reached 2383 // If the page is at the minimum zoom level, require a threshold be reached
2385 // before the pinch has an effect. 2384 // before the pinch has an effect.
2386 if (renderWidgetHostView_->page_at_minimum_scale_) { 2385 if (renderWidgetHostView_->page_at_minimum_scale_) {
2387 pinchHasReachedZoomThreshold_ = false; 2386 pinchHasReachedZoomThreshold_ = false;
2388 pinchUnusedAmount_ = 1; 2387 pinchUnusedAmount_ = 1;
2389 } 2388 }
2390 } 2389 }
2391 2390
2392 - (void)endGestureWithEvent:(NSEvent*)event { 2391 - (void)endGestureWithEvent:(NSEvent*)event {
2393 [responderDelegate_ endGestureWithEvent:event]; 2392 [responderDelegate_ endGestureWithEvent:event];
2394 gestureBeginEvent_.reset(); 2393 gestureBeginEvent_.reset();
2395 2394
2396 if (!renderWidgetHostView_->render_widget_host_) 2395 if (!renderWidgetHostView_->render_widget_host_)
2397 return; 2396 return;
2398 2397
2399 if (gestureBeginPinchSent_) { 2398 if (gestureBeginPinchSent_) {
2400 WebGestureEvent endEvent(WebInputEventFactory::gestureEvent(event, self)); 2399 WebGestureEvent endEvent(WebGestureEventBuilder::Build(event, self));
2401 endEvent.type = WebInputEvent::GesturePinchEnd; 2400 endEvent.type = WebInputEvent::GesturePinchEnd;
2402 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(endEvent); 2401 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(endEvent);
2403 gestureBeginPinchSent_ = NO; 2402 gestureBeginPinchSent_ = NO;
2404 } 2403 }
2405 } 2404 }
2406 2405
2407 - (void)touchesMovedWithEvent:(NSEvent*)event { 2406 - (void)touchesMovedWithEvent:(NSEvent*)event {
2408 [responderDelegate_ touchesMovedWithEvent:event]; 2407 [responderDelegate_ touchesMovedWithEvent:event];
2409 } 2408 }
2410 2409
2411 - (void)touchesBeganWithEvent:(NSEvent*)event { 2410 - (void)touchesBeganWithEvent:(NSEvent*)event {
2412 [responderDelegate_ touchesBeganWithEvent:event]; 2411 [responderDelegate_ touchesBeganWithEvent:event];
2413 } 2412 }
2414 2413
2415 - (void)touchesCancelledWithEvent:(NSEvent*)event { 2414 - (void)touchesCancelledWithEvent:(NSEvent*)event {
2416 [responderDelegate_ touchesCancelledWithEvent:event]; 2415 [responderDelegate_ touchesCancelledWithEvent:event];
2417 } 2416 }
2418 2417
2419 - (void)touchesEndedWithEvent:(NSEvent*)event { 2418 - (void)touchesEndedWithEvent:(NSEvent*)event {
2420 [responderDelegate_ touchesEndedWithEvent:event]; 2419 [responderDelegate_ touchesEndedWithEvent:event];
2421 } 2420 }
2422 2421
2423 - (void)smartMagnifyWithEvent:(NSEvent*)event { 2422 - (void)smartMagnifyWithEvent:(NSEvent*)event {
2424 const WebGestureEvent& smartMagnifyEvent = 2423 const WebGestureEvent& smartMagnifyEvent =
2425 WebInputEventFactory::gestureEvent(event, self); 2424 WebGestureEventBuilder::Build(event, self);
2426 if (renderWidgetHostView_ && renderWidgetHostView_->render_widget_host_) { 2425 if (renderWidgetHostView_ && renderWidgetHostView_->render_widget_host_) {
2427 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent( 2426 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(
2428 smartMagnifyEvent); 2427 smartMagnifyEvent);
2429 } 2428 }
2430 } 2429 }
2431 2430
2432 // This is invoked only on 10.8 or newer when the user taps a word using 2431 // This is invoked only on 10.8 or newer when the user taps a word using
2433 // three fingers. 2432 // three fingers.
2434 - (void)quickLookWithEvent:(NSEvent*)event { 2433 - (void)quickLookWithEvent:(NSEvent*)event {
2435 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; 2434 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 handler:^(NSEvent* blockEvent) { 2487 handler:^(NSEvent* blockEvent) {
2489 [self shortCircuitScrollWheelEvent:blockEvent]; 2488 [self shortCircuitScrollWheelEvent:blockEvent];
2490 return blockEvent; 2489 return blockEvent;
2491 }]; 2490 }];
2492 } 2491 }
2493 2492
2494 // This is responsible for content scrolling! 2493 // This is responsible for content scrolling!
2495 if (renderWidgetHostView_->render_widget_host_) { 2494 if (renderWidgetHostView_->render_widget_host_) {
2496 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; 2495 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self];
2497 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self]; 2496 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self];
2498 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( 2497 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2499 event, self, canRubberbandLeft, canRubberbandRight); 2498 event, self, canRubberbandLeft, canRubberbandRight);
2500 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2499 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2501 if (renderWidgetHostView_->render_widget_host_->delegate() && 2500 if (renderWidgetHostView_->render_widget_host_->delegate() &&
2502 renderWidgetHostView_->render_widget_host_->delegate() 2501 renderWidgetHostView_->render_widget_host_->delegate()
2503 ->GetInputEventRouter()) { 2502 ->GetInputEventRouter()) {
2504 renderWidgetHostView_->render_widget_host_->delegate() 2503 renderWidgetHostView_->render_widget_host_->delegate()
2505 ->GetInputEventRouter() 2504 ->GetInputEventRouter()
2506 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent); 2505 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent);
2507 } else { 2506 } else {
2508 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); 2507 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent);
(...skipping 20 matching lines...) Expand all
2529 2528
2530 // Send a GesturePinchBegin event if none has been sent yet. 2529 // Send a GesturePinchBegin event if none has been sent yet.
2531 if (!gestureBeginPinchSent_) { 2530 if (!gestureBeginPinchSent_) {
2532 WebGestureEvent beginEvent(*gestureBeginEvent_); 2531 WebGestureEvent beginEvent(*gestureBeginEvent_);
2533 beginEvent.type = WebInputEvent::GesturePinchBegin; 2532 beginEvent.type = WebInputEvent::GesturePinchBegin;
2534 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(beginEvent); 2533 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(beginEvent);
2535 gestureBeginPinchSent_ = YES; 2534 gestureBeginPinchSent_ = YES;
2536 } 2535 }
2537 2536
2538 // Send a GesturePinchUpdate event. 2537 // Send a GesturePinchUpdate event.
2539 WebGestureEvent updateEvent = 2538 WebGestureEvent updateEvent = WebGestureEventBuilder::Build(event, self);
2540 WebInputEventFactory::gestureEvent(event, self);
2541 updateEvent.data.pinchUpdate.zoomDisabled = !pinchHasReachedZoomThreshold_; 2539 updateEvent.data.pinchUpdate.zoomDisabled = !pinchHasReachedZoomThreshold_;
2542 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(updateEvent); 2540 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(updateEvent);
2543 } 2541 }
2544 2542
2545 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { 2543 - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
2546 NSWindow* oldWindow = [self window]; 2544 NSWindow* oldWindow = [self window];
2547 2545
2548 NSNotificationCenter* notificationCenter = 2546 NSNotificationCenter* notificationCenter =
2549 [NSNotificationCenter defaultCenter]; 2547 [NSNotificationCenter defaultCenter];
2550 2548
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 3403
3406 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3404 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3407 // regions that are not draggable. (See ControlRegionView in 3405 // regions that are not draggable. (See ControlRegionView in
3408 // native_app_window_cocoa.mm). This requires the render host view to be 3406 // native_app_window_cocoa.mm). This requires the render host view to be
3409 // draggable by default. 3407 // draggable by default.
3410 - (BOOL)mouseDownCanMoveWindow { 3408 - (BOOL)mouseDownCanMoveWindow {
3411 return YES; 3409 return YES;
3412 } 3410 }
3413 3411
3414 @end 3412 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698