[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:52:22 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 81e163dda2082801ee1d03afeb91353c29b5d25f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 19 20:58:56 2003 +0000

            Reviewed by Dave.
    
            - fixed 3343681 -- clicking on a disabled submit button submits the form!
    
            This turned out to be a problem with code in dispatchGenericEvent that sent
            DOMActivate events even when the form element was disabled.
    
            * khtml/xml/dom_nodeimpl.h: Add virtual disabled() member function.
            * khtml/xml/dom_nodeimpl.cpp:
            (NodeImpl::dispatchGenericEvent): Don't send DOM activate events for disabled elements.
            (NodeImpl::handleLocalEvents): Don't send mouse events for disabled elements. But we do
            want those events to pass through the bubble and capture phases, just avoid triggering
            any listeners on this node itself.
            (NodeImpl::disabled): Added default implementation that returns false.
    
            * khtml/html/html_formimpl.h: Removed the disabled() function's inline implementation
            since it's now virtual and it's not helpful to inline virtual functions.
            * khtml/html/html_formimpl.cpp:
            (HTMLGenericFormElementImpl::disabled): Moved this method into the .cpp file since it's
            now virtual and it's not helpful to inline virtual functions.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4844 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1926f1f..ac55a40 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,26 @@
+2003-08-19  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3343681 -- clicking on a disabled submit button submits the form!
+
+        This turned out to be a problem with code in dispatchGenericEvent that sent
+        DOMActivate events even when the form element was disabled.
+
+        * khtml/xml/dom_nodeimpl.h: Add virtual disabled() member function.
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::dispatchGenericEvent): Don't send DOM activate events for disabled elements.
+        (NodeImpl::handleLocalEvents): Don't send mouse events for disabled elements. But we do
+        want those events to pass through the bubble and capture phases, just avoid triggering
+        any listeners on this node itself.
+        (NodeImpl::disabled): Added default implementation that returns false.
+
+        * khtml/html/html_formimpl.h: Removed the disabled() function's inline implementation
+        since it's now virtual and it's not helpful to inline virtual functions.
+        * khtml/html/html_formimpl.cpp:
+        (HTMLGenericFormElementImpl::disabled): Moved this method into the .cpp file since it's
+        now virtual and it's not helpful to inline virtual functions.
+
 2003-08-18  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1926f1f..ac55a40 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,26 @@
+2003-08-19  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3343681 -- clicking on a disabled submit button submits the form!
+
+        This turned out to be a problem with code in dispatchGenericEvent that sent
+        DOMActivate events even when the form element was disabled.
+
+        * khtml/xml/dom_nodeimpl.h: Add virtual disabled() member function.
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::dispatchGenericEvent): Don't send DOM activate events for disabled elements.
+        (NodeImpl::handleLocalEvents): Don't send mouse events for disabled elements. But we do
+        want those events to pass through the bubble and capture phases, just avoid triggering
+        any listeners on this node itself.
+        (NodeImpl::disabled): Added default implementation that returns false.
+
+        * khtml/html/html_formimpl.h: Removed the disabled() function's inline implementation
+        since it's now virtual and it's not helpful to inline virtual functions.
+        * khtml/html/html_formimpl.cpp:
+        (HTMLGenericFormElementImpl::disabled): Moved this method into the .cpp file since it's
+        now virtual and it's not helpful to inline virtual functions.
+
 2003-08-18  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 8740101..56963c7 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -791,6 +791,11 @@ void HTMLGenericFormElementImpl::onChange()
     dispatchHTMLEvent(EventImpl::CHANGE_EVENT,true,false);
 }
 
+bool HTMLGenericFormElementImpl::disabled() const
+{
+    return m_disabled;
+}
+
 void HTMLGenericFormElementImpl::setDisabled( bool _disabled )
 {
     if ( m_disabled != _disabled ) {
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 3252043..52e256a 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -145,7 +145,7 @@ public:
     void onSelect();
     void onChange();
 
-    bool disabled() const { return m_disabled; }
+    virtual bool disabled() const;
     void setDisabled(bool _disabled);
 
     virtual bool isSelectable() const;
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index becdbeb..2431707 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -567,7 +567,7 @@ bool NodeImpl::dispatchGenericEvent( EventImpl *evt, int &/*exceptioncode */)
     // In the case of a mouse click, also send a DOMActivate event, which causes things like form submissions
     // to occur. Note that this only happens for _real_ mouse clicks (for which we get a KHTML_CLICK_EVENT or
     // KHTML_DBLCLICK_EVENT), not the standard DOM "click" event that could be sent from js code.
-    if (!evt->defaultPrevented())
+    if (!evt->defaultPrevented() && !disabled())
         if (evt->id() == EventImpl::KHTML_CLICK_EVENT)
             dispatchUIEvent(EventImpl::DOMACTIVATE_EVENT, 1);
         else if (evt->id() == EventImpl::KHTML_DBLCLICK_EVENT)
@@ -753,6 +753,9 @@ void NodeImpl::handleLocalEvents(EventImpl *evt, bool useCapture)
     if (!m_regdListeners)
         return;
 
+    if (disabled() && evt->isMouseEvent())
+        return;
+
     QPtrList<RegisteredEventListener> listenersCopy = *m_regdListeners;
     QPtrListIterator<RegisteredEventListener> it(listenersCopy);
     Event ev = evt;
@@ -1019,6 +1022,11 @@ void NodeImpl::childrenChanged()
 {
 }
 
+bool NodeImpl::disabled() const
+{
+    return false;
+}
+
 bool NodeImpl::isReadOnly()
 {
     // Entity & Entity Reference nodes and their descendants are read-only
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index f2a75ff..4822a46 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -244,6 +244,12 @@ public:
      */
     virtual void defaultEventHandler(EventImpl *evt);
 
+    /**
+     * Used for disabled form elements; if true, prevents mouse events from being dispatched
+     * to event listeners, and prevents DOMActivate events from being sent at all.
+     */
+    virtual bool disabled() const;
+
     virtual bool isReadOnly();
     virtual bool childTypeAllowed( unsigned short /*type*/ ) { return false; }
     virtual unsigned long childNodeCount();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list