diff options
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.mm | 9 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_mac.mm | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm index 68fb0de..8898a87 100644 --- a/chrome/browser/cocoa/tab_contents_controller.mm +++ b/chrome/browser/cocoa/tab_contents_controller.mm @@ -49,8 +49,13 @@ } - (void)tabDidChange:(TabContents*)updatedContents { - contents_ = updatedContents; - [contentsBox_ setContentView:contents_->GetNativeView()]; + // Calling setContentView: here removes any first responder status + // the view may have, so avoid changing the view hierarchy unless + // the view is different. + if (contents_ != updatedContents) { + contents_ = updatedContents; + [contentsBox_ setContentView:contents_->GetNativeView()]; + } } // Return the rect, in WebKit coordinates (flipped), of the window's grow box diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index adc9e22..662dd42 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -104,6 +104,7 @@ void TabContentsViewMac::SizeContents(const gfx::Size& size) { } void TabContentsViewMac::Focus() { + [[cocoa_view_.get() window] makeFirstResponder:GetContentNativeView()]; } void TabContentsViewMac::SetInitialFocus() { |