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

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

Issue 2317253005: SourceEventType added to LatencyInfo (Closed)
Patch Set: Changed the patch to only contain source event type plumbing. Created 4 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 #include <stdint.h> 10 #include <stdint.h>
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 return; 1799 return;
1800 } 1800 }
1801 1801
1802 if (mouseEventWasIgnored_) { 1802 if (mouseEventWasIgnored_) {
1803 // If this is the first mouse event after a previous event that was ignored 1803 // If this is the first mouse event after a previous event that was ignored
1804 // due to the hitTest, send a mouse enter event to the host view. 1804 // due to the hitTest, send a mouse enter event to the host view.
1805 if (renderWidgetHostView_->render_widget_host_) { 1805 if (renderWidgetHostView_->render_widget_host_) {
1806 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); 1806 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self);
1807 enterEvent.type = WebInputEvent::MouseMove; 1807 enterEvent.type = WebInputEvent::MouseMove;
1808 enterEvent.button = WebMouseEvent::Button::NoButton; 1808 enterEvent.button = WebMouseEvent::Button::NoButton;
1809 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1810 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1809 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { 1811 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) {
1810 renderWidgetHostView_->render_widget_host_->delegate() 1812 renderWidgetHostView_->render_widget_host_->delegate()
1811 ->GetInputEventRouter() 1813 ->GetInputEventRouter()
1812 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); 1814 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent,
1815 latency_info);
1813 } else { 1816 } else {
1814 ui::LatencyInfo latency_info;
1815 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
1816 0, 0);
1817 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); 1817 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info);
1818 } 1818 }
1819 } 1819 }
1820 } 1820 }
1821 mouseEventWasIgnored_ = NO; 1821 mouseEventWasIgnored_ = NO;
1822 1822
1823 // Don't cancel child popups; killing them on a mouse click would prevent the 1823 // Don't cancel child popups; killing them on a mouse click would prevent the
1824 // user from positioning the insertion point in the text field spawning the 1824 // user from positioning the insertion point in the text field spawning the
1825 // popup. A click outside the text field would cause the text field to drop 1825 // popup. A click outside the text field would cause the text field to drop
1826 // the focus, and then EditorClientImpl::textFieldDidEndEditing() would cancel 1826 // the focus, and then EditorClientImpl::textFieldDidEndEditing() would cancel
(...skipping 10 matching lines...) Expand all
1837 // - (NSUInteger)characterIndexForPoint:. 1837 // - (NSUInteger)characterIndexForPoint:.
1838 // See: http://code.google.com/p/chromium/issues/detail?id=47141 1838 // See: http://code.google.com/p/chromium/issues/detail?id=47141
1839 // Instead of sending mouse events to the input method first, we now just 1839 // Instead of sending mouse events to the input method first, we now just
1840 // simply confirm all ongoing composition here. 1840 // simply confirm all ongoing composition here.
1841 if (type == NSLeftMouseDown || type == NSRightMouseDown || 1841 if (type == NSLeftMouseDown || type == NSRightMouseDown ||
1842 type == NSOtherMouseDown) { 1842 type == NSOtherMouseDown) {
1843 [self confirmComposition]; 1843 [self confirmComposition];
1844 } 1844 }
1845 1845
1846 WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self); 1846 WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self);
1847 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1848 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1847 if (renderWidgetHostView_->ShouldRouteEvent(event)) { 1849 if (renderWidgetHostView_->ShouldRouteEvent(event)) {
1848 renderWidgetHostView_->render_widget_host_->delegate() 1850 renderWidgetHostView_->render_widget_host_->delegate()
1849 ->GetInputEventRouter() 1851 ->GetInputEventRouter()
1850 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); 1852 ->RouteMouseEvent(renderWidgetHostView_.get(), &event, latency_info);
1851 } else { 1853 } else {
1852 ui::LatencyInfo latency_info;
1853 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1854 renderWidgetHostView_->ProcessMouseEvent(event, latency_info); 1854 renderWidgetHostView_->ProcessMouseEvent(event, latency_info);
1855 } 1855 }
1856 } 1856 }
1857 1857
1858 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { 1858 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent {
1859 // |performKeyEquivalent:| is sent to all views of a window, not only down the 1859 // |performKeyEquivalent:| is sent to all views of a window, not only down the
1860 // responder chain (cf. "Handling Key Equivalents" in 1860 // responder chain (cf. "Handling Key Equivalents" in
1861 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event Overview/HandlingKeyEvents/HandlingKeyEvents.html 1861 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event Overview/HandlingKeyEvents/HandlingKeyEvents.html
1862 // ). We only want to handle key equivalents if we're first responder. 1862 // ). We only want to handle key equivalents if we're first responder.
1863 if ([[self window] firstResponder] != self) 1863 if ([[self window] firstResponder] != self)
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 if ([event phase] != NSEventPhaseEnded && 2176 if ([event phase] != NSEventPhaseEnded &&
2177 [event phase] != NSEventPhaseCancelled) { 2177 [event phase] != NSEventPhaseCancelled) {
2178 return; 2178 return;
2179 } 2179 }
2180 2180
2181 if (renderWidgetHostView_->render_widget_host_) { 2181 if (renderWidgetHostView_->render_widget_host_) {
2182 // History-swiping is not possible if the logic reaches this point. 2182 // History-swiping is not possible if the logic reaches this point.
2183 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( 2183 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2184 event, self); 2184 event, self);
2185 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2185 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2186 ui::LatencyInfo latency_info; 2186 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2187 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2187 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
2188 renderWidgetHostView_->render_widget_host_-> 2188 renderWidgetHostView_->render_widget_host_->
2189 ForwardWheelEventWithLatencyInfo(webEvent, latency_info); 2189 ForwardWheelEventWithLatencyInfo(webEvent, latency_info);
2190 } 2190 }
2191 2191
2192 if (endWheelMonitor_) { 2192 if (endWheelMonitor_) {
2193 [NSEvent removeMonitor:endWheelMonitor_]; 2193 [NSEvent removeMonitor:endWheelMonitor_];
2194 endWheelMonitor_ = nil; 2194 endWheelMonitor_ = nil;
2195 } 2195 }
2196 } 2196 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 handler:^(NSEvent* blockEvent) { 2347 handler:^(NSEvent* blockEvent) {
2348 [self shortCircuitScrollWheelEvent:blockEvent]; 2348 [self shortCircuitScrollWheelEvent:blockEvent];
2349 return blockEvent; 2349 return blockEvent;
2350 }]; 2350 }];
2351 } 2351 }
2352 2352
2353 // This is responsible for content scrolling! 2353 // This is responsible for content scrolling!
2354 if (renderWidgetHostView_->render_widget_host_) { 2354 if (renderWidgetHostView_->render_widget_host_) {
2355 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self); 2355 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self);
2356 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2356 webEvent.railsMode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2357 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2358 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
2357 if (renderWidgetHostView_->ShouldRouteEvent(webEvent)) { 2359 if (renderWidgetHostView_->ShouldRouteEvent(webEvent)) {
2358 renderWidgetHostView_->render_widget_host_->delegate() 2360 renderWidgetHostView_->render_widget_host_->delegate()
2359 ->GetInputEventRouter() 2361 ->GetInputEventRouter()
2360 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent); 2362 ->RouteMouseWheelEvent(renderWidgetHostView_.get(), &webEvent,
2363 latency_info);
2361 } else { 2364 } else {
2362 ui::LatencyInfo latency_info;
2363 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
2364 renderWidgetHostView_->ProcessMouseWheelEvent(webEvent, latency_info); 2365 renderWidgetHostView_->ProcessMouseWheelEvent(webEvent, latency_info);
2365 } 2366 }
2366 } 2367 }
2367 } 2368 }
2368 2369
2369 // Called repeatedly during a pinch gesture, with incremental change values. 2370 // Called repeatedly during a pinch gesture, with incremental change values.
2370 - (void)magnifyWithEvent:(NSEvent*)event { 2371 - (void)magnifyWithEvent:(NSEvent*)event {
2371 if (!renderWidgetHostView_->render_widget_host_) 2372 if (!renderWidgetHostView_->render_widget_host_)
2372 return; 2373 return;
2373 2374
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 3266
3266 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3267 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3267 // regions that are not draggable. (See ControlRegionView in 3268 // regions that are not draggable. (See ControlRegionView in
3268 // native_app_window_cocoa.mm). This requires the render host view to be 3269 // native_app_window_cocoa.mm). This requires the render host view to be
3269 // draggable by default. 3270 // draggable by default.
3270 - (BOOL)mouseDownCanMoveWindow { 3271 - (BOOL)mouseDownCanMoveWindow {
3271 return YES; 3272 return YES;
3272 } 3273 }
3273 3274
3274 @end 3275 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698