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

Unified Diff: chrome/browser/ui/cocoa/location_bar/security_state_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
Index: chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.mm
index 6e0d65ad0a7333ca836841a2cb5058baedb5bc06..d3bd316da9f024749ad3838bbeb4f8d855e5809c 100644
--- a/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.mm
@@ -30,9 +30,6 @@
namespace {
-// This is used to increase the left padding of this decoration.
-const CGFloat kLeftSidePadding = 5.0;
-
// Padding between the icon and label.
CGFloat kIconLabelPadding = 4.0;
@@ -44,8 +41,7 @@ const CGFloat kRetinaBaselineOffset = 0.5;
// The info-bubble point should look like it points to the bottom of the lock
// icon. Determined with Pixie.app.
-const CGFloat kPageInfoBubblePointXOffset = 5.0;
-const CGFloat kPageInfoBubblePointYOffset = 6.0;
+const CGFloat kPageInfoBubblePointYOffset = 2.0;
// Minimum acceptable width for the ev bubble.
const CGFloat kMinElidedBubbleWidth = 150.0;
@@ -159,18 +155,7 @@ void SecurityStateBubbleDecoration::DrawInFrame(NSRect frame,
CGFloat image_alpha =
image_fade_ && animation_.IsShowing() ? GetAnimationProgress() : 1.0;
- // Center the image vertically.
- const NSSize image_size = [image_ size];
- NSRect image_rect = decoration_frame;
- image_rect.origin.y +=
- std::floor((NSHeight(decoration_frame) - image_size.height) / 2.0);
- if (is_rtl) {
- image_rect.origin.x =
- NSMaxX(decoration_frame) - image_size.width - kLeftSidePadding;
- } else {
- image_rect.origin.x += kLeftSidePadding;
- }
- image_rect.size = image_size;
+ NSRect image_rect = GetImageRectInFrame(decoration_frame);
[image_ drawInRect:image_rect
fromRect:NSZeroRect // Entire image
operation:NSCompositeSourceOver
@@ -289,7 +274,7 @@ bool SecurityStateBubbleDecoration::AcceptsMousePress() {
NSPoint SecurityStateBubbleDecoration::GetBubblePointInFrame(NSRect frame) {
NSRect image_rect = GetImageRectInFrame(frame);
- return NSMakePoint(NSMidX(image_rect) + kPageInfoBubblePointXOffset,
+ return NSMakePoint(NSMidX(image_rect),
NSMaxY(image_rect) - kPageInfoBubblePointYOffset);
}

Powered by Google App Engine
This is Rietveld 408576698