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 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 // TODO(thakis): Pipe |actualRange| through TextInputClientMac machinery. | 2678 // TODO(thakis): Pipe |actualRange| through TextInputClientMac machinery. |
2679 if (actualRange) | 2679 if (actualRange) |
2680 *actualRange = theRange; | 2680 *actualRange = theRange; |
2681 NSRect rect = TextInputClientMac::GetInstance()->GetFirstRectForRange( | 2681 NSRect rect = TextInputClientMac::GetInstance()->GetFirstRectForRange( |
2682 renderWidgetHostView_->render_widget_host_, theRange); | 2682 renderWidgetHostView_->render_widget_host_, theRange); |
2683 | 2683 |
2684 // The returned rectangle is in WebKit coordinates (upper left origin), so | 2684 // The returned rectangle is in WebKit coordinates (upper left origin), so |
2685 // flip the coordinate system and then convert it into screen coordinates for | 2685 // flip the coordinate system and then convert it into screen coordinates for |
2686 // return. | 2686 // return. |
2687 NSRect viewFrame = [self frame]; | 2687 NSRect viewFrame = [self frame]; |
2688 rect.origin.y = NSHeight(viewFrame) - rect.origin.y; | 2688 rect.origin.y = NSHeight(viewFrame) - NSMaxY(rect); |
2689 rect.origin.y -= rect.size.height; | 2689 rect = [self convertRect:rect toView:nil]; |
2690 rect = [self convertRectToBase:rect]; | |
2691 rect.origin = [[self window] convertBaseToScreen:rect.origin]; | 2690 rect.origin = [[self window] convertBaseToScreen:rect.origin]; |
2692 return rect; | 2691 return rect; |
2693 } | 2692 } |
2694 | 2693 |
2695 - (NSRange)markedRange { | 2694 - (NSRange)markedRange { |
2696 // An input method calls this method to check if an application really has | 2695 // An input method calls this method to check if an application really has |
2697 // a text being composed when hasMarkedText call returns true. | 2696 // a text being composed when hasMarkedText call returns true. |
2698 // Returns the range saved in the setMarkedText method so the input method | 2697 // Returns the range saved in the setMarkedText method so the input method |
2699 // calls the setMarkedText method and we can update the composition node | 2698 // calls the setMarkedText method and we can update the composition node |
2700 // there. (When this method returns an empty range, the input method doesn't | 2699 // there. (When this method returns an empty range, the input method doesn't |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 if (!string) return NO; | 3084 if (!string) return NO; |
3086 | 3085 |
3087 // If the user is currently using an IME, confirm the IME input, | 3086 // If the user is currently using an IME, confirm the IME input, |
3088 // and then insert the text from the service, the same as TextEdit and Safari. | 3087 // and then insert the text from the service, the same as TextEdit and Safari. |
3089 [self confirmComposition]; | 3088 [self confirmComposition]; |
3090 [self insertText:string]; | 3089 [self insertText:string]; |
3091 return YES; | 3090 return YES; |
3092 } | 3091 } |
3093 | 3092 |
3094 @end | 3093 @end |
OLD | NEW |