[webkit-changes] cvs commit: WebCore/khtml/html html_formimpl.cpp

Vicki vicki at opensource.apple.com
Tue Jul 12 10:52:48 PDT 2005


vicki       05/07/12 10:52:48

  Modified:    .        Tag: Safari-1-3-branch ChangeLog
               khtml/html Tag: Safari-1-3-branch html_formimpl.cpp
  Log:
  	- merge this fix from HEAD
  
      2005-05-30  Darin Adler  <darin at apple.com>
  
          Reviewed by John.
  
          - fixed <rdar://problem/4105097> REGRESSION (138-139): Hitting Enter on a checkbox toggles check mark
  	instead of submitting form
  
          * khtml/html/html_formimpl.cpp: (DOM::HTMLInputElementImpl::defaultEventHandler): Separate the checks for
          the space bar and the Enter key and make Enter submit the form on a check box or radio button.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4108.4.20 +14 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4108.4.19
  retrieving revision 1.4108.4.20
  diff -u -r1.4108.4.19 -r1.4108.4.20
  --- ChangeLog	12 Jul 2005 17:41:57 -0000	1.4108.4.19
  +++ ChangeLog	12 Jul 2005 17:52:38 -0000	1.4108.4.20
  @@ -2,6 +2,20 @@
   
   	- merge this fix from HEAD
   
  +    2005-05-30  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by John.
  +
  +        - fixed <rdar://problem/4105097> REGRESSION (138-139): Hitting Enter on a checkbox toggles check mark 
  +	instead of submitting form
  +
  +        * khtml/html/html_formimpl.cpp: (DOM::HTMLInputElementImpl::defaultEventHandler): Separate the checks for
  +        the space bar and the Enter key and make Enter submit the form on a check box or radio button.
  +
  +2005-07-12  Vicki Murley  <vicki at apple.com>
  +
  +	- merge this fix from HEAD
  +
       2005-04-25  Darin Adler  <darin at apple.com>
   
           Reviewed by John.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.156.4.2 +57 -27    WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.156.4.1
  retrieving revision 1.156.4.2
  diff -u -r1.156.4.1 -r1.156.4.2
  --- html_formimpl.cpp	12 Jul 2005 00:47:23 -0000	1.156.4.1
  +++ html_formimpl.cpp	12 Jul 2005 17:52:48 -0000	1.156.4.2
  @@ -2088,34 +2088,64 @@
       // Use key press event here since sending simulated mouse events
       // on key down blocks the proper sending of the key press event.
       if (evt->id() == EventImpl::KEYPRESS_EVENT && evt->isKeyboardEvent()) {
  +        bool clickElement = false;
  +        bool clickDefaultFormButton = false;
  +
           DOMString key = static_cast<KeyboardEventImpl *>(evt)->keyIdentifier();
  -        switch (m_type) {
  -            case BUTTON:
  -            case CHECKBOX:
  -            case FILE:
  -            case IMAGE:
  -            case RADIO:
  -            case RESET:
  -            case SUBMIT:
  -                // Simulate mouse click for enter or spacebar for these types of elements.
  -                // The AppKit already does this for spacebar for some, but not all, of them.
  -                if (key == "U+000020" || key == "Enter") {
  -                    click(false);
  -                    evt->setDefaultHandled();
  -                }
  -                break;
  -            case HIDDEN:
  -            case ISINDEX:
  -            case PASSWORD:
  -            case RANGE:
  -            case SEARCH:
  -            case TEXT:
  -                // Simulate mouse click on the default form button for enter for these types of elements.
  -                if (key == "Enter" && m_form) {
  -                    m_form->submitClick();
  -                    evt->setDefaultHandled();
  -                }
  -                break;
  +
  +        if (key == "U+000020") {
  +            switch (m_type) {
  +                case BUTTON:
  +                case CHECKBOX:
  +                case FILE:
  +                case IMAGE:
  +                case RADIO:
  +                case RESET:
  +                case SUBMIT:
  +                    // Simulate mouse click for spacebar for these types of elements.
  +                    // The AppKit already does this for some, but not all, of them.
  +                    clickElement = true;
  +                    break;
  +                case HIDDEN:
  +                case ISINDEX:
  +                case PASSWORD:
  +                case RANGE:
  +                case SEARCH:
  +                case TEXT:
  +                    break;
  +            }
  +        }
  +
  +        if (key == "Enter") {
  +            switch (m_type) {
  +                case BUTTON:
  +                case CHECKBOX:
  +                case HIDDEN:
  +                case ISINDEX:
  +                case PASSWORD:
  +                case RANGE:
  +                case SEARCH:
  +                case TEXT:
  +                    // Simulate mouse click on the default form button for enter for these types of elements.
  +                    clickDefaultFormButton = true;
  +                    break;
  +                case FILE:
  +                case IMAGE:
  +                case RADIO:
  +                case RESET:
  +                case SUBMIT:
  +                    // Simulate mouse click for enter for these types of elements.
  +                    clickElement = true;
  +                    break;
  +            }
  +        }
  +
  +        if (clickElement) {
  +            click(false);
  +            evt->setDefaultHandled();
  +        } else if (clickDefaultFormButton && m_form) {
  +            m_form->submitClick();
  +            evt->setDefaultHandled();
           }
       }
   #endif
  
  
  



More information about the webkit-changes mailing list