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

Unified Diff: chrome/browser/ui/cocoa/gradient_button_cell.mm

Issue 2511973002: Reverse bookmark buttons and menus in RTL (Closed)
Patch Set: Increase cell size to account for gradient button's inset Created 4 years, 1 month 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/gradient_button_cell.mm
diff --git a/chrome/browser/ui/cocoa/gradient_button_cell.mm b/chrome/browser/ui/cocoa/gradient_button_cell.mm
index 4827cef0a613467092a3308d79a75041ec3da203..f1a5abf82d78567387d6130a636fa1caecf8e6f8 100644
--- a/chrome/browser/ui/cocoa/gradient_button_cell.mm
+++ b/chrome/browser/ui/cocoa/gradient_button_cell.mm
@@ -743,7 +743,6 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
if (shouldClipTheTitle)
[NSBezierPath clipRect:solidPart];
- CGFloat textLeft = [self textStartXOffset];
// For some reason, the height of cellFrame as passed in is totally bogus.
// For vertical centering purposes, we need the bounds of the containing
@@ -751,17 +750,15 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
NSRect buttonFrame = [[self controlView] frame];
// Call the vertical offset to match native NSButtonCell's version.
- textOffset = NSMakePoint(textLeft,
- (NSHeight(buttonFrame) - size.height) / 2 +
- [self verticalTextOffset]);
+ textOffset = NSMakePoint(
+ NSMinX(cellFrame),
+ (NSHeight(buttonFrame) - size.height) / 2 + [self verticalTextOffset]);
// WIth Material Design we want an ellipsis if the title is too long to fit,
// so have to use drawInRect: instead of drawAtPoint:.
if (isModeMaterial) {
- NSRect textBounds = NSMakeRect(textOffset.x,
- textOffset.y,
- NSWidth(buttonFrame) - textOffset.x,
- NSHeight(buttonFrame));
- [title drawInRect:textBounds];
+ NSRect textFrame = NSMakeRect(textOffset.x, textOffset.y,
+ NSWidth(cellFrame), NSHeight(buttonFrame));
+ [title drawInRect:textFrame];
} else {
[title drawAtPoint:textOffset];
}

Powered by Google App Engine
This is Rietveld 408576698