| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "skia/ext/skia_utils_mac.h" | 11 #include "skia/ext/skia_utils_mac.h" |
| 12 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 12 #include "ui/base/ime/input_method.h" | 13 #include "ui/base/ime/input_method.h" |
| 13 #include "ui/base/ime/text_input_client.h" | 14 #include "ui/base/ime/text_input_client.h" |
| 14 #include "ui/compositor/canvas_painter.h" | 15 #include "ui/compositor/canvas_painter.h" |
| 15 #import "ui/events/cocoa/cocoa_event_utils.h" | 16 #import "ui/events/cocoa/cocoa_event_utils.h" |
| 16 #include "ui/events/keycodes/dom/dom_code.h" | 17 #include "ui/events/keycodes/dom/dom_code.h" |
| 17 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 18 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
| 18 #include "ui/gfx/canvas_paint_mac.h" | 19 #include "ui/gfx/canvas_paint_mac.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 20 #import "ui/gfx/mac/coordinate_conversion.h" | 21 #import "ui/gfx/mac/coordinate_conversion.h" |
| 21 #include "ui/gfx/path.h" | 22 #include "ui/gfx/path.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 43 } | 44 } |
| 44 | 45 |
| 45 // Convert a |point| in |source_window|'s AppKit coordinate system (origin at | 46 // Convert a |point| in |source_window|'s AppKit coordinate system (origin at |
| 46 // the bottom left of the window) to |target_window|'s content rect, with the | 47 // the bottom left of the window) to |target_window|'s content rect, with the |
| 47 // origin at the top left of the content area. | 48 // origin at the top left of the content area. |
| 48 // If |source_window| is nil, |point| will be treated as screen coordinates. | 49 // If |source_window| is nil, |point| will be treated as screen coordinates. |
| 49 gfx::Point MovePointToWindow(const NSPoint& point, | 50 gfx::Point MovePointToWindow(const NSPoint& point, |
| 50 NSWindow* source_window, | 51 NSWindow* source_window, |
| 51 NSWindow* target_window) { | 52 NSWindow* target_window) { |
| 52 NSPoint point_in_screen = source_window | 53 NSPoint point_in_screen = source_window |
| 53 ? [source_window convertBaseToScreen:point] | 54 ? ui::ConvertPointFromWindowToScreen(source_window, point) |
| 54 : point; | 55 : point; |
| 55 | 56 |
| 56 NSPoint point_in_window = [target_window convertScreenToBase:point_in_screen]; | 57 NSPoint point_in_window = |
| 58 ui::ConvertPointFromScreenToWindow(target_window, point_in_screen); |
| 57 NSRect content_rect = | 59 NSRect content_rect = |
| 58 [target_window contentRectForFrameRect:[target_window frame]]; | 60 [target_window contentRectForFrameRect:[target_window frame]]; |
| 59 return gfx::Point(point_in_window.x, | 61 return gfx::Point(point_in_window.x, |
| 60 NSHeight(content_rect) - point_in_window.y); | 62 NSHeight(content_rect) - point_in_window.y); |
| 61 } | 63 } |
| 62 | 64 |
| 63 // Checks if there's an active MenuController during key event dispatch. If | 65 // Checks if there's an active MenuController during key event dispatch. If |
| 64 // there is one, it gets preference, and it will likely swallow the event. | 66 // there is one, it gets preference, and it will likely swallow the event. |
| 65 bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) { | 67 bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) { |
| 66 MenuController* menuController = MenuController::GetActiveInstance(); | 68 MenuController* menuController = MenuController::GetActiveInstance(); |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 920 } |
| 919 | 921 |
| 920 return [super accessibilityAttributeValue:attribute]; | 922 return [super accessibilityAttributeValue:attribute]; |
| 921 } | 923 } |
| 922 | 924 |
| 923 - (id)accessibilityHitTest:(NSPoint)point { | 925 - (id)accessibilityHitTest:(NSPoint)point { |
| 924 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 926 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
| 925 } | 927 } |
| 926 | 928 |
| 927 @end | 929 @end |
| OLD | NEW |