From f474abdb177a3c870736e8c39f59f8a171af6c2a Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Thu, 15 Apr 2010 14:16:12 +0000 Subject: [Mac] Add an arrow cursor rect for the location image. BUG=41229 TEST=Mouse over the location image. Should show the arrow cursor, not an ibeam cursor. Review URL: http://codereview.chromium.org/1574028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44648 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/autocomplete_text_field.mm | 5 +++++ chrome/browser/cocoa/autocomplete_text_field_cell.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm index 49b0d80..a07cac1 100644 --- a/chrome/browser/cocoa/autocomplete_text_field.mm +++ b/chrome/browser/cocoa/autocomplete_text_field.mm @@ -195,6 +195,7 @@ // Show the I-beam cursor unless the mouse is over an image within the field // (Page Actions or the security icon) in which case show the arrow cursor. +// TODO(rohitrao): Should default to the arrow cursor. http://crbug.com/41612 - (void)resetCursorRects { NSRect fieldBounds = [self bounds]; [self addCursorRect:fieldBounds cursor:[NSCursor IBeamCursor]]; @@ -202,6 +203,10 @@ AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell]; for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:fieldBounds]) [self addCursorRect:[icon rect] cursor:[NSCursor arrowCursor]]; + + // Special-case the location image, since it is not in |-layedOutIcons|. + const NSRect locationIconFrame = [cell locationIconFrameForFrame:fieldBounds]; + [self addCursorRect:locationIconFrame cursor:[NSCursor arrowCursor]]; } // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.h b/chrome/browser/cocoa/autocomplete_text_field_cell.h index 21963bc..bc791cf 100644 --- a/chrome/browser/cocoa/autocomplete_text_field_cell.h +++ b/chrome/browser/cocoa/autocomplete_text_field_cell.h @@ -107,6 +107,10 @@ class ExtensionAction; - (void)setContentSettingViewsList: (LocationBarViewMac::ContentSettingViews*)views; +// Returns the portion of the cell to use for displaying the location +// icon. +- (NSRect)locationIconFrameForFrame:(NSRect)cellFrame; + // Returns an array of the visible AutocompleteTextFieldIcon objects. Returns // only visible icons. - (NSArray*)layedOutIcons:(NSRect)cellFrame; @@ -161,8 +165,4 @@ class ExtensionAction; // Returns the total number of installed Page Actions, visible or not. - (size_t)pageActionCount; -// Returns the portion of the cell to use for displaying the location -// icon. -- (NSRect)locationIconFrameForFrame:(NSRect)cellFrame; - @end -- cgit v1.1