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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |