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

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

Issue 2594543004: [Mac] Fix bubble anchors in RTL (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
index da2d46ffc062ef55466c4ca5b004f249924213ab..709ce025251d11328bcf7be84b0eae71050b8118 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -78,8 +78,13 @@ NSRect BubbleDecoration::GetImageRectInFrame(NSRect frame) {
const NSSize image_size = [image_ size];
image_rect.origin.y +=
- std::floor((NSHeight(frame) - image_size.height) / 2.0);
+ std::floor((NSHeight(image_rect) - image_size.height) / 2.0);
+ image_rect.origin.x += kLeftSidePadding;
image_rect.size = image_size;
+ if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
+ image_rect.origin.x =
+ NSMaxX(frame) - NSWidth(image_rect) - NSMinX(image_rect);
+ }
}
return image_rect;
}
@@ -114,18 +119,7 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
const BOOL is_rtl = cocoa_l10n_util::ShouldDoExperimentalRTLLayout();
if (image_) {
- // Center the image vertically.
- const NSSize image_size = [image_ size];
- NSRect image_rect = decoration_frame;
- if (is_rtl) {
- image_rect.origin.x =
- NSMaxX(decoration_frame) - image_size.width - kLeftSidePadding;
- } else {
- image_rect.origin.x += kLeftSidePadding;
- }
- image_rect.origin.y +=
- std::floor((NSHeight(decoration_frame) - image_size.height) / 2.0);
- image_rect.size = image_size;
+ NSRect image_rect = GetImageRectInFrame(frame);
[image_ drawInRect:image_rect
fromRect:NSZeroRect // Entire image
operation:NSCompositeSourceOver
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698