This source file includes following definitions.
- handleKeydownEvent
- handleKeypressEvent
- handleKeyupEvent
- accessKeyAction
- handleKeydownEvent
- handleKeypressEvent
- handleKeyupEvent
- accessKeyAction
#include "config.h"
#include "core/html/forms/BaseClickableWithKeyInputType.h"
#include "core/events/KeyboardEvent.h"
#include "core/html/HTMLInputElement.h"
namespace WebCore {
using namespace HTMLNames;
void BaseClickableWithKeyInputType::handleKeydownEvent(HTMLInputElement& element, KeyboardEvent* event)
{
const String& key = event->keyIdentifier();
if (key == "U+0020") {
element.setActive(true);
}
}
void BaseClickableWithKeyInputType::handleKeypressEvent(HTMLInputElement& element, KeyboardEvent* event)
{
int charCode = event->charCode();
if (charCode == '\r') {
element.dispatchSimulatedClick(event);
event->setDefaultHandled();
return;
}
if (charCode == ' ') {
event->setDefaultHandled();
}
}
void BaseClickableWithKeyInputType::handleKeyupEvent(InputType& inputType, KeyboardEvent* event)
{
const String& key = event->keyIdentifier();
if (key != "U+0020")
return;
inputType.dispatchSimulatedClickIfActive(event);
}
void BaseClickableWithKeyInputType::accessKeyAction(HTMLInputElement& element, bool sendMouseEvents)
{
element.dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
void BaseClickableWithKeyInputType::handleKeydownEvent(KeyboardEvent* event)
{
handleKeydownEvent(element(), event);
}
void BaseClickableWithKeyInputType::handleKeypressEvent(KeyboardEvent* event)
{
handleKeypressEvent(element(), event);
}
void BaseClickableWithKeyInputType::handleKeyupEvent(KeyboardEvent* event)
{
handleKeyupEvent(*this, event);
}
void BaseClickableWithKeyInputType::accessKeyAction(bool sendMouseEvents)
{
InputType::accessKeyAction(sendMouseEvents);
accessKeyAction(element(), sendMouseEvents);
}
}