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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 if ([event phase] != NSEventPhaseEnded && | 2248 if ([event phase] != NSEventPhaseEnded && |
2249 [event phase] != NSEventPhaseCancelled) { | 2249 [event phase] != NSEventPhaseCancelled) { |
2250 return; | 2250 return; |
2251 } | 2251 } |
2252 | 2252 |
2253 if (renderWidgetHostView_->render_widget_host_) { | 2253 if (renderWidgetHostView_->render_widget_host_) { |
2254 // History-swiping is not possible if the logic reaches this point. | 2254 // History-swiping is not possible if the logic reaches this point. |
2255 // Allow rubber-banding in both directions. | 2255 // Allow rubber-banding in both directions. |
2256 bool canRubberbandLeft = true; | 2256 bool canRubberbandLeft = true; |
2257 bool canRubberbandRight = true; | 2257 bool canRubberbandRight = true; |
2258 const WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( | 2258 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( |
2259 event, self, canRubberbandLeft, canRubberbandRight); | 2259 event, self, canRubberbandLeft, canRubberbandRight); |
| 2260 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); |
2260 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); | 2261 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); |
2261 } | 2262 } |
2262 | 2263 |
2263 if (endWheelMonitor_) { | 2264 if (endWheelMonitor_) { |
2264 [NSEvent removeMonitor:endWheelMonitor_]; | 2265 [NSEvent removeMonitor:endWheelMonitor_]; |
2265 endWheelMonitor_ = nil; | 2266 endWheelMonitor_ = nil; |
2266 } | 2267 } |
2267 } | 2268 } |
2268 | 2269 |
2269 - (void)beginGestureWithEvent:(NSEvent*)event { | 2270 - (void)beginGestureWithEvent:(NSEvent*)event { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 handler:^(NSEvent* blockEvent) { | 2372 handler:^(NSEvent* blockEvent) { |
2372 [self shortCircuitScrollWheelEvent:blockEvent]; | 2373 [self shortCircuitScrollWheelEvent:blockEvent]; |
2373 return blockEvent; | 2374 return blockEvent; |
2374 }]; | 2375 }]; |
2375 } | 2376 } |
2376 | 2377 |
2377 // This is responsible for content scrolling! | 2378 // This is responsible for content scrolling! |
2378 if (renderWidgetHostView_->render_widget_host_) { | 2379 if (renderWidgetHostView_->render_widget_host_) { |
2379 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; | 2380 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; |
2380 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self]; | 2381 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self]; |
2381 const WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( | 2382 WebMouseWheelEvent webEvent = WebInputEventFactory::mouseWheelEvent( |
2382 event, self, canRubberbandLeft, canRubberbandRight); | 2383 event, self, canRubberbandLeft, canRubberbandRight); |
| 2384 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); |
2383 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); | 2385 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); |
2384 } | 2386 } |
2385 } | 2387 } |
2386 | 2388 |
2387 // Called repeatedly during a pinch gesture, with incremental change values. | 2389 // Called repeatedly during a pinch gesture, with incremental change values. |
2388 - (void)magnifyWithEvent:(NSEvent*)event { | 2390 - (void)magnifyWithEvent:(NSEvent*)event { |
2389 if (!renderWidgetHostView_->render_widget_host_) | 2391 if (!renderWidgetHostView_->render_widget_host_) |
2390 return; | 2392 return; |
2391 | 2393 |
2392 // If, due to nesting of multiple gestures (e.g, from multiple touch | 2394 // If, due to nesting of multiple gestures (e.g, from multiple touch |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3450 | 3452 |
3451 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3453 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3452 // regions that are not draggable. (See ControlRegionView in | 3454 // regions that are not draggable. (See ControlRegionView in |
3453 // native_app_window_cocoa.mm). This requires the render host view to be | 3455 // native_app_window_cocoa.mm). This requires the render host view to be |
3454 // draggable by default. | 3456 // draggable by default. |
3455 - (BOOL)mouseDownCanMoveWindow { | 3457 - (BOOL)mouseDownCanMoveWindow { |
3456 return YES; | 3458 return YES; |
3457 } | 3459 } |
3458 | 3460 |
3459 @end | 3461 @end |
OLD | NEW |