The "why" is probably because I misunderstood something.  With an
NSTextField there, we can't set the selection without having focus,
which may have confused me into grabbing focus in cases where it isn't
needed (or requested).  I've been spending some time figuring out
where all that code can get called from.  Now that some of the other
code is more fleshed out, the original reason for it to be there might
be completely gone.

http://crbug.com/11920

-scott


On Wed, May 13, 2009 at 2:27 PM, Avi Drissman <[email protected]> wrote:
> OK, so this was r15790. The code already exists to set the focus to the
> location bar if it already had it, though.
>
> Avi
>
> On Wed, May 13, 2009 at 2:24 PM, Avi Drissman <[email protected]> wrote:
>>
>> I'm implementing save/restore focus when switching tabs, and a recent
>> checkin on the Mac omnibox is causing it to steal the focus. To see this:
>>
>> (gdb) b -[NSWindow makeFirstResponder:]
>>
>> Then switch tabs:
>>
>> #5  0x961f7f7b in -[NSTextField becomeFirstResponder] ()
>> #6  0x000c209f in AutocompleteEditViewMac::UpdateAndStyleText
>> (this=0x595a220, display_te...@0x595a260, user_text_length=0) at
>> /Users/avi/Source/chrome/src/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm:281
>> #7  0x000c24d7 in AutocompleteEditViewMac::SetWindowTextAndCaretPos
>> (this=0x595a220, te...@0x595a260, caret_pos=0) at
>> /Users/avi/Source/chrome/src/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm:203
>> #8  0x000bcd36 in AutocompleteEditModel::Revert (this=0x595a250) at
>> /Users/avi/Source/chrome/src/chrome/browser/autocomplete/autocomplete_edit.cc:174
>> #9  0x000c23bd in AutocompleteEditViewMac::RevertAll (this=0x595a220) at
>> /Users/avi/Source/chrome/src/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm:215
>> #10 0x000c25b4 in AutocompleteEditViewMac::Update (this=0x595a220,
>> tab_for_state_restoring=0x619da00) at
>> /Users/avi/Source/chrome/src/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm:125
>> #11 0x001862bf in LocationBarViewMac::Update (this=0x5959720,
>> contents=0x619da00, should_restore_state=true) at
>> /Users/avi/Source/chrome/src/chrome/browser/cocoa/location_bar_view_mac.mm:62
>> #12 0x00197ac8 in -[ToolbarController
>> updateToolbarWithContents:shouldRestoreState:] (self=0x59554a0,
>> _cmd=0x169a0a8, tab=0x619da00, shouldRestore=1 '\001') at
>> /Users/avi/Source/chrome/src/chrome/browser/cocoa/toolbar_controller.mm:102
>> #13 0x00181465 in -[BrowserWindowController
>> updateToolbarWithContents:shouldRestoreState:] (self=0x5944880,
>> _cmd=0x169a0a8, tab=0x619da00, shouldRestore=1 '\001') at
>> /Users/avi/Source/chrome/src/chrome/browser/cocoa/browser_window_controller.mm:305
>> #14 0x0017f1ff in BrowserWindowCocoa::UpdateToolbar (this=0x5949b10,
>> contents=0x619da00, should_restore_state=true) at
>> /Users/avi/Source/chrome/src/chrome/browser/cocoa/browser_window_cocoa.mm:145
>> #15 0x00127b49 in Browser::UpdateToolbar (this=0x59432c0,
>> should_restore_state=true) at
>> /Users/avi/Source/chrome/src/chrome/browser/browser.cc:2257
>>
>> UpdateToolbar ends up in AutocompleteEditViewMac::UpdateAndStyleText()
>> which, on lines 280-3 insists on becoming the keyboard focus. Why?
>>
>> Avi
>
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to