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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 2631463004: [Mac] Flip toolbar in RTL (reland) (Closed)
Patch Set: Created 3 years, 11 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
Index: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
index 44b5cbc103699d6a2cc9f272af7f5cc7f17cb873..60d3c426e7bef1b80c8b0f3b6a1503b0607ad855 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
@@ -20,6 +20,7 @@
#import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
#import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
#import "chrome/browser/ui/cocoa/image_button_cell.h"
+#import "chrome/browser/ui/cocoa/l10n_util.h"
#import "chrome/browser/ui/cocoa/menu_button.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_bridge.h"
@@ -581,11 +582,14 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
if (NSMinX([button frameAfterAnimation]) == NSMinX(buttonFrame))
continue;
- // We set the x-origin by calculating the proper distance from the right
- // edge in the container so that, if the container is animating, the
+ // In LTR, We set the x-origin by calculating the proper distance from the
+ // right edge in the container so that, if the container is animating, the
// button appears stationary.
- buttonFrame.origin.x = NSWidth([containerView_ frame]) -
- (toolbarActionsBar_->GetPreferredSize().width() - NSMinX(buttonFrame));
+ if (!cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
+ buttonFrame.origin.x = NSWidth([containerView_ frame]) -
+ (toolbarActionsBar_->GetPreferredSize().width() -
+ NSMinX(buttonFrame));
+ }
[button setFrame:buttonFrame animate:NO];
}
}
@@ -783,9 +787,16 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
}
- (void)updateGrippyCursors {
+ BOOL canClose = [self visibleButtonCount] > 0;
+ BOOL canOpen = toolbarActionsBar_->GetIconCount() != [buttons_ count];
+ [containerView_
+ setCanDragLeft:cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ ? canClose
+ : canOpen];
[containerView_
- setCanDragLeft:toolbarActionsBar_->GetIconCount() != [buttons_ count]];
- [containerView_ setCanDragRight:[self visibleButtonCount] > 0];
+ setCanDragRight:cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ ? canOpen
+ : canClose];
[[containerView_ window] invalidateCursorRectsForView:containerView_];
}

Powered by Google App Engine
This is Rietveld 408576698