Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 2050583002: BridgedContentView: Modify IsTextRTL to use GetFirstStrongCharacterDirection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 return false; 82 return false;
83 } 83 }
84 84
85 // Returns true if |client| has RTL text. 85 // Returns true if |client| has RTL text.
86 bool IsTextRTL(const ui::TextInputClient* client) { 86 bool IsTextRTL(const ui::TextInputClient* client) {
87 gfx::Range text_range; 87 gfx::Range text_range;
88 base::string16 text; 88 base::string16 text;
89 return client && client->GetTextRange(&text_range) && 89 return client && client->GetTextRange(&text_range) &&
90 client->GetTextFromRange(text_range, &text) && 90 client->GetTextFromRange(text_range, &text) &&
91 base::i18n::GetStringDirection(text) == base::i18n::RIGHT_TO_LEFT; 91 base::i18n::GetFirstStrongCharacterDirection(text) ==
92 base::i18n::RIGHT_TO_LEFT;
92 } 93 }
93 94
94 // Returns the boundary rectangle for composition characters in the 95 // Returns the boundary rectangle for composition characters in the
95 // |requested_range|. Sets |actual_range| corresponding to the returned 96 // |requested_range|. Sets |actual_range| corresponding to the returned
96 // rectangle. For cases, where there is no composition text or the 97 // rectangle. For cases, where there is no composition text or the
97 // |requested_range| lies outside the composition range, a zero width rectangle 98 // |requested_range| lies outside the composition range, a zero width rectangle
98 // corresponding to the caret bounds is returned. Logic used is similar to 99 // corresponding to the caret bounds is returned. Logic used is similar to
99 // RenderWidgetHostViewMac::GetCachedFirstRectForCharacterRange(...). 100 // RenderWidgetHostViewMac::GetCachedFirstRectForCharacterRange(...).
100 gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client, 101 gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
101 const gfx::Range& requested_range, 102 const gfx::Range& requested_range,
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1233 }
1233 1234
1234 return [super accessibilityAttributeValue:attribute]; 1235 return [super accessibilityAttributeValue:attribute];
1235 } 1236 }
1236 1237
1237 - (id)accessibilityHitTest:(NSPoint)point { 1238 - (id)accessibilityHitTest:(NSPoint)point {
1238 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 1239 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
1239 } 1240 }
1240 1241
1241 @end 1242 @end
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698