[webkit-changes] cvs commit: LayoutTests/fast/forms radio_checked-expected.checksum radio_checked-expected.png radio_checked-expected.txt radio_checked.html

Adele adele at opensource.apple.com
Thu Nov 10 18:15:39 PST 2005


adele       05/11/10 18:15:39

  Modified:    .        ChangeLog
               khtml/html html_formimpl.cpp html_formimpl.h
               khtml/xml dom_docimpl.cpp dom_docimpl.h
               .        ChangeLog
  Added:       fast/forms radio_checked-expected.checksum
                        radio_checked-expected.png
                        radio_checked-expected.txt radio_checked.html
  Log:
  LayoutTests:
  
          Reviewed by Maciej.
  
          Layout test for <rdar://problem/4228997> selecting a new radio button does not automatically clear the previous selected (outside <form> element)
  
          * fast/forms/radio_checked-expected.checksum: Added.
          * fast/forms/radio_checked-expected.png: Added.
          * fast/forms/radio_checked-expected.txt: Added.
          * fast/forms/radio_checked.html: Added.
  
  WebCore:
  
          Reviewed by Maciej.
  
          -fixed <rdar://problem/4228997> selecting a new radio button does not automatically clear the previous selected (outside <form> element)
  
          Moved the radio button checking code to the document, since we shouldn't need a form to keep track of grouped radio buttons.
  
          Added
          * fast/forms/radio_checked.html
  
          * khtml/xml/dom_docimpl.h: Added m_selectedRadioButtons (now a two level hash table to account for forms and group names),
          radioButtonChecked, checkedRadioButtonForGroup, and removeRadioButtonGroup
          * khtml/xml/dom_docimpl.cpp:
          (DocumentImpl::DocumentImpl): initialize m_selectedRadioButtons
          (DocumentImpl::~DocumentImpl): delete m_selectedRadioButtons, and any of the inner hashtables if necessary
          (DocumentImpl::radioButtonChecked): moved from HTMLFormElementImpl.
          (DocumentImpl::checkedRadioButtonForGroup): ditto.
          (DocumentImpl::removeRadioButtonGroup): ditto.
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLFormElementImpl::HTMLFormElementImpl): removed initialization of m_selectedRadioButtons.
          (DOM::HTMLFormElementImpl::~HTMLFormElementImpl): removed deletion of m_selectedRadioButtons.
          (DOM::HTMLFormElementImpl::removeFormElement): now calls document's radio button functions
          (DOM::HTMLInputElementImpl::isKeyboardFocusable): ditto.
          (DOM::HTMLInputElementImpl::setInputType): ditto.
          (DOM::HTMLInputElementImpl::parseMappedAttribute): ditto.
          (DOM::HTMLInputElementImpl::setChecked): ditto.
          (DOM::HTMLInputElementImpl::preDispatchEventHandler): ditto.
          * khtml/html/html_formimpl.h: removed m_selectedRadioButtons, radioButtonChecked, checkedRadioButtonForGroup, and removeRadioButtonGroup
  
  Revision  Changes    Path
  1.353     +30 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.352
  retrieving revision 1.353
  diff -u -r1.352 -r1.353
  --- ChangeLog	11 Nov 2005 00:23:59 -0000	1.352
  +++ ChangeLog	11 Nov 2005 02:15:33 -0000	1.353
  @@ -1,3 +1,33 @@
  +2005-11-10  Adele Peterson  <adele at apple.com>
  +
  +        Reviewed by Maciej.
  +
  +        -fixed <rdar://problem/4228997> selecting a new radio button does not automatically clear the previous selected (outside <form> element)
  +
  +        Moved the radio button checking code to the document, since we shouldn't need a form to keep track of grouped radio buttons.
  +
  +        Added 
  +        * fast/forms/radio_checked.html
  +
  +        * khtml/xml/dom_docimpl.h: Added m_selectedRadioButtons (now a two level hash table to account for forms and group names),
  +        radioButtonChecked, checkedRadioButtonForGroup, and removeRadioButtonGroup
  +        * khtml/xml/dom_docimpl.cpp:
  +        (DocumentImpl::DocumentImpl): initialize m_selectedRadioButtons
  +        (DocumentImpl::~DocumentImpl): delete m_selectedRadioButtons, and any of the inner hashtables if necessary
  +        (DocumentImpl::radioButtonChecked): moved from HTMLFormElementImpl.
  +        (DocumentImpl::checkedRadioButtonForGroup): ditto.
  +        (DocumentImpl::removeRadioButtonGroup): ditto.
  +        * khtml/html/html_formimpl.cpp: 
  +        (DOM::HTMLFormElementImpl::HTMLFormElementImpl): removed initialization of m_selectedRadioButtons.
  +        (DOM::HTMLFormElementImpl::~HTMLFormElementImpl): removed deletion of m_selectedRadioButtons.
  +        (DOM::HTMLFormElementImpl::removeFormElement): now calls document's radio button functions
  +        (DOM::HTMLInputElementImpl::isKeyboardFocusable): ditto.
  +        (DOM::HTMLInputElementImpl::setInputType): ditto.
  +        (DOM::HTMLInputElementImpl::parseMappedAttribute): ditto.
  +        (DOM::HTMLInputElementImpl::setChecked): ditto.
  +        (DOM::HTMLInputElementImpl::preDispatchEventHandler): ditto.
  +        * khtml/html/html_formimpl.h: removed m_selectedRadioButtons, radioButtonChecked, checkedRadioButtonForGroup, and removeRadioButtonGroup
  +
   2005-11-10  David Harrison  <harrison at apple.com>
   
           Reviewed by Tim Omernick.
  
  
  
  1.203     +17 -51    WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.202
  retrieving revision 1.203
  diff -u -r1.202 -r1.203
  --- html_formimpl.cpp	8 Nov 2005 08:10:58 -0000	1.202
  +++ html_formimpl.cpp	11 Nov 2005 02:15:35 -0000	1.203
  @@ -122,7 +122,6 @@
       m_boundary = "----------0xKhTmLbOuNdArY";
       m_acceptcharset = "UNKNOWN";
       m_malformed = false;
  -    m_selectedRadioButtons = 0;
   }
   
   HTMLFormElementImpl::~HTMLFormElementImpl()
  @@ -133,8 +132,6 @@
           formElements[i]->m_form = 0;
       for (unsigned i = 0; i < imgElements.count(); ++i)
           imgElements[i]->m_form = 0;
  -        
  -    delete m_selectedRadioButtons;
   }
   
   #if APPLE_CHANGES
  @@ -684,36 +681,6 @@
           HTMLElementImpl::parseMappedAttribute(attr);
   }
   
  -void HTMLFormElementImpl::radioButtonChecked(HTMLInputElementImpl *caller)
  -{
  -    // Without a name, there is no group.
  -    if (caller->name().isEmpty())
  -        return;
  -
  -    // Uncheck the currently selected item
  -    if (!m_selectedRadioButtons)
  -        m_selectedRadioButtons = new NameToInputMap;
  -
  -    HTMLInputElementImpl* currentCheckedRadio = m_selectedRadioButtons->get(caller->name().impl());
  -    if (currentCheckedRadio && currentCheckedRadio != caller)
  -        currentCheckedRadio->setChecked(false);
  -        
  -    m_selectedRadioButtons->set(caller->name().impl(), caller);
  -}
  -
  -HTMLInputElementImpl* HTMLFormElementImpl::checkedRadioButtonForGroup(DOMStringImpl* name)
  -{
  -    if (!m_selectedRadioButtons)
  -        return 0;
  -    return m_selectedRadioButtons->get(name);
  -}
  -
  -void HTMLFormElementImpl::removeRadioButtonGroup(DOMStringImpl* name)
  -{
  -    if (m_selectedRadioButtons)
  -        m_selectedRadioButtons->remove(name);
  -}
  -
   template<class T> static void insertIntoVector(QPtrVector<T> &vec, unsigned pos, T* item)
   {
       unsigned size = vec.size();
  @@ -773,12 +740,11 @@
   
   void HTMLFormElementImpl::removeFormElement(HTMLGenericFormElementImpl *e)
   {
  -    if (m_selectedRadioButtons && !e->name().isEmpty()) {
  -        HTMLGenericFormElementImpl* currentCheckedRadio = m_selectedRadioButtons->get(e->name().impl());
  +    if (!e->name().isEmpty()) {
  +        HTMLGenericFormElementImpl* currentCheckedRadio = getDocument()->checkedRadioButtonForGroup(e->name().impl(), this);
           if (currentCheckedRadio == e)
  -            m_selectedRadioButtons->remove(e->name().impl());
  +            getDocument()->removeRadioButtonGroup(e->name().impl(), this);
       }
  -            
       removeFromVector(formElements, e);
   }
   
  @@ -1421,7 +1387,7 @@
           }
           
           // Allow keyboard focus if we're checked or if nothing in the group is checked.
  -        return checked() || !m_form->checkedRadioButtonForGroup(name().impl());
  +        return checked() || !getDocument()->checkedRadioButtonForGroup(name().impl(), m_form);
       }
       
       return true;
  @@ -1479,9 +1445,9 @@
               // Useful in case we were called from inside parseMappedAttribute.
               setAttribute(typeAttr, type());
           } else {
  -            if (m_form && m_type == RADIO && !name().isEmpty()) {
  -                if (m_form->checkedRadioButtonForGroup(name().impl()) == this)
  -                    m_form->removeRadioButtonGroup(name().impl());
  +            if (m_type == RADIO && !name().isEmpty()) {
  +                if (getDocument()->checkedRadioButtonForGroup(name().impl(), m_form) == this)
  +                    getDocument()->removeRadioButtonGroup(name().impl(), m_form);
               }
               bool wasAttached = m_attached;
               if (wasAttached)
  @@ -1501,8 +1467,8 @@
                   
               // If our type morphs into a radio button and we are checked, then go ahead
               // and signal this to the form.
  -            if (m_type == RADIO && checked() && m_form)
  -                m_form->radioButtonChecked(this);
  +            if (m_type == RADIO && checked())
  +                getDocument()->radioButtonChecked(this, m_form);
           }
       }
       m_haveType = true;
  @@ -1790,16 +1756,16 @@
       if (attr->name() == nameAttr) {
           if (m_type == RADIO && checked() && m_form) {
               // Remove the radio from its old group.
  -            if (m_form && m_type == RADIO && !m_name.isEmpty())
  -                m_form->removeRadioButtonGroup(m_name.impl());
  +            if (m_type == RADIO && !m_name.isEmpty())
  +                getDocument()->removeRadioButtonGroup(m_name.impl(), m_form);
           }
           
           // Update our cached reference to the name.
           m_name = attr->value();
           
           // Add it to its new group.
  -        if (m_type == RADIO && checked() && m_form)
  -            m_form->radioButtonChecked(this);
  +        if (m_type == RADIO && checked())
  +            getDocument()->radioButtonChecked(this, m_form);
       } else if (attr->name() == autocompleteAttr) {
           m_autocomplete = strcasecmp( attr->value(), "off" );
       } else if (attr->name() ==  typeAttr) {
  @@ -2161,8 +2127,8 @@
       if (checked() == _checked || (m_type == RADIO && name().isEmpty()))
           return;
   
  -    if (m_form && m_type == RADIO && _checked)
  -        m_form->radioButtonChecked(this);
  +    if (m_type == RADIO && _checked)
  +        getDocument()->radioButtonChecked(this, m_form);
   
       m_useDefaultChecked = false;
       m_checked = _checked;
  @@ -2323,14 +2289,14 @@
               }
           } else {
               // For radio buttons, store the current selected radio object.
  -            if (name().isEmpty() || checked() || !form())
  +            if (name().isEmpty() || checked())
                   return 0; // Unnamed radio buttons dont get checked. Checked buttons just stay checked.
                             // FIXME: Need to learn to work without a form.
   
               // We really want radio groups to end up in sane states, i.e., to have something checked.
               // Therefore if nothing is currently selected, we won't allow this action to be "undone", since
               // we want some object in the radio group to actually get selected.
  -            HTMLInputElementImpl* currRadio = form()->checkedRadioButtonForGroup(name().impl());
  +            HTMLInputElementImpl* currRadio = getDocument()->checkedRadioButtonForGroup(name().impl(), m_form);
               if (currRadio) {
                   // We have a radio button selected that is not us.  Cache it in our result field and ref it so
                   // that it can't be destroyed.
  
  
  
  1.95      +0 -7      WebCore/khtml/html/html_formimpl.h
  
  Index: html_formimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.h,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- html_formimpl.h	8 Nov 2005 08:10:59 -0000	1.94
  +++ html_formimpl.h	11 Nov 2005 02:15:35 -0000	1.95
  @@ -88,10 +88,6 @@
   
       virtual void parseMappedAttribute(MappedAttributeImpl *attr);
   
  -    void radioButtonChecked(HTMLInputElementImpl *caller);
  -    HTMLInputElementImpl* checkedRadioButtonForGroup(DOMStringImpl* name);
  -    void removeRadioButtonGroup(DOMStringImpl* name);
  -
       void registerFormElement(HTMLGenericFormElementImpl *);
       void removeFormElement(HTMLGenericFormElementImpl *);
       void registerImgElement(HTMLImageElementImpl *);
  @@ -145,9 +141,6 @@
       bool m_doingsubmit : 1;
       bool m_inreset : 1;
       bool m_malformed : 1;
  -
  -    typedef HashMap<DOMStringImpl*, HTMLInputElementImpl*, PointerHash<DOMStringImpl*> > NameToInputMap;
  -    NameToInputMap* m_selectedRadioButtons;
       
   private:
       void parseEnctype(const DOMString &);
  
  
  
  1.268     +62 -1     WebCore/khtml/xml/dom_docimpl.cpp
  
  Index: dom_docimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
  retrieving revision 1.267
  retrieving revision 1.268
  diff -u -r1.267 -r1.268
  --- dom_docimpl.cpp	8 Nov 2005 08:11:11 -0000	1.267
  +++ dom_docimpl.cpp	11 Nov 2005 02:15:36 -0000	1.268
  @@ -68,6 +68,7 @@
   #include "html/html_documentimpl.h"
   #include "html/html_headimpl.h"
   #include "html/html_imageimpl.h"
  +#include "html/html_formimpl.h"
   #include "htmlfactory.h"
   
   #include "cssvalues.h"
  @@ -385,6 +386,7 @@
       , m_hasDashboardRegions(false)
       , m_dashboardRegionsDirty(false)
       , m_selfOnlyRefCount(0)
  +    , m_selectedRadioButtons(0)
   #endif
   {
       document.resetSkippingRef(this);
  @@ -507,7 +509,7 @@
       if (m_implementation)
           m_implementation->deref();
       delete m_paintDeviceMetrics;
  -
  +    
       if (m_elementNames) {
           for (unsigned short id = 0; id < m_elementNameCount; id++)
               m_elementNames[id]->deref();
  @@ -550,6 +552,16 @@
           delete m_jsEditor;
           m_jsEditor = 0;
       }
  +    
  +    if (m_selectedRadioButtons) {
  +        FormToGroupMap::iterator end = m_selectedRadioButtons->end();
  +        for (FormToGroupMap::iterator it = m_selectedRadioButtons->begin(); it != end; ++it) {
  +            NameToInputMap *n = it->second;
  +            if (n)
  +                delete n;
  +        }
  +        delete m_selectedRadioButtons;
  +    }
   }
   
   void DocumentImpl::resetLinkColor()
  @@ -3197,6 +3209,55 @@
                                                                          namespaceURI.impl()), DOMString("").impl()), false);
   }
   
  +void DocumentImpl::radioButtonChecked(HTMLInputElementImpl *caller, HTMLFormElementImpl *form)
  +{
  +    // Without a name, there is no group.
  +    if (caller->name().isEmpty())
  +        return;
  +    
  +    if (!form)
  +        form = (HTMLFormElementImpl*) 1;
  +    // Uncheck the currently selected item
  +    if (!m_selectedRadioButtons)
  +        m_selectedRadioButtons = new FormToGroupMap;
  +    NameToInputMap* formRadioButtons = m_selectedRadioButtons->get(form);
  +    if (!formRadioButtons) {
  +        formRadioButtons = new NameToInputMap;
  +        m_selectedRadioButtons->set(form, formRadioButtons);
  +    }
  +    
  +    HTMLInputElementImpl* currentCheckedRadio = formRadioButtons->get(caller->name().impl());
  +    if (currentCheckedRadio && currentCheckedRadio != caller)
  +        currentCheckedRadio->setChecked(false);
  +
  +    formRadioButtons->set(caller->name().impl(), caller);
  +}
  +
  +HTMLInputElementImpl* DocumentImpl::checkedRadioButtonForGroup(DOMStringImpl* name, HTMLFormElementImpl *form)
  +{
  +    if (!m_selectedRadioButtons)
  +        return 0;
  +    NameToInputMap* formRadioButtons = m_selectedRadioButtons->get(form);
  +    if (!formRadioButtons)
  +        return 0;
  +    
  +    return formRadioButtons->get(name);
  +}
  +
  +void DocumentImpl::removeRadioButtonGroup(DOMStringImpl* name, HTMLFormElementImpl *form)
  +{
  +    if (m_selectedRadioButtons) {
  +        NameToInputMap* formRadioButtons = m_selectedRadioButtons->get(form);
  +        if (formRadioButtons) {
  +            formRadioButtons->remove(name);
  +            if (formRadioButtons->isEmpty()) {
  +                m_selectedRadioButtons->remove(form);
  +                delete formRadioButtons;
  +            }
  +        }
  +    }
  +}
  +
   SharedPtr<HTMLCollectionImpl> DocumentImpl::images()
   {
       return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_IMAGES));
  
  
  
  1.136     +11 -0     WebCore/khtml/xml/dom_docimpl.h
  
  Index: dom_docimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
  retrieving revision 1.135
  retrieving revision 1.136
  diff -u -r1.135 -r1.136
  --- dom_docimpl.h	8 Nov 2005 08:11:12 -0000	1.135
  +++ dom_docimpl.h	11 Nov 2005 02:15:36 -0000	1.136
  @@ -44,6 +44,8 @@
   #include "decoder.h"
   #endif
   
  +#include <kxmlcore/HashMap.h>
  +
   class QPaintDevice;
   class QPaintDeviceMetrics;
   class KHTMLView;
  @@ -89,7 +91,9 @@
       class HTMLCollectionImpl;
       class HTMLDocumentImpl;
       class HTMLElementImpl;
  +    class HTMLFormElementImpl;
       class HTMLImageLoader;
  +    class HTMLInputElementImpl;
       class HTMLMapElementImpl;
       class JSEditor;
       class NodeFilter;
  @@ -764,6 +768,10 @@
   
       void registerDisconnectedNodeWithEventListeners(NodeImpl *node);
       void unregisterDisconnectedNodeWithEventListeners(NodeImpl *node);
  +    
  +    void radioButtonChecked(HTMLInputElementImpl *caller, HTMLFormElementImpl *form);
  +    HTMLInputElementImpl* checkedRadioButtonForGroup(DOMStringImpl* name, HTMLFormElementImpl *form);
  +    void removeRadioButtonGroup(DOMStringImpl* name, HTMLFormElementImpl *form);
   
   private:
       void updateTitle();
  @@ -797,6 +805,9 @@
       bool m_hasDashboardRegions;
       bool m_dashboardRegionsDirty;
       int m_selfOnlyRefCount;
  +    typedef HashMap<DOMStringImpl*, HTMLInputElementImpl*, PointerHash<DOMStringImpl*> > NameToInputMap;
  +    typedef HashMap<HTMLFormElementImpl*, NameToInputMap*, PointerHash<HTMLFormElementImpl*> > FormToGroupMap;
  +    FormToGroupMap* m_selectedRadioButtons;
   #endif
   };
   
  
  
  
  1.81      +11 -0     LayoutTests/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/LayoutTests/ChangeLog,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- ChangeLog	10 Nov 2005 22:54:39 -0000	1.80
  +++ ChangeLog	11 Nov 2005 02:15:38 -0000	1.81
  @@ -1,3 +1,14 @@
  +2005-11-10  Adele Peterson  <adele at apple.com>
  +
  +        Reviewed by Maciej.
  +
  +        Layout test for <rdar://problem/4228997> selecting a new radio button does not automatically clear the previous selected (outside <form> element)
  +
  +        * fast/forms/radio_checked-expected.checksum: Added.
  +        * fast/forms/radio_checked-expected.png: Added.
  +        * fast/forms/radio_checked-expected.txt: Added.
  +        * fast/forms/radio_checked.html: Added.
  +
   2005-11-10  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by ggaren.
  
  
  
  1.1                  LayoutTests/fast/forms/radio_checked-expected.checksum
  
  Index: radio_checked-expected.checksum
  ===================================================================
  7d75214f705724863cdfe09cfd043682
  
  
  1.1                  LayoutTests/fast/forms/radio_checked-expected.png
  
  	<<Binary file>>
  
  
  1.1                  LayoutTests/fast/forms/radio_checked-expected.txt
  
  Index: radio_checked-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock {P} at (0,0) size 784x18
          RenderText {TEXT} at (0,0) size 502x18
            text run at (0,0) width 502: "This test should make sure that only one button per group, per form, is checked."
        RenderBlock (anonymous) at (0,34) size 784x19
          RenderText {TEXT} at (0,0) size 322x18
            text run at (0,0) width 322: "These buttons are in group1 but don't have a form. "
          RenderBlock {INPUT} at (325,3) size 12x13
          RenderText {TEXT} at (340,0) size 4x18
            text run at (340,0) width 4: " "
          RenderBlock {INPUT} at (347,3) size 12x13
          RenderText {TEXT} at (0,0) size 0x0
        RenderBlock {FORM} at (0,53) size 784x56
          RenderBR {BR} at (0,0) size 0x18
          RenderText {TEXT} at (0,18) size 289x18
            text run at (0,18) width 289: "These buttons are in group1, in the first form. "
          RenderBlock {INPUT} at (292,21) size 12x13
          RenderText {TEXT} at (307,18) size 4x18
            text run at (307,18) width 4: " "
          RenderBlock {INPUT} at (314,21) size 12x13
          RenderText {TEXT} at (329,18) size 4x18
            text run at (329,18) width 4: " "
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,37) size 289x18
            text run at (0,37) width 289: "These buttons are in group2, in the first form. "
          RenderBlock {INPUT} at (292,40) size 12x13
          RenderText {TEXT} at (307,37) size 4x18
            text run at (307,37) width 4: " "
          RenderBlock {INPUT} at (314,40) size 12x13
          RenderText {TEXT} at (0,0) size 0x0
        RenderBlock (anonymous) at (0,125) size 784x19
          RenderText {TEXT} at (0,0) size 322x18
            text run at (0,0) width 322: "These buttons are in group1 but don't have a form. "
          RenderBlock {INPUT} at (325,3) size 12x13
          RenderText {TEXT} at (340,0) size 4x18
            text run at (340,0) width 4: " "
          RenderBlock {INPUT} at (347,3) size 12x13
          RenderText {TEXT} at (0,0) size 0x0
        RenderBlock {FORM} at (0,144) size 784x37
          RenderBR {BR} at (0,0) size 0x18
          RenderText {TEXT} at (0,18) size 309x18
            text run at (0,18) width 309: "These buttons are in group2, in the second form. "
          RenderBlock {INPUT} at (312,21) size 12x13
          RenderText {TEXT} at (327,18) size 4x18
            text run at (327,18) width 4: " "
          RenderBlock {INPUT} at (334,21) size 12x13
          RenderText {TEXT} at (0,0) size 0x0
        RenderBlock {DIV} at (0,197) size 784x18
          RenderText {TEXT} at (0,0) size 108x18
            text run at (0,0) width 108: "TEST PASSED."
  
  
  
  1.1                  LayoutTests/fast/forms/radio_checked.html
  
  Index: radio_checked.html
  ===================================================================
  <html>
  <head>
  <script>
      function checkIt() {
      var i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
      
      i1 = document.getElementById('in1').checked;
      i2 = document.getElementById('in2').checked;
      i3 = document.getElementById('in3').checked;
      i4 = document.getElementById('in4').checked;
      i5 = document.getElementById('in5').checked;
      i6 = document.getElementById('in6').checked;
      i7 = document.getElementById('in7').checked;
      i8 = document.getElementById('in8').checked;
      i9 = document.getElementById('in9').checked;
      i10 = document.getElementById('in10').checked;
      
          if (i1 || i2 || i7 || !i8 || i3 || !i4 || i5 || !i6 || i9 || !i10) {
              document.getElementById('result').innerHTML = "TEST FAILED.";
          } else {
              document.getElementById('result').innerHTML = "TEST PASSED.";
          }
      }
  </script>
  </head>
  <body onload="checkIt()">
      <p>This test should make sure that only one button per group, per form, is checked.
      </p>
      These buttons are in group1 but don't have a form.
      <input type="radio" name="group1" id='in1' checked = true/>
      <input type="radio" name="group1" id='in2' checked = true/>
      <form>
      <br>These buttons are in group1, in the first form.
      <input type="radio" name="group1" id='in3' checked = true/>
      <input type="radio" name="group1" id='in4' checked = true/>
      <br>These buttons are in group2, in the first form.
      <input type="radio" name="group2" id='in5' checked = true/>
      <input type="radio" name="group2" id='in6' checked = true/>
      </form>
      These buttons are in group1 but don't have a form.
      <input type="radio" name="group1" id='in7' checked = true/>
      <input type="radio" name="group1" id='in8' checked = true/>
      <form>
      <br>These buttons are in group2, in the second form.
      <input type="radio" name="group2" id='in9' checked = true/>
      <input type="radio" name="group2" id='in10' checked = true/>
      </form>
      <div id="result"></div>
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list