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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 BOOL handled = [responderDelegate_ handleEvent:theEvent]; | 1766 BOOL handled = [responderDelegate_ handleEvent:theEvent]; |
1767 if (handled) | 1767 if (handled) |
1768 return; | 1768 return; |
1769 } | 1769 } |
1770 | 1770 |
1771 if ([self shouldIgnoreMouseEvent:theEvent]) { | 1771 if ([self shouldIgnoreMouseEvent:theEvent]) { |
1772 // If this is the first such event, send a mouse exit to the host view. | 1772 // If this is the first such event, send a mouse exit to the host view. |
1773 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { | 1773 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { |
1774 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); | 1774 WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); |
1775 exitEvent.type = WebInputEvent::MouseLeave; | 1775 exitEvent.type = WebInputEvent::MouseLeave; |
1776 exitEvent.button = WebMouseEvent::ButtonNone; | 1776 exitEvent.button = WebMouseEvent::Button::NoButton; |
1777 renderWidgetHostView_->ForwardMouseEvent(exitEvent); | 1777 renderWidgetHostView_->ForwardMouseEvent(exitEvent); |
1778 } | 1778 } |
1779 mouseEventWasIgnored_ = YES; | 1779 mouseEventWasIgnored_ = YES; |
1780 return; | 1780 return; |
1781 } | 1781 } |
1782 | 1782 |
1783 if (mouseEventWasIgnored_) { | 1783 if (mouseEventWasIgnored_) { |
1784 // If this is the first mouse event after a previous event that was ignored | 1784 // If this is the first mouse event after a previous event that was ignored |
1785 // due to the hitTest, send a mouse enter event to the host view. | 1785 // due to the hitTest, send a mouse enter event to the host view. |
1786 if (renderWidgetHostView_->render_widget_host_) { | 1786 if (renderWidgetHostView_->render_widget_host_) { |
1787 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); | 1787 WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); |
1788 enterEvent.type = WebInputEvent::MouseMove; | 1788 enterEvent.type = WebInputEvent::MouseMove; |
1789 enterEvent.button = WebMouseEvent::ButtonNone; | 1789 enterEvent.button = WebMouseEvent::Button::NoButton; |
1790 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { | 1790 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { |
1791 renderWidgetHostView_->render_widget_host_->delegate() | 1791 renderWidgetHostView_->render_widget_host_->delegate() |
1792 ->GetInputEventRouter() | 1792 ->GetInputEventRouter() |
1793 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); | 1793 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent); |
1794 } else { | 1794 } else { |
1795 ui::LatencyInfo latency_info; | 1795 ui::LatencyInfo latency_info; |
1796 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, | 1796 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, |
1797 0, 0); | 1797 0, 0); |
1798 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); | 1798 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); |
1799 } | 1799 } |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 if ([self window]) | 3050 if ([self window]) |
3051 [self updateScreenProperties]; | 3051 [self updateScreenProperties]; |
3052 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( | 3052 renderWidgetHostView_->browser_compositor_->SetNSViewAttachedToWindow( |
3053 [self window]); | 3053 [self window]); |
3054 | 3054 |
3055 // If we switch windows (or are removed from the view hierarchy), cancel any | 3055 // If we switch windows (or are removed from the view hierarchy), cancel any |
3056 // open mouse-downs. | 3056 // open mouse-downs. |
3057 if (hasOpenMouseDown_) { | 3057 if (hasOpenMouseDown_) { |
3058 WebMouseEvent event; | 3058 WebMouseEvent event; |
3059 event.type = WebInputEvent::MouseUp; | 3059 event.type = WebInputEvent::MouseUp; |
3060 event.button = WebMouseEvent::ButtonLeft; | 3060 event.button = WebMouseEvent::Button::Left; |
3061 renderWidgetHostView_->ForwardMouseEvent(event); | 3061 renderWidgetHostView_->ForwardMouseEvent(event); |
3062 | 3062 |
3063 hasOpenMouseDown_ = NO; | 3063 hasOpenMouseDown_ = NO; |
3064 } | 3064 } |
3065 } | 3065 } |
3066 | 3066 |
3067 - (void)viewDidChangeBackingProperties { | 3067 - (void)viewDidChangeBackingProperties { |
3068 NSScreen* screen = [[self window] screen]; | 3068 NSScreen* screen = [[self window] screen]; |
3069 if (screen) { | 3069 if (screen) { |
3070 gfx::ICCProfile icc_profile = | 3070 gfx::ICCProfile icc_profile = |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3246 | 3246 |
3247 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3247 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3248 // regions that are not draggable. (See ControlRegionView in | 3248 // regions that are not draggable. (See ControlRegionView in |
3249 // native_app_window_cocoa.mm). This requires the render host view to be | 3249 // native_app_window_cocoa.mm). This requires the render host view to be |
3250 // draggable by default. | 3250 // draggable by default. |
3251 - (BOOL)mouseDownCanMoveWindow { | 3251 - (BOOL)mouseDownCanMoveWindow { |
3252 return YES; | 3252 return YES; |
3253 } | 3253 } |
3254 | 3254 |
3255 @end | 3255 @end |
OLD | NEW |