Title: [103045] trunk
Revision
103045
Author
commit-qu...@webkit.org
Date
2011-12-16 01:08:00 -0800 (Fri, 16 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-16
Reviewed by Kent Tamura.

Source/WebCore:

Fire onchange even for type ahead selection.

Test: fast/forms/select/menulist-type-ahead-find.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::typeAheadFind): Add DispatchChangeEvent when
calling selectOption method.

LayoutTests:

* fast/events/onchange-select-popup.html: Add "PASS: change event fired." for type ahread test.
* fast/forms/select/menulist-type-ahead-find-expected.txt: Added.
* fast/forms/select/menulist-type-ahead-find.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103044 => 103045)


--- trunk/LayoutTests/ChangeLog	2011-12-16 09:04:50 UTC (rev 103044)
+++ trunk/LayoutTests/ChangeLog	2011-12-16 09:08:00 UTC (rev 103045)
@@ -1,3 +1,14 @@
+2011-12-16  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.html: Add "PASS: change event fired." for type ahread test.
+        * fast/forms/select/menulist-type-ahead-find-expected.txt: Added.
+        * fast/forms/select/menulist-type-ahead-find.html: Added.
+
 2011-12-16  Shinya Kawanaka  <shin...@google.com>
 
         A test that mutation happens when asynchronous spell checking is in process.

Modified: trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt (103044 => 103045)


--- trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt	2011-12-16 09:04:50 UTC (rev 103044)
+++ trunk/LayoutTests/fast/events/onchange-select-popup-expected.txt	2011-12-16 09:08:00 UTC (rev 103045)
@@ -6,4 +6,6 @@
 
 blur event fired.
 
+PASS: change event fired.
 
+

Added: trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find-expected.txt (0 => 103045)


--- 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-16 09:08:00 UTC (rev 103045)
@@ -0,0 +1,8 @@
+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 => 103045)


--- trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select/menulist-type-ahead-find.html	2011-12-16 09:08:00 UTC (rev 103045)
@@ -0,0 +1,39 @@
+<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/Source/WebCore/ChangeLog (103044 => 103045)


--- trunk/Source/WebCore/ChangeLog	2011-12-16 09:04:50 UTC (rev 103044)
+++ trunk/Source/WebCore/ChangeLog	2011-12-16 09:08:00 UTC (rev 103045)
@@ -1,3 +1,18 @@
+2011-12-16  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.
+
+        Fire onchange even for type ahead selection.
+
+        Test: fast/forms/select/menulist-type-ahead-find.html
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::typeAheadFind): Add DispatchChangeEvent when
+        calling selectOption method.
+
 2011-12-16  Andreas Kling  <kl...@webkit.org>
 
         Don't call Document::body() twice in the same function.

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (103044 => 103045)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2011-12-16 09:04:50 UTC (rev 103044)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2011-12-16 09:08:00 UTC (rev 103045)
@@ -1441,7 +1441,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

Reply via email to