Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 return; | 1069 return; |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 Element::defaultEventHandler(event); | 1072 Element::defaultEventHandler(event); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 void HTMLElement::handleKeypressEvent(KeyboardEvent* event) | 1075 void HTMLElement::handleKeypressEvent(KeyboardEvent* event) |
| 1076 { | 1076 { |
| 1077 if (!document()->settings() || !document()->settings()->spatialNavigationEna bled() || !supportsFocus()) | 1077 if (!document()->settings() || !document()->settings()->spatialNavigationEna bled() || !supportsFocus()) |
| 1078 return; | 1078 return; |
| 1079 // if the element is a text form control (like <input type=text> or <textare a>) | |
| 1080 // or has contentEditable attribute on, we should enter a space or newline | |
| 1081 // even in spatial navigation mode instead of handling it as "click" action. | |
|
esprehn
2013/07/26 11:00:02
as a "click"
Krzysztof Olczyk
2013/07/26 11:10:46
Done.
| |
| 1082 if (isTextFormControl() || isContentEditable()) | |
| 1083 return; | |
| 1079 int charCode = event->charCode(); | 1084 int charCode = event->charCode(); |
| 1080 if (charCode == '\r' || charCode == ' ') { | 1085 if (charCode == '\r' || charCode == ' ') { |
| 1081 dispatchSimulatedClick(event); | 1086 dispatchSimulatedClick(event); |
| 1082 event->setDefaultHandled(); | 1087 event->setDefaultHandled(); |
| 1083 } | 1088 } |
| 1084 } | 1089 } |
| 1085 | 1090 |
| 1086 } // namespace WebCore | 1091 } // namespace WebCore |
| 1087 | 1092 |
| 1088 #ifndef NDEBUG | 1093 #ifndef NDEBUG |
| 1089 | 1094 |
| 1090 // For use in the debugger | 1095 // For use in the debugger |
| 1091 void dumpInnerHTML(WebCore::HTMLElement*); | 1096 void dumpInnerHTML(WebCore::HTMLElement*); |
| 1092 | 1097 |
| 1093 void dumpInnerHTML(WebCore::HTMLElement* element) | 1098 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 1094 { | 1099 { |
| 1095 printf("%s\n", element->innerHTML().ascii().data()); | 1100 printf("%s\n", element->innerHTML().ascii().data()); |
| 1096 } | 1101 } |
| 1097 #endif | 1102 #endif |
| OLD | NEW |