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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2848953002: [Mac] Fix Omnibox decoration accessibility views in RTL (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 855e5e14b899ce188d84198d4ebc0fbb5c8bceb0..474a52412bf57420ca8e29864641ab2f12f7d2ef 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -27,6 +27,7 @@
#import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h"
#import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
+#import "chrome/browser/ui/cocoa/l10n_util.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
#import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
@@ -742,6 +743,8 @@ void LocationBarViewMac::UpdateAccessibilityView(
LocationBarDecoration* decoration) {
if (!decoration->IsVisible())
return;
+ // This uses |frame| instead of |bounds| because the accessibility views are
+ // parented to the toolbar.
NSRect apparent_frame =
[[field_ cell] frameForDecoration:decoration inFrame:[field_ frame]];
@@ -766,9 +769,13 @@ void LocationBarViewMac::UpdateAccessibilityView(
// before the button preceding the omnibox in the key view order. This
// threshold is just a guess.
DCHECK_LT(left_index, 10);
- if (left_index != -1)
- real_frame.origin.x = [field_ frame].origin.x - left_index - 1;
-
+ if (left_index != -1) {
+ CGFloat delta = left_index + 1;
+ real_frame.origin.x =
+ cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ ? NSMaxX([field_ frame]) + delta - NSWidth(real_frame)
+ : NSMinX([field_ frame]) - delta;
+ }
decoration->UpdateAccessibilityView(apparent_frame);
[decoration->GetAccessibilityView() setFrame:real_frame];
[decoration->GetAccessibilityView() setNeedsDisplayInRect:apparent_frame];
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698