Mac: Avoid re-entering OnSetFocus in becomeFirstResponder (issue #508).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@692 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-06-11 20:41:55 +00:00
parent 15c579aa77
commit 315414ec26
1 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,7 @@
@interface CefBrowserHostView : NSView {
@private
CefBrowserHostImpl* browser_; // weak
bool is_in_onsetfocus_;
}
@property (nonatomic, assign) CefBrowserHostImpl* browser;
@ -50,8 +51,14 @@
}
- (BOOL)becomeFirstResponder {
if (browser_ && browser_->GetWebContents())
if (browser_ && browser_->GetWebContents()) {
// Avoid re-entering OnSetFocus.
if (!is_in_onsetfocus_) {
is_in_onsetfocus_ = true;
browser_->OnSetFocus(FOCUS_SOURCE_SYSTEM);
is_in_onsetfocus_ = false;
}
}
return YES;
}