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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Add to deps AFTER deps exists Created 4 years 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/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 116c021143d4a3b9a8a072ff822c65b919704b47..d7209f8e86370d4d24073cc8a483459b4b109f01 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -31,7 +31,7 @@
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/cocoa/drag_util.h"
#import "chrome/browser/ui/cocoa/image_button_cell.h"
-#include "chrome/browser/ui/cocoa/l10n_util.h"
+#import "ui/base/cocoa/rtl_util.h"
#import "chrome/browser/ui/cocoa/new_tab_button.h"
#import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
#import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
@@ -137,7 +137,7 @@ private:
};
CGFloat FlipXInView(NSView* view, CGFloat width, CGFloat x) {
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout())
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout())
return [view frame].size.width - x - width;
return x;
}
@@ -831,7 +831,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
} else {
NSView* penultimateTab = [self viewAtIndex:numberOfOpenTabs - 2];
availableResizeWidth_ =
- cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ cocoa_rtl_util::ShouldDoExperimentalRTLLayout()
? FlipXInView(tabStripView_, 0, NSMinX([penultimateTab frame]))
: NSMaxX([penultimateTab frame]);
}
@@ -841,7 +841,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
// are currently below their maximum width and can grow).
NSView* lastTab = [self viewAtIndex:numberOfOpenTabs - 1];
availableResizeWidth_ =
- cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ cocoa_rtl_util::ShouldDoExperimentalRTLLayout()
? FlipXInView(tabStripView_, 0, NSMinX([lastTab frame]))
: NSMaxX([lastTab frame]);
}
@@ -899,7 +899,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
- (BOOL)isTabFullyVisible:(TabView*)tab {
NSRect frame = [tab frame];
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout()) {
return NSMinX(frame) >= [self trailingIndentForControls] &&
NSMaxX(frame) <= [self tabAreaRightEdge];
} else {
@@ -909,7 +909,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
}
- (CGFloat)tabAreaRightEdge {
- CGFloat rightEdge = cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
+ CGFloat rightEdge = cocoa_rtl_util::ShouldDoExperimentalRTLLayout()
? [self leadingIndentForControls]
: [self trailingIndentForControls];
return NSMaxX([tabStripView_ frame]) - rightEdge;
@@ -1073,7 +1073,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
// If the back edge is behind the placeholder's back edge, but the
// mid is in front of it of it, slide over to make space for it.
bool shouldLeaveGap;
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout()) {
const CGFloat tabMidpoint =
NSMidX(FlipRectInView(tabStripView_, tabFrame));
shouldLeaveGap = tabMidpoint < NSMaxX(placeholderFrame_);
@@ -1188,7 +1188,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
// so we don't have to check it against the available space. We do need
// to make sure we put it after any placeholder.
CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - kTabOverlap);
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout()) {
maxTabX = FlipXInView(tabStripView_, [newTabButton_ frame].size.width,
maxTabX) -
(2 * kNewTabButtonOffset);
@@ -1214,7 +1214,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
if (visible && animate) {
ScopedNSAnimationContextGroup localAnimationGroup(true);
BOOL movingBack = NSMinX(newTabNewFrame) < NSMinX(newTabTargetFrame_);
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout())
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout())
movingBack = !movingBack;
if (!movingBack) {
@@ -1757,7 +1757,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
// No placeholder, return the end of the strip.
if (placeholderTab_ == nil)
return count;
- BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout();
+ BOOL isRTL = cocoa_rtl_util::ShouldDoExperimentalRTLLayout();
double placeholderX =
isRTL ? NSMaxX(placeholderFrame_) : placeholderFrame_.origin.x;
int index = 0;
@@ -2049,7 +2049,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
DCHECK(index && disposition);
NSInteger i = 0;
- BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout();
+ BOOL isRTL = cocoa_rtl_util::ShouldDoExperimentalRTLLayout();
for (TabController* tab in tabArray_.get()) {
NSView* view = [tab view];
DCHECK([view isKindOfClass:[TabView class]]);
@@ -2271,12 +2271,12 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
- (void)addCustomWindowControls {
BOOL shouldFlipWindowControls =
- cocoa_l10n_util::ShouldFlipWindowControlsInRTL();
+ cocoa_rtl_util::ShouldFlipWindowControlsInRTL();
if (!customWindowControls_) {
// Make the container view.
CGFloat height = NSHeight([tabStripView_ frame]);
CGFloat width = [self leadingIndentForControls];
- if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout() &&
+ if (cocoa_rtl_util::ShouldDoExperimentalRTLLayout() &&
!shouldFlipWindowControls)
// The trailing indent is correct in this case, since the controls should
// stay on the left.

Powered by Google App Engine
This is Rietveld 408576698