Changeset 21045 in webkit
- Timestamp:
- Apr 23, 2007 2:15:48 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r21027 r21045 1 2007-04-23 Adele Peterson <adele@apple.com> 2 3 Reviewed by Hyatt & Adam. 4 5 Tests for <rdar://problem/4807799> REGRESSION: calling select() in onSearch handler doesn't work if you hit enter to trigger the event 6 7 * fast/events/onchange-passwordfield-expected.txt: 8 * fast/events/onchange-passwordfield.html: 9 * fast/events/onchange-searchfield-expected.txt: 10 * fast/events/onchange-searchfield.html: 11 * fast/events/onchange-select-popup-expected.txt: Added. 12 * fast/events/onchange-select-popup.html: Added. 13 * fast/events/onchange-textfield-expected.txt: 14 * fast/events/onchange-textfield.html: 15 * fast/forms/onchange-enter-submit-expected.txt: 16 1 17 2007-04-23 Darin Adler <darin@apple.com> 2 18 -
trunk/LayoutTests/fast/events/onchange-passwordfield-expected.txt
r18073 r21045 1 This test verifies that the ENTER key fires the change and then the blurevent.1 This test verifies that the ENTER key fires the change event. 2 2 3 3 4 4 PASS: change event fired. 5 5 6 PASS: blur event fired.7 6 8 PASS: blur event fired last.9 10 -
trunk/LayoutTests/fast/events/onchange-passwordfield.html
r18073 r21045 1 <p>This test verifies that the ENTER key fires the change and then the blurevent.</p>1 <p>This test verifies that the ENTER key fires the change event.</p> 2 2 <hr> 3 3 <input id="input" type="password" onchange="changeHandler()" onblur="blurHandler()"></input> … … 12 12 function changeHandler() 13 13 { 14 lastEvent = "change";15 14 log ('PASS: change event fired.\n'); 16 15 } … … 18 17 function blurHandler() 19 18 { 20 lastEvent = "blur"; 21 log ('PASS: blur event fired.\n'); 19 log ('blur event fired.\n'); 22 20 } 23 21 … … 34 32 input.dispatchEvent(enterEvent); 35 33 36 // test that blur happened last37 if (lastEvent == "blur")38 log('PASS: blur event fired last.\n');39 34 </script> -
trunk/LayoutTests/fast/events/onchange-searchfield-expected.txt
r18248 r21045 1 This test verifies that the ENTER key fires the change and then the blurevent.1 This test verifies that the ENTER key fires the change event. 2 2 3 3 4 4 PASS: change event fired. 5 5 6 PASS: blur event fired.7 6 8 PASS: blur event fired last.9 10 -
trunk/LayoutTests/fast/events/onchange-searchfield.html
r18073 r21045 1 <p>This test verifies that the ENTER key fires the change and then the blurevent.</p>1 <p>This test verifies that the ENTER key fires the change event.</p> 2 2 <hr> 3 3 <input id="input" type="search" onchange="changeHandler()" onblur="blurHandler()"></input> … … 12 12 function changeHandler() 13 13 { 14 window.lastEvent = "change";15 14 log ('PASS: change event fired.\n'); 16 15 } … … 18 17 function blurHandler() 19 18 { 20 window.lastEvent = "blur"; 21 log ('PASS: blur event fired.\n'); 19 log ('blur event fired.\n'); 22 20 } 23 21 … … 27 25 // change the field 28 26 document.getElementById('input').focus(); 29 document.execCommand("InsertText", false, "foo bar baz"); // Won't work until searchfield becomes a non-AppKit control27 document.execCommand("InsertText", false, "foo bar baz"); 30 28 31 29 // hit enter … … 34 32 input.dispatchEvent(enterEvent); 35 33 36 // test that blur happened last37 if (window.lastEvent == "blur")38 log('PASS: blur event fired last.\n');39 34 </script> -
trunk/LayoutTests/fast/events/onchange-textfield-expected.txt
r18073 r21045 1 This test verifies that the ENTER key fires the change and then the blurevent.1 This test verifies that the ENTER key fires the change event. 2 2 3 3 4 4 PASS: change event fired. 5 5 6 PASS: blur event fired.7 6 8 PASS: blur event fired last.9 10 -
trunk/LayoutTests/fast/events/onchange-textfield.html
r18073 r21045 1 <p>This test verifies that the ENTER key fires the change and then the blurevent.</p>1 <p>This test verifies that the ENTER key fires the change event.</p> 2 2 <hr> 3 3 <input id="input" type="text" onchange="changeHandler()" onblur="blurHandler()"></input> … … 12 12 function changeHandler() 13 13 { 14 window.lastEvent = "change";15 14 log ('PASS: change event fired.\n'); 16 15 } … … 18 17 function blurHandler() 19 18 { 20 window.lastEvent = "blur"; 21 log ('PASS: blur event fired.\n'); 19 log ('blur event fired.\n'); 22 20 } 23 21 … … 34 32 input.dispatchEvent(enterEvent); 35 33 36 // test that blur happened last37 if (window.lastEvent == "blur")38 log('PASS: blur event fired last.\n');39 34 </script> -
trunk/LayoutTests/fast/forms/onchange-enter-submit-expected.txt
r17562 r21045 2 2 3 3 text onchange 4 text onblur5 4 on submit 6 5 -
trunk/WebCore/ChangeLog
r21042 r21045 1 2007-04-23 Adele Peterson <adele@apple.com> 2 3 Reviewed by Hyatt & Adam. 4 5 Fix for <rdar://problem/4807799> REGRESSION: calling select() in onSearch handler doesn't work if you hit enter to trigger the event 6 Fix for <rdar://problem/5153970> onChange doesn't fire when focusing a popup, using type-ahead to select, and leaving 7 8 This previous behavior to blur controls when hitting enter was added to achieve the result of firing the change event. Firefox does not 9 fire blur- just the change event, so this fix will match Firefox behavior. 10 11 This also fixes a bug where we didn't fire the change event when using type-ahead selection with the popup menu. 12 13 * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): Fire change event instead of blur event when hitting enter. 14 15 * html/HTMLSelectElement.cpp: 16 (WebCore::HTMLSelectElement::dispatchFocusEvent): Now that we have type-ahead selection for popups that can be opened with the arrow keys, 17 we should always save the last selection when a popup gets focus, so it can be compared to the current selection when it loses focus. 18 (WebCore::HTMLSelectElement::dispatchBlurEvent): For the same reasons as above, we should fire onChange for all popups on blur. 19 20 (WebCore::HTMLSelectElement::menuListDefaultEventHandler): Fire change event instead of blur event when hitting enter. Removed an unnecessary 21 check for form() before calling menuListOnChange(). Removed an unnecessary check for renderer() and usesMenuList(). 22 (WebCore::HTMLSelectElement::listBoxDefaultEventHandler): Remove call to blur. Since list boxes fire the change event immediately after an 23 action is taken, we don't need to fire anything after hitting enter. 24 (WebCore::HTMLSelectElement::menuListOnChange): Reset m_lastOnChangeIndex after firing the change event. 25 1 26 2007-04-23 Anders Carlsson <andersca@apple.com> 2 27 -
trunk/WebCore/html/HTMLInputElement.cpp
r21010 r21045 1282 1282 onSearch(); 1283 1283 } 1284 blur(); 1285 // Form may never have been present, or may have been destroyed by the blur event. 1284 // Fire onChange for text fields. 1285 RenderObject* r = renderer(); 1286 if (r && r->isTextField() && r->isEdited()) { 1287 onChange(); 1288 r->setEdited(false); 1289 } 1290 // Form may never have been present, or may have been destroyed by the change event. 1286 1291 if (form()) 1287 1292 form()->submitClick(evt); -
trunk/WebCore/html/HTMLSelectElement.cpp
r20724 r21045 576 576 void HTMLSelectElement::dispatchFocusEvent() 577 577 { 578 #if !ARROW_KEYS_POP_MENU579 578 if (usesMenuList()) 580 579 // Save the selection so it can be compared to the new selection when we call onChange during dispatchBlurEvent. 581 580 saveLastSelection(); 582 #endif583 581 HTMLGenericFormElement::dispatchFocusEvent(); 584 582 } … … 586 584 void HTMLSelectElement::dispatchBlurEvent() 587 585 { 588 #if !ARROW_KEYS_POP_MENU589 586 // We only need to fire onChange here for menu lists, because we fire onChange for list boxes whenever the selection change is actually made. 590 587 // This matches other browsers' behavior. 591 588 if (usesMenuList()) 592 589 menuListOnChange(); 593 #endif594 590 HTMLGenericFormElement::dispatchBlurEvent(); 595 591 } … … 631 627 bool handled = false; 632 628 #if ARROW_KEYS_POP_MENU 633 if (form() && keyIdentifier == "Enter") { 634 blur(); 635 // Make sure the form hasn't been destroyed during the blur. 629 if (keyIdentifier == "Enter") { 630 menuListOnChange(); 636 631 if (form()) 637 632 form()->submitClick(evt); 638 633 handled = true; 639 634 } 640 if ( (keyIdentifier == "Down" || keyIdentifier == "Up" || keyIdentifier == "U+000020") && renderer() && usesMenuList()) {635 if (keyIdentifier == "Down" || keyIdentifier == "Up" || keyIdentifier == "U+000020") { 641 636 focus(); 642 637 // Save the selection so it can be compared to the new selection when we call onChange during setSelectedIndex, … … 763 758 String keyIdentifier = static_cast<KeyboardEvent*>(evt)->keyIdentifier(); 764 759 765 if (form() && keyIdentifier == "Enter") { 766 blur(); 767 // Make sure the form hasn't been destroyed during the blur. 760 if (keyIdentifier == "Enter") { 768 761 if (form()) 769 762 form()->submitClick(evt); … … 858 851 { 859 852 ASSERT(usesMenuList()); 860 if (m_lastOnChangeIndex != selectedIndex()) 853 int selected = selectedIndex(); 854 if (m_lastOnChangeIndex != selected) { 861 855 onChange(); 856 m_lastOnChangeIndex = selected; 857 } 862 858 } 863 859
Note: See TracChangeset
for help on using the changeset viewer.