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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 2848953002: [Mac] Fix Omnibox decoration accessibility views in RTL (Closed)
Patch Set: Created 3 years, 7 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 | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm » ('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 (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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Reverse the right-hand decorations so that overall everything is 153 // Reverse the right-hand decorations so that overall everything is
154 // sorted left to right. 154 // sorted left to right.
155 std::reverse(decorations->begin() + leading_count, decorations->end()); 155 std::reverse(decorations->begin() + leading_count, decorations->end());
156 std::reverse(decoration_frames->begin() + leading_count, 156 std::reverse(decoration_frames->begin() + leading_count,
157 decoration_frames->end()); 157 decoration_frames->end());
158 158
159 // Flip all frames in RTL. 159 // Flip all frames in RTL.
160 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { 160 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
161 for (NSRect& rect : *decoration_frames) 161 for (NSRect& rect : *decoration_frames)
162 rect.origin.x = NSWidth(frame) - NSWidth(rect) - NSMinX(rect); 162 rect.origin.x =
163 text_frame->origin.x = 163 NSMinX(frame) + NSMaxX(frame) - NSWidth(rect) - NSMinX(rect);
164 NSWidth(frame) - NSWidth(*text_frame) - NSMinX(*text_frame); 164 text_frame->origin.x = NSMinX(frame) + NSMaxX(frame) -
165 NSWidth(*text_frame) - NSMinX(*text_frame);
165 leading_count = decorations->size() - leading_count; 166 leading_count = decorations->size() - leading_count;
166 } 167 }
167 168
168 return leading_count; 169 return leading_count;
169 } 170 }
170 171
171 } // namespace 172 } // namespace
172 173
173 @implementation AutocompleteTextFieldCell 174 @implementation AutocompleteTextFieldCell
174 175
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 746
746 @end 747 @end
747 748
748 @implementation AutocompleteTextFieldCell (TestingAPI) 749 @implementation AutocompleteTextFieldCell (TestingAPI)
749 750
750 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { 751 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations {
751 return mouseTrackingDecorations_; 752 return mouseTrackingDecorations_;
752 } 753 }
753 754
754 @end 755 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698