[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:08:52 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit bb0e4a924f3eb052058ad2751e33cd113854ba0e
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 3 22:01:57 2003 +0000
Reviewed by John
Fix for this bug:
<rdar://problem/3260780>: hitting return in a text field submits
form without running onclick handler for submit button
* khtml/html/html_formimpl.cpp:
(HTMLFormElementImpl::performSubmitClick): Refactored this function to
be more generic, so that text fields can use it, too.
(HTMLInputElementImpl::defaultEventHandler): Removed code to check
for a submit button, and merged this code into new performSubmitClick.
(HTMLSelectElementImpl::defaultEventHandler): Ditto.
* khtml/html/html_formimpl.h: Removed declaration for simulateButtonClickForEvent.
Added declaration for performSubmitClick.
* khtml/rendering/render_form.cpp:
(RenderLineEdit::slotReturnPressed): Now calls performSubmitClick rather
than prepareSubmit on the form. This is the key piece for the bug fix.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2721bc7..335bd1b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,27 @@
Reviewed by John
+ Fix for this bug:
+
+ <rdar://problem/3260780>: hitting return in a text field submits
+ form without running onclick handler for submit button
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLFormElementImpl::performSubmitClick): Refactored this function to
+ be more generic, so that text fields can use it, too.
+ (HTMLInputElementImpl::defaultEventHandler): Removed code to check
+ for a submit button, and merged this code into new performSubmitClick.
+ (HTMLSelectElementImpl::defaultEventHandler): Ditto.
+ * khtml/html/html_formimpl.h: Removed declaration for simulateButtonClickForEvent.
+ Added declaration for performSubmitClick.
+ * khtml/rendering/render_form.cpp:
+ (RenderLineEdit::slotReturnPressed): Now calls performSubmitClick rather
+ than prepareSubmit on the form. This is the key piece for the bug fix.
+
+2003-11-03 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by John
+
Fix for this bug:
<rdar://problem/3470342>: focus rings are shown for links in
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 1213673..4afdfc2 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -142,6 +142,33 @@ long HTMLFormElementImpl::length() const
return len;
}
+#if APPLE_CHANGES
+void HTMLFormElementImpl::performSubmitClick()
+{
+ QPtrListIterator<HTMLGenericFormElementImpl> it(formElements);
+ for (; it.current(); ++it) {
+ if (it.current()->id() == ID_INPUT) {
+ HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(it.current());
+ if (element->isSuccessfulSubmitButton() && element->renderer()) {
+ if (element->inputType() == HTMLInputElementImpl::IMAGE) {
+ // have to send simulated clicks differently for image types
+ // since they do not have a widget
+ int x = 0;
+ int y = 0;
+ element->renderer()->absolutePosition(x,y);
+ QMouseEvent e2(QEvent::MouseButtonRelease, QPoint(x,y), Qt::LeftButton, 0);
+ element->dispatchMouseEvent(&e2, EventImpl::KHTML_CLICK_EVENT);
+ }
+ else {
+ static_cast<QButton *>(static_cast<RenderWidget *>(element->renderer())->widget())->simulateClick();
+ }
+ break;
+ }
+ }
+ }
+}
+#endif
+
static QCString encodeCString(const QCString& e)
{
// http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
@@ -1670,32 +1697,6 @@ void HTMLInputElementImpl::focus()
getDocument()->setFocusNode(this);
}
-#if APPLE_CHANGES
-void HTMLInputElementImpl::simulateButtonClickForEvent(EventImpl *evt)
-{
- assert(m_type == CHECKBOX || m_type == IMAGE || m_type == RADIO ||
- m_type == RESET || m_type == SUBMIT);
-
- if (m_render) {
- if (m_type == IMAGE) {
- // have to send simulated clicks differently for image types
- // since they to not have a widget
- int x = 0;
- int y = 0;
- if (m_render)
- m_render->absolutePosition(x,y);
- QMouseEvent e2(QEvent::MouseButtonRelease, QPoint(x,y), Qt::LeftButton, 0);
- dispatchMouseEvent(&e2, EventImpl::KHTML_CLICK_EVENT);
- }
- else {
- static_cast<QButton *>(static_cast<RenderWidget *>(m_render)->widget())->simulateClick();
- }
- }
-
- evt->setDefaultHandled();
-}
-#endif
-
void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
{
if (evt->isMouseEvent() &&
@@ -1751,24 +1752,19 @@ void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
case SUBMIT:
// simulate mouse click for spacebar, return, and enter
if (key == "U+000020" || key == "U+00000d" || key == "Enter") {
- simulateButtonClickForEvent(evt);
+ m_form->performSubmitClick();
+ evt->setDefaultHandled();
}
break;
case CHECKBOX:
case RADIO:
+ case TEXT:
+ case PASSWORD:
// for return or enter, find the first successful image or submit element
// send it a simulated mouse click
if (key == "U+00000d" || key == "Enter") {
- QPtrListIterator<HTMLGenericFormElementImpl> it(m_form->formElements);
- for (; it.current(); ++it) {
- if (it.current()->id() == ID_INPUT) {
- HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(it.current());
- if (element->isSuccessfulSubmitButton()) {
- element->simulateButtonClickForEvent(evt);
- break;
- }
- }
- }
+ m_form->performSubmitClick();
+ evt->setDefaultHandled();
}
break;
default:
@@ -2298,16 +2294,8 @@ void HTMLSelectElementImpl::defaultEventHandler(EventImpl *evt)
DOMString key = static_cast<KeyboardEventImpl *>(evt)->keyIdentifier();
if (key == "U+00000d" || key == "Enter") {
- QPtrListIterator<HTMLGenericFormElementImpl> it(m_form->formElements);
- for (; it.current(); ++it) {
- if (it.current()->id() == ID_INPUT) {
- HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(it.current());
- if (element->isSuccessfulSubmitButton()) {
- element->simulateButtonClickForEvent(evt);
- break;
- }
- }
- }
+ m_form->performSubmitClick();
+ evt->setDefaultHandled();
}
}
HTMLGenericFormElementImpl::defaultEventHandler(evt);
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 37444ae..76f1e10 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -97,6 +97,10 @@ public:
void setMalformed(bool malformed) { m_malformed = malformed; }
virtual bool isMalformed() { return m_malformed; }
+#if APPLE_CHANGES
+ void performSubmitClick();
+#endif
+
static void i18nData();
friend class HTMLFormElement;
@@ -322,11 +326,6 @@ public:
DOMString altText() const;
-#if APPLE_CHANGES
-private:
- void simulateButtonClickForEvent(EventImpl *evt);
-#endif
-
protected:
DOMString m_value;
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index e0a5049..9825853 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -513,7 +513,7 @@ void RenderLineEdit::slotReturnPressed()
HTMLFormElementImpl* fe = element()->form();
if ( fe )
- fe->prepareSubmit();
+ fe->performSubmitClick();
}
void RenderLineEdit::handleFocusOut()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list