[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:49:18 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6a96b507c7881620419b5ec9602113bb7cf9eb89
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 30 00:39:43 2003 +0000

            Reviewed by Dave.
    
            - fixed 3311756 -- REGRESSION (76-77): radio buttons in different forms act as the same set
    	by rolling out old fix for 3158411 -- radio button groups are supposed to be per-form
            The real bug at flyglobespan.com is what's fixed below.
    
            * khtml/html/html_formimpl.h:
            * khtml/html/html_formimpl.cpp:
            (HTMLFormElementImpl::radioClicked):
            (HTMLInputElementImpl::~HTMLInputElementImpl):
            (HTMLInputElementImpl::setType):
            (HTMLInputElementImpl::parseAttribute):
            (HTMLInputElementImpl::attach):
            (HTMLInputElementImpl::reset):
            (HTMLInputElementImpl::setChecked):
            (HTMLInputElementImpl::isEditable):
            * khtml/xml/dom_docimpl.cpp:
            * khtml/xml/dom_docimpl.h:
    
            - fixed 3158411 -- re-opened form is one form in other browsers, multiple forms in Safari
            (flyglobespan.com)
    
            * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Don't open a form if we encounter
            a form element inside another form.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1460d5f..e8b8d76 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,30 @@
+2003-07-29  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3311756 -- REGRESSION (76-77): radio buttons in different forms act as the same set
+	by rolling out old fix for 3158411 -- radio button groups are supposed to be per-form
+        The real bug at flyglobespan.com is what's fixed below.
+
+        * khtml/html/html_formimpl.h:
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::radioClicked):
+        (HTMLInputElementImpl::~HTMLInputElementImpl):
+        (HTMLInputElementImpl::setType):
+        (HTMLInputElementImpl::parseAttribute):
+        (HTMLInputElementImpl::attach):
+        (HTMLInputElementImpl::reset):
+        (HTMLInputElementImpl::setChecked):
+        (HTMLInputElementImpl::isEditable):
+        * khtml/xml/dom_docimpl.cpp:
+        * khtml/xml/dom_docimpl.h:
+
+        - fixed 3158411 -- re-opened form is one form in other browsers, multiple forms in Safari
+        (flyglobespan.com)
+
+        * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Don't open a form if we encounter
+        a form element inside another form.
+
 2003-07-29  John Sullivan  <sullivan at apple.com>
 
 	- fixed 3346707 -- AutoFill does not fill in email address on 
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1460d5f..e8b8d76 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,30 @@
+2003-07-29  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3311756 -- REGRESSION (76-77): radio buttons in different forms act as the same set
+	by rolling out old fix for 3158411 -- radio button groups are supposed to be per-form
+        The real bug at flyglobespan.com is what's fixed below.
+
+        * khtml/html/html_formimpl.h:
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::radioClicked):
+        (HTMLInputElementImpl::~HTMLInputElementImpl):
+        (HTMLInputElementImpl::setType):
+        (HTMLInputElementImpl::parseAttribute):
+        (HTMLInputElementImpl::attach):
+        (HTMLInputElementImpl::reset):
+        (HTMLInputElementImpl::setChecked):
+        (HTMLInputElementImpl::isEditable):
+        * khtml/xml/dom_docimpl.cpp:
+        * khtml/xml/dom_docimpl.h:
+
+        - fixed 3158411 -- re-opened form is one form in other browsers, multiple forms in Safari
+        (flyglobespan.com)
+
+        * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Don't open a form if we encounter
+        a form element inside another form.
+
 2003-07-29  John Sullivan  <sullivan at apple.com>
 
 	- fixed 3346707 -- AutoFill does not fill in email address on 
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 9267b7e..8426b68 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -638,6 +638,18 @@ void HTMLFormElementImpl::parseAttribute(AttributeImpl *attr)
     }
 }
 
+void HTMLFormElementImpl::radioClicked( HTMLGenericFormElementImpl *caller )
+{
+    for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); it.current(); ++it) {
+        HTMLGenericFormElementImpl *current = it.current();
+        if (current->id() == ID_INPUT &&
+            static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::RADIO &&
+            current != caller && current->form() == caller->form() && current->name() == caller->name()) {
+            static_cast<HTMLInputElementImpl*>(current)->setChecked(false);
+        }
+    }
+}
+
 void HTMLFormElementImpl::registerFormElement(HTMLGenericFormElementImpl *e)
 {
     formElements.append(e);
@@ -1084,7 +1096,6 @@ HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl
 
 HTMLInputElementImpl::~HTMLInputElementImpl()
 {
-    removeCheckedRadioButtonFromDocument();
     if (getDocument()) getDocument()->deregisterMaintainsState(this);
 }
 
@@ -1129,9 +1140,7 @@ void HTMLInputElementImpl::setType(const DOMString& t)
             // Useful in case we were called from inside parseAttribute.
             setAttribute(ATTR_TYPE, type());
         } else {
-            removeCheckedRadioButtonFromDocument();
             m_type = newType;
-            addCheckedRadioButtonToDocument();
         }
     }
     m_haveType = true;
@@ -1220,9 +1229,7 @@ void HTMLInputElementImpl::parseAttribute(AttributeImpl *attr)
             setChanged();     // at the default value right now.
         break;
     case ATTR_CHECKED:
-        removeCheckedRadioButtonFromDocument();
         m_defaultChecked = attr->val();
-        addCheckedRadioButtonToDocument();
         if (m_useDefaultChecked)   // We only need to setChanged if the form is looking
             setChanged();          // at the default checked state right now.
         break;
@@ -1277,11 +1284,6 @@ void HTMLInputElementImpl::parseAttribute(AttributeImpl *attr)
         setHTMLEventListener(EventImpl::CHANGE_EVENT,
             getDocument()->createHTMLEventListener(attr->value().string()));
         break;
-    case ATTR_NAME:
-	removeCheckedRadioButtonFromDocument();
-        HTMLGenericFormElementImpl::parseAttribute(attr);
-	addCheckedRadioButtonToDocument();
-	break;
     default:
         HTMLGenericFormElementImpl::parseAttribute(attr);
     }
@@ -1347,9 +1349,7 @@ void HTMLInputElementImpl::attach()
                 setAttribute(ATTR_VALUE, nvalue);
         }
 
-        removeCheckedRadioButtonFromDocument();
         m_defaultChecked = (getAttribute(ATTR_CHECKED) != 0);
-        addCheckedRadioButtonToDocument();
         
         m_inited = true;
     }
@@ -1575,19 +1575,19 @@ bool HTMLInputElementImpl::encoding(const QTextCodec* codec, khtml::encodingList
 void HTMLInputElementImpl::reset()
 {
     setValue(DOMString());
-    removeCheckedRadioButtonFromDocument();
     m_useDefaultChecked = true;
     m_checked = m_defaultChecked;
-    addCheckedRadioButtonToDocument();
 }
 
 void HTMLInputElementImpl::setChecked(bool _checked)
 {
     if (checked() == _checked) return;
-    removeCheckedRadioButtonFromDocument();
+
+    if (m_form && m_type == RADIO && _checked && !name().isEmpty())
+        m_form->radioClicked(this);
+
     m_useDefaultChecked = false;
     m_checked = _checked;
-    addCheckedRadioButtonToDocument();
     setChanged();
 }
 
@@ -1679,30 +1679,6 @@ bool HTMLInputElementImpl::isEditable()
     return ((m_type == TEXT) || (m_type == PASSWORD) || (m_type == ISINDEX) || (m_type == FILE));
 }
 
-void HTMLInputElementImpl::setName(const DOMString& name)
-{
-    removeCheckedRadioButtonFromDocument();
-    HTMLGenericFormElementImpl::setName(name);
-    addCheckedRadioButtonToDocument();
-}
-
-bool HTMLInputElementImpl::isCheckedRadioButtonForDocument() const
-{
-    return checked() && m_type == RADIO && !name().isEmpty() && getDocument();
-}
-
-void HTMLInputElementImpl::addCheckedRadioButtonToDocument()
-{
-    if (isCheckedRadioButtonForDocument())
-        getDocument()->addCheckedRadioButton(this);
-}
-
-void HTMLInputElementImpl::removeCheckedRadioButtonFromDocument()
-{
-    if (isCheckedRadioButtonForDocument())
-        getDocument()->removeCheckedRadioButton(this);
-}
-
 // -------------------------------------------------------------------------
 
 HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentPtr *doc)
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index bf50530..3252043 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -82,6 +82,8 @@ public:
 
     virtual void parseAttribute(AttributeImpl *attr);
 
+    void radioClicked( HTMLGenericFormElementImpl *caller );
+
     void registerFormElement(khtml::RenderFormElement *);
     void removeFormElement(khtml::RenderFormElement *);
 
@@ -155,7 +157,7 @@ public:
     virtual void recalcStyle( StyleChange );
 
     DOMString name() const;
-    virtual void setName(const DOMString& name);
+    void setName(const DOMString& name);
 
     virtual bool isGenericFormElement() const { return true; }
 
@@ -292,7 +294,6 @@ public:
     void click();
 
     virtual void parseAttribute(AttributeImpl *attr);
-    virtual void setName(const DOMString& name);
 
     virtual void attach();
     virtual bool rendererIsNeeded(khtml::RenderStyle *);
@@ -330,12 +331,6 @@ protected:
     bool m_haveType : 1;
     bool m_activeSubmit : 1;
     bool m_autocomplete : 1;
-
-private:
-
-    bool isCheckedRadioButtonForDocument() const;
-    void addCheckedRadioButtonToDocument();
-    void removeCheckedRadioButtonFromDocument();
 };
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index 54688b2..0cb08c6 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -804,10 +804,12 @@ NodeImpl *KHTMLParser::getElement(Token* t)
 
 // form elements
     case ID_FORM:
-        // close all open forms...
-        popBlock(ID_FORM);
-        form = new HTMLFormElementImpl(document);
-        n = form;
+        if (!form) {
+            // Only create a new form if we're not already inside one.
+            // This is consistent with other browsers' behavior.
+            form = new HTMLFormElementImpl(document);
+            n = form;
+        }
         break;
     case ID_BUTTON:
         n = new HTMLButtonElementImpl(document, form);
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 03a1817..bfb9df6 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -2264,28 +2264,6 @@ void DocumentImpl::timerEvent(QTimerEvent *)
     dispatchImageLoadEventsNow();
 }
 
-void DocumentImpl::addCheckedRadioButton(HTMLInputElementImpl *b)
-{
-    QString name = b->name().string();
-    
-    // Uncheck the old checked radio button.
-    QMap<QString, HTMLInputElementImpl *>::ConstIterator i = m_checkedRadioButtons.find(name);
-    if (i != m_checkedRadioButtons.end()) {
-        assert(i.data() != b);
-        i.data()->setChecked(false);
-        assert(m_checkedRadioButtons.find(name) == m_checkedRadioButtons.end());
-    }
-    
-    m_checkedRadioButtons.insert(name, b);
-}
-
-void DocumentImpl::removeCheckedRadioButton(HTMLInputElementImpl *b)
-{
-    QString name = b->name().string();
-    assert(m_checkedRadioButtons[name] == b);
-    m_checkedRadioButtons.remove(name);
-}
-
 ElementImpl *DocumentImpl::ownerElement()
 {
     KHTMLView *childView = view();
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index a0cbd56..6c88c75 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -76,7 +76,6 @@ namespace DOM {
     class GenericRONamedNodeMapImpl;
     class HTMLDocumentImpl;
     class HTMLElementImpl;
-    class HTMLInputElementImpl;
     class NodeFilter;
     class NodeFilterImpl;
     class NodeIteratorImpl;
@@ -436,9 +435,6 @@ public:
     void removeImage(khtml::RenderImage *);
     virtual void timerEvent(QTimerEvent *);
     
-    void addCheckedRadioButton(HTMLInputElementImpl *);
-    void removeCheckedRadioButton(HTMLInputElementImpl *);
-    
     // Returns the owning element in the parent document.
     // Returns 0 if this is the top level document.
     ElementImpl *ownerElement();
@@ -525,8 +521,6 @@ protected:
     QPtrList<khtml::RenderImage> m_imageLoadEventDispatchingList;
     int m_imageLoadEventTimer;
 
-    QMap<QString, HTMLInputElementImpl *> m_checkedRadioButtons;
-
     NodeImpl* m_cssTarget;
     
 #if APPLE_CHANGES

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list