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" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ui::POST_DISPATCH_NONE) | 74 ui::POST_DISPATCH_NONE) |
75 return true; | 75 return true; |
76 } | 76 } |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 // Returns true if |client| has RTL text. | 80 // Returns true if |client| has RTL text. |
81 bool IsTextRTL(const ui::TextInputClient* client) { | 81 bool IsTextRTL(const ui::TextInputClient* client) { |
82 gfx::Range text_range; | 82 gfx::Range text_range; |
83 base::string16 text; | 83 base::string16 text; |
84 return client->GetTextRange(&text_range) && | 84 return client && client->GetTextRange(&text_range) && |
85 client->GetTextFromRange(text_range, &text) && | 85 client->GetTextFromRange(text_range, &text) && |
86 base::i18n::GetStringDirection(text) == base::i18n::RIGHT_TO_LEFT; | 86 base::i18n::GetStringDirection(text) == base::i18n::RIGHT_TO_LEFT; |
87 } | 87 } |
88 | 88 |
89 // Returns the boundary rectangle for composition characters in the | 89 // Returns the boundary rectangle for composition characters in the |
90 // |requested_range|. Sets |actual_range| corresponding to the returned | 90 // |requested_range|. Sets |actual_range| corresponding to the returned |
91 // rectangle. For cases, where there is no composition text or the | 91 // rectangle. For cases, where there is no composition text or the |
92 // |requested_range| lies outside the composition range, a zero width rectangle | 92 // |requested_range| lies outside the composition range, a zero width rectangle |
93 // corresponding to the caret bounds is returned. Logic used is similar to | 93 // corresponding to the caret bounds is returned. Logic used is similar to |
94 // RenderWidgetHostViewMac::GetCachedFirstRectForCharacterRange(...). | 94 // RenderWidgetHostViewMac::GetCachedFirstRectForCharacterRange(...). |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 } | 1185 } |
1186 | 1186 |
1187 return [super accessibilityAttributeValue:attribute]; | 1187 return [super accessibilityAttributeValue:attribute]; |
1188 } | 1188 } |
1189 | 1189 |
1190 - (id)accessibilityHitTest:(NSPoint)point { | 1190 - (id)accessibilityHitTest:(NSPoint)point { |
1191 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 1191 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
1192 } | 1192 } |
1193 | 1193 |
1194 @end | 1194 @end |
OLD | NEW |