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 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 BOOL handled = [responderDelegate_ handleEvent:theEvent]; | 1782 BOOL handled = [responderDelegate_ handleEvent:theEvent]; |
1783 if (handled) | 1783 if (handled) |
1784 return; | 1784 return; |
1785 } | 1785 } |
1786 | 1786 |
1787 if ([self shouldIgnoreMouseEvent:theEvent]) { | 1787 if ([self shouldIgnoreMouseEvent:theEvent]) { |
1788 // If this is the first such event, send a mouse exit to the host view. | 1788 // If this is the first such event, send a mouse exit to the host view. |
1789 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { | 1789 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { |
1790 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); | 1790 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); |
1791 exitEvent.type = WebInputEvent::MouseLeave; | 1791 exitEvent.type = WebInputEvent::MouseLeave; |
1792 exitEvent.button = WebMouseEvent::ButtonNone; | 1792 exitEvent.button = WebMouseEvent::Button::NoButton; |
1793 renderWidgetHostView_->ForwardMouseEvent(exitEvent); | 1793 renderWidgetHostView_->ForwardMouseEvent(exitEvent); |
1794 } | 1794 } |
1795 mouseEventWasIgnored_ = YES; | 1795 mouseEventWasIgnored_ = YES; |
1796 return; | 1796 return; |
1797 } | 1797 } |
1798 | 1798 |
1799 if (mouseEventWasIgnored_) { | 1799 if (mouseEventWasIgnored_) { |
1800 // If this is the first mouse event after a previous event that was ignored | 1800 // If this is the first mouse event after a previous event that was ignored |
1801 // due to the hitTest, send a mouse enter event to the host view. | 1801 // due to the hitTest, send a mouse enter event to the host view. |
1802 if (renderWidgetHostView_->render_widget_host_) { | 1802 if (renderWidgetHostView_->render_widget_host_) { |
1803 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); | 1803 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); |
1804 enterEvent.type = WebInputEvent::MouseMove; | 1804 enterEvent.type = WebInputEvent::MouseMove; |
1805 enterEvent.button = WebMouseEvent::ButtonNone; | 1805 enterEvent.button = WebMouseEvent::Button::NoButton; |
1806 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { | 1806 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { |
1807 renderWidgetHostView_->render_widget_host_->delegate() | 1807 renderWidgetHostView_->render_widget_host_->delegate() |
1808 ->GetInputEventRouter() | 1808 ->GetInputEventRouter() |
1809 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); | 1809 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); |
1810 } else { | 1810 } else { |
1811 ui::LatencyInfo latency_info; | 1811 ui::LatencyInfo latency_info; |
1812 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, | 1812 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, |
1813 0, 0); | 1813 0, 0); |
1814 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); | 1814 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); |
1815 } | 1815 } |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3060 if ([self window]) | 3060 if ([self window]) |
3061 [self updateScreenProperties]; | 3061 [self updateScreenProperties]; |
3062 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( | 3062 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( |
3063 [self window]); | 3063 [self window]); |
3064 | 3064 |
3065 // If we switch windows (or are removed from the view hierarchy), cancel any | 3065 // If we switch windows (or are removed from the view hierarchy), cancel any |
3066 // open mouse-downs. | 3066 // open mouse-downs. |
3067 if (hasOpenMouseDown_) { | 3067 if (hasOpenMouseDown_) { |
3068 WebMouseEvent event; | 3068 WebMouseEvent event; |
3069 event.type = WebInputEvent::MouseUp; | 3069 event.type = WebInputEvent::MouseUp; |
3070 event.button = WebMouseEvent::ButtonLeft; | 3070 event.button = WebMouseEvent::Button::Left; |
3071 renderWidgetHostView_->ForwardMouseEvent(event); | 3071 renderWidgetHostView_->ForwardMouseEvent(event); |
3072 | 3072 |
3073 hasOpenMouseDown_ = NO; | 3073 hasOpenMouseDown_ = NO; |
3074 } | 3074 } |
3075 } | 3075 } |
3076 | 3076 |
3077 - (void)viewDidChangeBackingProperties { | 3077 - (void)viewDidChangeBackingProperties { |
3078 NSScreen* screen = [[self window] screen]; | 3078 NSScreen* screen = [[self window] screen]; |
3079 if (screen) { | 3079 if (screen) { |
3080 gfx::ICCProfile icc_profile = | 3080 gfx::ICCProfile icc_profile = |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 | 3255 |
3256 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3256 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3257 // regions that are not draggable. (See ControlRegionView in | 3257 // regions that are not draggable. (See ControlRegionView in |
3258 // native_app_window_cocoa.mm). This requires the render host view to be | 3258 // native_app_window_cocoa.mm). This requires the render host view to be |
3259 // draggable by default. | 3259 // draggable by default. |
3260 - (BOOL)mouseDownCanMoveWindow { | 3260 - (BOOL)mouseDownCanMoveWindow { |
3261 return YES; | 3261 return YES; |
3262 } | 3262 } |
3263 | 3263 |
3264 @end | 3264 @end |
OLD | NEW |