mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- 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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user