diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 20:18:59 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 20:18:59 +0000 |
commit | 0714640cb5ed3955abc1f599206acbeb52ca97cc (patch) | |
tree | 45ae0a2516e1447fe14b69229c7520ecad72f7b2 | |
parent | db9fff737c9ea46f704017bb2bb135904a09e330 (diff) | |
download | chromium_src-0714640cb5ed3955abc1f599206acbeb52ca97cc.zip chromium_src-0714640cb5ed3955abc1f599206acbeb52ca97cc.tar.gz chromium_src-0714640cb5ed3955abc1f599206acbeb52ca97cc.tar.bz2 |
[Mac] Properly position the Page Info bubble when there's the EV cert bubble.
BUG=59397
TEST=Go to www.bankofamerica.com. Click EV bubble. Page info bubble pops up underneath the icon.
Review URL: http://codereview.chromium.org/4032003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63552 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 29 insertions, 8 deletions
diff --git a/chrome/browser/cocoa/location_bar/ev_bubble_decoration.h b/chrome/browser/cocoa/location_bar/ev_bubble_decoration.h index ae06586..bbb29fc 100644 --- a/chrome/browser/cocoa/location_bar/ev_bubble_decoration.h +++ b/chrome/browser/cocoa/location_bar/ev_bubble_decoration.h @@ -29,6 +29,10 @@ class EVBubbleDecoration : public BubbleDecoration { // fits, else it will set an elided version. void SetFullLabel(NSString* full_label); + // Get the point where the page info bubble should point within the + // decoration's frame, in the cell's coordinates. + NSPoint GetBubblePointInFrame(NSRect frame); + // Implement |LocationBarDecoration|. virtual CGFloat GetWidthForSpace(CGFloat width); virtual bool IsDraggable(); diff --git a/chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm b/chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm index 1f54500..40220e4 100644 --- a/chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm +++ b/chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm @@ -28,6 +28,10 @@ const CGFloat kMinElidedBubbleWidth = 150.0; // |kMinElidedBubbleWidth|. const float kMaxBubbleFraction = 0.5; +// The info-bubble point should look like it points to the bottom of the lock +// icon. Determined with Pixie.app. +const CGFloat kPageInfoBubblePointYOffset = 6.0; + // TODO(shess): This is ugly, find a better way. Using it right now // so that I can crib from gtk and still be able to see that I'm using // the same values easily. @@ -61,6 +65,12 @@ void EVBubbleDecoration::SetFullLabel(NSString* label) { SetLabel(full_label_); } +NSPoint EVBubbleDecoration::GetBubblePointInFrame(NSRect frame) { + NSRect image_rect = GetImageRectInFrame(frame); + return NSMakePoint(NSMidX(image_rect), + NSMaxY(image_rect) - kPageInfoBubblePointYOffset); +} + CGFloat EVBubbleDecoration::GetWidthForSpace(CGFloat width) { // Limit with to not take up too much of the available width, but // also don't let it shrink too much. diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm index e20a50f..9b45531 100644 --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm @@ -474,10 +474,19 @@ NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { AutocompleteTextFieldCell* cell = [field_ cell]; - const NSRect frame = [cell frameForDecoration:location_icon_decoration_.get() - inFrame:[field_ bounds]]; - const NSPoint point = location_icon_decoration_->GetBubblePointInFrame(frame); - return [field_ convertPoint:point toView:nil]; + if (ev_bubble_decoration_->IsVisible()) { + const NSRect frame = [cell frameForDecoration:ev_bubble_decoration_.get() + inFrame:[field_ bounds]]; + const NSPoint point = ev_bubble_decoration_->GetBubblePointInFrame(frame); + return [field_ convertPoint:point toView:nil]; + } else { + const NSRect frame = + [cell frameForDecoration:location_icon_decoration_.get() + inFrame:[field_ bounds]]; + const NSPoint point = + location_icon_decoration_->GetBubblePointInFrame(frame); + return [field_ convertPoint:point toView:nil]; + } } NSImage* LocationBarViewMac::GetKeywordImage(const std::wstring& keyword) { diff --git a/chrome/browser/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/cocoa/location_bar/location_icon_decoration.mm index f967af2..9649789 100644 --- a/chrome/browser/cocoa/location_bar/location_icon_decoration.mm +++ b/chrome/browser/cocoa/location_bar/location_icon_decoration.mm @@ -11,10 +11,8 @@ #include "chrome/browser/tab_contents/tab_contents.h" #import "third_party/mozilla/NSPasteboard+Utils.h" -// The info-bubble point should look like it points to the point -// between the star's lower tips. The popup should be where the -// Omnibox popup ends up (2px below field). Determined via Pixie.app -// magnification. +// The info-bubble point should look like it points to the bottom of the lock +// icon. Determined with Pixie.app. const CGFloat kBubblePointYOffset = 2.0; LocationIconDecoration::LocationIconDecoration(LocationBarViewMac* owner) |