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

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

Issue 2227803003: Plumb phase/momentum for WheelEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Non-Mac compile. Created 4 years, 4 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 #include <stdint.h> 10 #include <stdint.h>
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 } 2168 }
2169 2169
2170 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event { 2170 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event {
2171 if ([event phase] != NSEventPhaseEnded && 2171 if ([event phase] != NSEventPhaseEnded &&
2172 [event phase] != NSEventPhaseCancelled) { 2172 [event phase] != NSEventPhaseCancelled) {
2173 return; 2173 return;
2174 } 2174 }
2175 2175
2176 if (renderWidgetHostView_->render_widget_host_) { 2176 if (renderWidgetHostView_->render_widget_host_) {
2177 // History-swiping is not possible if the logic reaches this point. 2177 // History-swiping is not possible if the logic reaches this point.
2178 // Allow rubber-banding in both directions.
2179 bool canRubberbandLeft = true;
2180 bool canRubberbandRight = true;
2181 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( 2178 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2182 event, self, canRubberbandLeft, canRubberbandRight); 2179 event, self);
2183 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2180 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2184 ui::LatencyInfo latency_info; 2181 ui::LatencyInfo latency_info;
2185 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2182 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
2186 renderWidgetHostView_->render_widget_host_-> 2183 renderWidgetHostView_->render_widget_host_->
2187 ForwardWheelEventWithLatencyInfo(webEvent, latency_info); 2184 ForwardWheelEventWithLatencyInfo(webEvent, latency_info);
2188 } 2185 }
2189 2186
2190 if (endWheelMonitor_) { 2187 if (endWheelMonitor_) {
2191 [NSEvent removeMonitor:endWheelMonitor_]; 2188 [NSEvent removeMonitor:endWheelMonitor_];
2192 endWheelMonitor_ = nil; 2189 endWheelMonitor_ = nil;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 endWheelMonitor_ = 2340 endWheelMonitor_ =
2344 [NSEvent addLocalMonitorForEventsMatchingMask:NSScrollWheelMask 2341 [NSEvent addLocalMonitorForEventsMatchingMask:NSScrollWheelMask
2345 handler:^(NSEvent* blockEvent) { 2342 handler:^(NSEvent* blockEvent) {
2346 [self shortCircuitScrollWheelEvent:blockEvent]; 2343 [self shortCircuitScrollWheelEvent:blockEvent];
2347 return blockEvent; 2344 return blockEvent;
2348 }]; 2345 }];
2349 } 2346 }
2350 2347
2351 // This is responsible for content scrolling! 2348 // This is responsible for content scrolling!
2352 if (renderWidgetHostView_->render_widget_host_) { 2349 if (renderWidgetHostView_->render_widget_host_) {
2353 BOOL canRubberbandLeft = [responderDelegate_ canRubberbandLeft:self]; 2350 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self);
2354 BOOL canRubberbandRight = [responderDelegate_ canRubberbandRight:self];
2355 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2356 event, self, canRubberbandLeft, canRubberbandRight);
2357 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2351 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2358 if (renderWidgetHostView_->ShouldRouteEvent(webEvent)) { 2352 if (renderWidgetHostView_->ShouldRouteEvent(webEvent)) {
2359 renderWidgetHostView_->render_widget_host_->delegate() 2353 renderWidgetHostView_->render_widget_host_->delegate()
2360 ->GetInputEventRouter() 2354 ->GetInputEventRouter()
2361 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent); 2355 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent);
2362 } else { 2356 } else {
2363 ui::LatencyInfo latency_info; 2357 ui::LatencyInfo latency_info;
2364 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2358 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
2365 renderWidgetHostView_->ProcessMouseWheelEvent(webEvent, latency_info); 2359 renderWidgetHostView_->ProcessMouseWheelEvent(webEvent, latency_info);
2366 } 2360 }
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 3253
3260 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3254 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3261 // regions that are not draggable. (See ControlRegionView in 3255 // regions that are not draggable. (See ControlRegionView in
3262 // native_app_window_cocoa.mm). This requires the render host view to be 3256 // native_app_window_cocoa.mm). This requires the render host view to be
3263 // draggable by default. 3257 // draggable by default.
3264 - (BOOL)mouseDownCanMoveWindow { 3258 - (BOOL)mouseDownCanMoveWindow {
3265 return YES; 3259 return YES;
3266 } 3260 }
3267 3261
3268 @end 3262 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698