Commit 177864ba authored by kocienda's avatar kocienda
Browse files

Reviewed by NOBODY (OOPS!).

	Final fix for this bug:

	Radar 3062858 (REGRESSION: failed login at www.usaa.com doesn't return error text)

	We were down to a case where submitting the login form with the return key
	failed since we did not implement either non-standard keyCode (IE-style) or
	which (Netscape-style) UI event extension for getting the value of a key
	press. The form submission code depended on sensing the value of the
	key press by checking one of these properties.

	Since the "which" property also can be used for mouse events, and fixing
	this bug could be done by implementing either keyCode or which, I chose
	to implement keyCode only.

        * khtml/dom/dom2_events.cpp: Added keyCode function definition.
        * khtml/dom/dom2_events.h: Added keyCode function declaration.
        * khtml/ecma/kjs_events.cpp:
        (DOMUIEvent::getValueProperty): Added new KeyCode attribute.
        * khtml/ecma/kjs_events.h: New generated file.
        * khtml/ecma/kjs_events.lut.h: Ditto.
        * khtml/xml/dom2_eventsimpl.cpp:
        (KeyEventImpl::KeyEventImpl): Fixed a bug in khtml that prevented the
        m_keyVal field on KeyEventImpl from ever being set correctly.
        I guess I am the first person ever to care about that value. :-)


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c1f231f6
2002-12-12 Ken Kocienda <kocienda@apple.com>
Reviewed by NOBODY (OOPS!).
Final fix for this bug:
Radar 3062858 (REGRESSION: failed login at www.usaa.com doesn't return error text)
We were down to a case where submitting the login form with the return key
failed since we did not implement either non-standard keyCode (IE-style) or
which (Netscape-style) UI event extension for getting the value of a key
press. The form submission code depended on sensing the value of the
key press by checking one of these properties.
Since the "which" property also can be used for mouse events, and fixing
this bug could be done by implementing either keyCode or which, I chose
to implement keyCode only.
* khtml/dom/dom2_events.cpp: Added keyCode function definition.
* khtml/dom/dom2_events.h: Added keyCode function declaration.
* khtml/ecma/kjs_events.cpp:
(DOMUIEvent::getValueProperty): Added new KeyCode attribute.
* khtml/ecma/kjs_events.h: New generated file.
* khtml/ecma/kjs_events.lut.h: Ditto.
* khtml/xml/dom2_eventsimpl.cpp:
(KeyEventImpl::KeyEventImpl): Fixed a bug in khtml that prevented the
m_keyVal field on KeyEventImpl from ever being set correctly.
I guess I am the first person ever to care about that value. :-)
=== Alexander-36 ===
2002-12-12 Darin Adler <darin@apple.com>
......
2002-12-12 Ken Kocienda <kocienda@apple.com>
Reviewed by NOBODY (OOPS!).
Final fix for this bug:
Radar 3062858 (REGRESSION: failed login at www.usaa.com doesn't return error text)
We were down to a case where submitting the login form with the return key
failed since we did not implement either non-standard keyCode (IE-style) or
which (Netscape-style) UI event extension for getting the value of a key
press. The form submission code depended on sensing the value of the
key press by checking one of these properties.
Since the "which" property also can be used for mouse events, and fixing
this bug could be done by implementing either keyCode or which, I chose
to implement keyCode only.
* khtml/dom/dom2_events.cpp: Added keyCode function definition.
* khtml/dom/dom2_events.h: Added keyCode function declaration.
* khtml/ecma/kjs_events.cpp:
(DOMUIEvent::getValueProperty): Added new KeyCode attribute.
* khtml/ecma/kjs_events.h: New generated file.
* khtml/ecma/kjs_events.lut.h: Ditto.
* khtml/xml/dom2_eventsimpl.cpp:
(KeyEventImpl::KeyEventImpl): Fixed a bug in khtml that prevented the
m_keyVal field on KeyEventImpl from ever being set correctly.
I guess I am the first person ever to care about that value. :-)
=== Alexander-36 ===
2002-12-12 Darin Adler <darin@apple.com>
......
......@@ -255,6 +255,18 @@ long UIEvent::detail() const
return static_cast<UIEventImpl*>(impl)->detail();
}
int UIEvent::keyCode() const
{
if (!impl)
throw DOMException(DOMException::INVALID_STATE_ERR);
KeyEventImpl *keyEvent = dynamic_cast<KeyEventImpl*>(impl);
if (keyEvent)
return keyEvent->keyVal();
else
return 0;
}
void UIEvent::initUIEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
......
......@@ -321,6 +321,11 @@ public:
*/
long detail() const;
/**
* Non-standard extension to support IE-style keyCode event property.
*
*/
int keyCode() const;
/**
* The initUIEvent method is used to initialize the value of a UIEvent
......
......@@ -339,9 +339,10 @@ Value KJS::getEventExceptionConstructor(ExecState *exec)
const ClassInfo DOMUIEvent::info = { "UIEvent", &DOMEvent::info, &DOMUIEventTable, 0 };
/*
@begin DOMUIEventTable 2
@begin DOMUIEventTable 3
view DOMUIEvent::View DontDelete|ReadOnly
detail DOMUIEvent::Detail DontDelete|ReadOnly
keyCode DOMUIEvent::KeyCode DontDelete|ReadOnly
@end
@begin DOMUIEventProtoTable 1
initUIEvent DOMUIEvent::InitUIEvent DontDelete|Function 5
......@@ -367,6 +368,8 @@ Value DOMUIEvent::getValueProperty(ExecState *exec, int token) const
return getDOMAbstractView(exec,static_cast<DOM::UIEvent>(event).view());
case Detail:
return Number(static_cast<DOM::UIEvent>(event).detail());
case KeyCode:
return Number(static_cast<DOM::UIEvent>(event).keyCode());
default:
kdWarning() << "Unhandled token in DOMUIEvent::getValueProperty : " << token << endl;
return Value();
......
......@@ -107,7 +107,7 @@ namespace KJS {
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { View, Detail, InitUIEvent };
enum { View, Detail, KeyCode, InitUIEvent };
DOM::UIEvent toUIEvent() const { return static_cast<DOM::UIEvent>(event); }
};
......
......@@ -76,12 +76,13 @@ const struct HashTable EventExceptionConstructorTable = { 2, 1, EventExceptionCo
namespace KJS {
const struct HashEntry DOMUIEventTableEntries[] = {
{ "detail", DOMUIEvent::Detail, DontDelete|ReadOnly, 0, &DOMUIEventTableEntries[3] },
{ 0, 0, 0, 0, 0 },
{ "view", DOMUIEvent::View, DontDelete|ReadOnly, 0, &DOMUIEventTableEntries[2] },
{ "detail", DOMUIEvent::Detail, DontDelete|ReadOnly, 0, 0 }
{ "view", DOMUIEvent::View, DontDelete|ReadOnly, 0, 0 },
{ "keyCode", DOMUIEvent::KeyCode, DontDelete|ReadOnly, 0, 0 }
};
const struct HashTable DOMUIEventTable = { 2, 3, DOMUIEventTableEntries, 2 };
const struct HashTable DOMUIEventTable = { 2, 4, DOMUIEventTableEntries, 3 };
}; // namespace
......
......@@ -500,6 +500,7 @@ void MouseEventImpl::initMouseEvent(const DOMString &typeArg,
//---------------------------------------------------------------------------------------------
KeyEventImpl::KeyEventImpl()
{
qKeyEvent = 0;
......@@ -674,7 +675,7 @@ KeyEventImpl::KeyEventImpl(QKeyEvent *key, AbstractViewImpl *view)
// m_keyVal should contain the unicode value
// of the pressed key if available.
if (m_virtKeyVal != DOM_VK_UNDEFINED && !key->text().isNull())
if (m_virtKeyVal == DOM_VK_UNDEFINED && !key->text().isNull())
m_keyVal = key->text().unicode()[0];
// m_numPad = ???
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment