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 <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
(...skipping 3079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3090 | 3090 |
3091 gfx::Range expected_range; | 3091 gfx::Range expected_range; |
3092 const base::string16* expected_text; | 3092 const base::string16* expected_text; |
3093 const content::TextInputManager::CompositionRangeInfo* compositionInfo = | 3093 const content::TextInputManager::CompositionRangeInfo* compositionInfo = |
3094 renderWidgetHostView_->GetCompositionRangeInfo(); | 3094 renderWidgetHostView_->GetCompositionRangeInfo(); |
3095 const content::TextInputManager::TextSelection* selection = | 3095 const content::TextInputManager::TextSelection* selection = |
3096 renderWidgetHostView_->GetTextSelection(); | 3096 renderWidgetHostView_->GetTextSelection(); |
3097 if (!selection) | 3097 if (!selection) |
3098 return nil; | 3098 return nil; |
3099 | 3099 |
3100 if (!compositionInfo->range.is_empty()) { | 3100 if (compositionInfo && !compositionInfo->range.is_empty()) { |
| 3101 // This method might get called after TextInputState.type is reset to none, |
| 3102 // in which case there will be no composition range information |
| 3103 // (https://crbug.com/698672). |
3101 expected_text = &markedText_; | 3104 expected_text = &markedText_; |
3102 expected_range = compositionInfo->range; | 3105 expected_range = compositionInfo->range; |
3103 } else { | 3106 } else { |
3104 expected_text = &selection->text(); | 3107 expected_text = &selection->text(); |
3105 size_t offset = selection->offset(); | 3108 size_t offset = selection->offset(); |
3106 expected_range = gfx::Range(offset, offset + expected_text->size()); | 3109 expected_range = gfx::Range(offset, offset + expected_text->size()); |
3107 } | 3110 } |
3108 | 3111 |
3109 gfx::Range actual_range = expected_range.Intersect(requested_range); | 3112 gfx::Range actual_range = expected_range.Intersect(requested_range); |
3110 if (!actual_range.IsValid()) | 3113 if (!actual_range.IsValid()) |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3489 | 3492 |
3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3493 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3491 // regions that are not draggable. (See ControlRegionView in | 3494 // regions that are not draggable. (See ControlRegionView in |
3492 // native_app_window_cocoa.mm). This requires the render host view to be | 3495 // native_app_window_cocoa.mm). This requires the render host view to be |
3493 // draggable by default. | 3496 // draggable by default. |
3494 - (BOOL)mouseDownCanMoveWindow { | 3497 - (BOOL)mouseDownCanMoveWindow { |
3495 return YES; | 3498 return YES; |
3496 } | 3499 } |
3497 | 3500 |
3498 @end | 3501 @end |
OLD | NEW |