Title: [103497] trunk
- Revision
- 103497
- Author
- commit-qu...@webkit.org
- Date
- 2011-12-21 23:17:51 -0800 (Wed, 21 Dec 2011)
Log Message
[Forms] Selection change by type-ahead doesn't fire 'change' event
https://bugs.webkit.org/show_bug.cgi?id=74590
Patch by Yosifumi Inoue <yo...@chromium.org> on 2011-12-21
Reviewed by Kent Tamura.
Source/WebCore:
This patch changes when onchange event fired in select element for:
1 Fire onchange event for type ahead selection.
2 Don't fire onchange event for Enter key. We've already fired onchange event for cursor key
and type ahead selection. So, onchange for Enter key is redundant. This behavior is
compatible to IE(9.0.8112.16421) and Opera(9.80) on Windows. FF(8.01) doesn't fire onchange
by cursor key selection change and type ahead. FF requires Enter key press to fire onchange
event.
Test: fast/forms/select/menulist-type-ahead-find.html
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::menuListDefaultEventHandler): Don't fire onchange event for Entry key.
(WebCore::HTMLSelectElement::typeAheadFind): Add DispatchChangeEvent when
calling selectOption method.
LayoutTests:
* fast/events/onchange-select-popup-expected.txt: Change for onchange event by type ahead.
* fast/forms/select/menulist-type-ahead-find-expected.txt: Added.
* fast/forms/select/menulist-type-ahead-find.html: Added.
* platform/chromium/test_expectations.txt: Enable fast/forms/{select-double-onchange,select-script-onchange}.html for Chrome/Linux.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (103496 => 103497)
--- trunk/LayoutTests/ChangeLog 2011-12-22 07:00:23 UTC (rev 103496)
+++ trunk/LayoutTests/ChangeLog 2011-12-22 07:17:51 UTC (rev 103497)
@@ -1,3 +1,15 @@
+2011-12-21 Yosifumi Inoue <yo...@chromium.org>
+
+ [Forms] Selection change by type-ahead doesn't fire 'change' event
+ https://bugs.webkit.org/show_bug.cgi?id=74590
+
+ Reviewed by Kent Tamura.
+
+ * fast/events/onchange-select-popup-expected.txt: Change for onchange event by type ahead.
+ * fast/forms/select/menulist-type-ahead-find-expected.txt: Added.
+ * fast/forms/select/menulist-type-ahead-find.html: Added.
+ * platform/chromium/test_expectations.txt: Enable fast/forms/{select-double-onchange,select-script-onchange}.html for Chrome/Linux.
+
2011-12-21 Ami Fischman <fisch...@chromium.org>
[Chromium] Layout Test media/media-element-play-after-eos.html is flaky
Modified: trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt (103496 => 103497)
--- trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt 2011-12-22 07:00:23 UTC (rev 103496)
+++ trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt 2011-12-22 07:17:51 UTC (rev 103497)
@@ -6,4 +6,6 @@
blur event fired.
+PASS: change event fired.
+
Added: trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find-expected.txt (0 => 103497)
--- trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find-expected.txt 2011-12-22 07:17:51 UTC (rev 103497)
@@ -0,0 +1,9 @@
+=======
+WebKit Bug 74590
+
+Verify type ahead selection fires onchange event.
+Set focus to select element
+Type "c"
+You see "cherry" in select element and "PASS" below select element.
+
+PASS
Added: trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find.html (0 => 103497)
--- trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find.html 2011-12-22 07:17:51 UTC (rev 103497)
@@ -0,0 +1,40 @@
+=======
+<html>
+<head>
+<script>
+function recordIt()
+{
+ document.getElementById("res").innerText = "PASS";
+}
+
+function testIt(ch, expected)
+{
+ document.getElementById("sel").focus();
+ eventSender.keyDown(ch);
+}
+
+function test()
+{
+ if (!window.layoutTestController)
+ return;
+
+ layoutTestController.dumpAsText();
+ testIt("c", "cherry");
+}
+</script>
+</head>
+<body _onload_="test()">
+<h1>WebKit Bug <a href=""
+Verify type ahead selection fires onchange event.
+<ol>
+<li>Set focus to select element</li>
+<li>Type "c"</li>
+<li>You see "cherry" in select element and "PASS" below select element.</li>
+</ol>
+<select id="sel" _onchange_="recordIt()">
+ <option>apple</option>
+ <option>banana</option>
+ <option>cherry</option>
+</select><br />
+<div id="res"></div>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (103496 => 103497)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-12-22 07:00:23 UTC (rev 103496)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-12-22 07:17:51 UTC (rev 103497)
@@ -2628,8 +2628,6 @@
BUG_DRT : fast/dynamic/window-resize-scrollbars-test.html = IMAGE+TEXT
BUG_DRT DEBUG : fast/frames/calculate-round.html = PASS TIMEOUT
BUGCR43890 SLOW DEBUG : fast/forms/implicit-submission.html = PASS TEXT
-BUG_DRT BUGCR21141 LINUX : fast/forms/select-double-onchange.html = FAIL
-BUG_DRT BUGCR21141 LINUX : fast/forms/select-script-onchange.html = FAIL
BUG_DRT : fast/repaint/iframe-scroll-repaint.html = IMAGE
BUG_DRT LINUX : fast/repaint/repaint-across-writing-mode-boundary.html = IMAGE
BUG_DRT LINUX : fast/text/justification-padding-mid-word.html = PASS TEXT
Modified: trunk/Source/WebCore/ChangeLog (103496 => 103497)
--- trunk/Source/WebCore/ChangeLog 2011-12-22 07:00:23 UTC (rev 103496)
+++ trunk/Source/WebCore/ChangeLog 2011-12-22 07:17:51 UTC (rev 103497)
@@ -1,3 +1,25 @@
+2011-12-21 Yosifumi Inoue <yo...@chromium.org>
+
+ [Forms] Selection change by type-ahead doesn't fire 'change' event
+ https://bugs.webkit.org/show_bug.cgi?id=74590
+
+ Reviewed by Kent Tamura.
+
+ This patch changes when onchange event fired in select element for:
+ 1 Fire onchange event for type ahead selection.
+ 2 Don't fire onchange event for Enter key. We've already fired onchange event for cursor key
+ and type ahead selection. So, onchange for Enter key is redundant. This behavior is
+ compatible to IE(9.0.8112.16421) and Opera(9.80) on Windows. FF(8.01) doesn't fire onchange
+ by cursor key selection change and type ahead. FF requires Enter key press to fire onchange
+ event.
+
+ Test: fast/forms/select/menulist-type-ahead-find.html
+
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::menuListDefaultEventHandler): Don't fire onchange event for Entry key.
+ (WebCore::HTMLSelectElement::typeAheadFind): Add DispatchChangeEvent when
+ calling selectOption method.
+
2011-12-21 Darin Adler <da...@apple.com>
Tweak and comment some transform-related code
Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (103496 => 103497)
--- trunk/Source/WebCore/html/HTMLSelectElement.cpp 2011-12-22 07:00:23 UTC (rev 103496)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp 2011-12-22 07:17:51 UTC (rev 103497)
@@ -1113,13 +1113,6 @@
dispatchChangeEventForMenuList();
handled = true;
}
-#else
- int listIndex = optionToListIndex(selectedIndex());
- if (keyCode == '\r') {
- // listIndex should already be selected, but this will fire the onchange handler.
- selectOption(listToOptionIndex(listIndex), DeselectOtherOptions | DispatchChangeEvent | UserDriven);
- handled = true;
- }
#endif
if (handled)
event->setDefaultHandled();
@@ -1441,7 +1434,7 @@
// Fold the option string and check if its prefix is equal to the folded prefix.
String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) {
- selectOption(listToOptionIndex(index), DeselectOtherOptions | UserDriven);
+ selectOption(listToOptionIndex(index), DeselectOtherOptions | DispatchChangeEvent | UserDriven);
if (!usesMenuList())
listBoxOnChange();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes