- Add CefFocusHandler::OnFocusedNodeChanged() notification (issue #379).

- Add CefDOMNode::IsFormControlElement() and CefDOMNode::GetFormControlElementType() methods (issue #379).
- Add space bar handling example to cefclient.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@318 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-10-14 12:40:40 +00:00
parent 06b7e9ab53
commit 9c6dcab73a
16 changed files with 267 additions and 12 deletions

View File

@@ -20,7 +20,8 @@ ClientHandler::ClientHandler()
m_BackHwnd(NULL),
m_ForwardHwnd(NULL),
m_StopHwnd(NULL),
m_ReloadHwnd(NULL)
m_ReloadHwnd(NULL),
m_bFormElementHasFocus(false)
{
}
@@ -201,6 +202,37 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
return false;
}
void ClientHandler::OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefDOMNode> node)
{
REQUIRE_UI_THREAD();
// Set to true if a form element has focus.
m_bFormElementHasFocus = (node.get() && node->IsFormControlElement());
}
bool ClientHandler::OnKeyEvent(CefRefPtr<CefBrowser> browser,
KeyEventType type,
int code,
int modifiers,
bool isSystemKey)
{
REQUIRE_UI_THREAD();
if (!m_bFormElementHasFocus && code == 0x20) {
// Special handling for the space character if a form element does not have
// focus.
if (type == KEYEVENT_RAWKEYDOWN) {
browser->GetMainFrame()->ExecuteJavaScript(
"alert('You pressed the space bar!');", "", 0);
}
return true;
}
return false;
}
bool ClientHandler::GetPrintHeaderFooter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefPrintInfo& printInfo,