summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/autocomplete_text_field_cell.mm
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:14:39 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 16:14:39 +0000
commit529afc4a06f74fe8d93cb7d62ecfd23b338de78d (patch)
tree713f2796f45949844d135ec64282390213bbf77a /chrome/browser/cocoa/autocomplete_text_field_cell.mm
parenta7a478ce4507536d60554dd3885100a9964792fa (diff)
downloadchromium_src-529afc4a06f74fe8d93cb7d62ecfd23b338de78d.zip
chromium_src-529afc4a06f74fe8d93cb7d62ecfd23b338de78d.tar.gz
chromium_src-529afc4a06f74fe8d93cb7d62ecfd23b338de78d.tar.bz2
Fix extension installed bubble, so that it points to the correct page action icon when more than one page action is visible.
BUG= 38255 TEST= see bug report; this should no longer be reproducible. Review URL: http://codereview.chromium.org/1083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/autocomplete_text_field_cell.mm')
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_cell.mm17
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.mm b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
index 2b5600a..4b719a1 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
@@ -304,13 +304,11 @@ CGFloat WidthForKeyword(NSAttributedString* keywordString) {
LocationBarViewMac::PageActionImageView* view =
page_action_views_->ViewAt(index);
- // If we are calculating space for a preview page action, the icon is still
- // loading. We use this function only to get the correct x value for the
- // extension installed bubble arrow.
- if (!view->preview_enabled() &&
- (!view->GetImage() || !view->IsVisible())) {
+ // When this method is called, all the icon images are still loading, so
+ // just check to see whether the view is visible when deciding whether
+ // its NSRect should be made available.
+ if (!view->preview_enabled() && !view->IsVisible())
return NSZeroRect;
- }
for (AutocompleteTextFieldIcon* icon in [self layedOutIcons:cellFrame]) {
if (view == [icon view])
@@ -418,8 +416,11 @@ CGFloat WidthForKeyword(NSAttributedString* keywordString) {
for (size_t i = 0; i < pageActionCount; ++i) {
LocationBarViewMac::PageActionImageView* view =
page_action_views_->ViewAt(i);
- if (view->preview_enabled() || (view->GetImage() && view->IsVisible())) {
- NSSize iconSize = view->GetImageSize();
+ if (view->preview_enabled() || view->IsVisible()) {
+ // If this function is called right after a page action icon has been
+ // created, the images for all views will still be loading; in this case,
+ // each visible view will give us its default size.
+ NSSize iconSize = view->GetPreferredImageSize();
NSRect pageActionFrame =
[self rightJustifyImage:iconSize
inRect:iconFrame