- Revision
- 149856
- Author
- [email protected]
- Date
- 2013-05-09 16:55:24 -0700 (Thu, 09 May 2013)
Log Message
REGRESSION: Disabled multiline select element now responds to (certain) clicks
https://bugs.webkit.org/show_bug.cgi?id=115710
Patch by Yael Aharon <[email protected]> on 2013-05-09
Reviewed by Kent Tamura.
Source/WebCore:
After http://trac.webkit.org/changeset/140286, select elements can scroll whether they
are disabled or not. While they scroll, they also change the selected item.
This patch allows the select element to scroll, but does not change the selection
if the select element is disabled.
Test: fast/forms/select/listbox-disabled-scroll-no-onchange.html
Test: fast/forms/select/listbox-disabled-no-autoscroll.html
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::autoscroll):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::stopAutoscroll):
LayoutTests:
Test that a disabled element does not change selection while scrolling.
* fast/forms/select/listbox-disabled-scroll-no-onchange-expected.txt: Added.
* fast/forms/select/listbox-disabled-scroll-no-onchange.html: Added.
* fast/forms/select/listbox-disabled-no-autoscroll.html: Added.
* fast/forms/select/listbox-disabled-no-autoscroll-expected.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (149855 => 149856)
--- trunk/LayoutTests/ChangeLog 2013-05-09 23:47:54 UTC (rev 149855)
+++ trunk/LayoutTests/ChangeLog 2013-05-09 23:55:24 UTC (rev 149856)
@@ -1,3 +1,17 @@
+2013-05-09 Yael Aharon <[email protected]>
+
+ REGRESSION: Disabled multiline select element now responds to (certain) clicks
+ https://bugs.webkit.org/show_bug.cgi?id=115710
+
+ Reviewed by Kent Tamura.
+
+ Test that a disabled element does not change selection while scrolling.
+
+ * fast/forms/select/listbox-disabled-scroll-no-onchange-expected.txt: Added.
+ * fast/forms/select/listbox-disabled-scroll-no-onchange.html: Added.
+ * fast/forms/select/listbox-disabled-no-autoscroll.html: Added.
+ * fast/forms/select/listbox-disabled-no-autoscroll-expected.html: Added.
+
2013-05-09 Roger Fong <[email protected]>
Unreviewed mac gardening.
Added: trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll-expected.html (0 => 149856)
--- trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll-expected.html 2013-05-09 23:55:24 UTC (rev 149856)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+select {background-color: red; }
+</style>
+</head>
+<body>
+<div>
+<select id="test" disabled size=4">
+<option selected>foo1</option>
+<option>foo2</option>
+<option>foo3</option>
+<option>foo4</option>
+<option>foo5</option>
+</select>
+</div>
+
+<div id="result">Success if selection did not change.</div>
+<div id="console"></div>
+</html>
+
Added: trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll.html (0 => 149856)
--- trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-disabled-no-autoscroll.html 2013-05-09 23:55:24 UTC (rev 149856)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+select {background-color: red; }
+</style>
+</head>
+<body>
+<select disabled id="test" size=4">
+<option selected>foo1</option>
+<option>foo2</option>
+<option>foo3</option>
+<option>foo4</option>
+<option>foo5</option>
+</select>
+
+<div id="result">Success if selection did not change.</div>
+<div id="selection"></div>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+}
+
+if (window.eventSender) {
+ eventSender.dragMode = false;
+ mouseMoveToIndexInListbox(0, 'test');
+ eventSender.mouseDown();
+ mouseMoveToIndexInListbox(1, 'test');
+ mouseMoveToIndexInListbox(2, 'test');
+ setTimeout(function() {
+ mouseMoveToIndexInListbox(3, 'test');
+ testRunner.notifyDone();
+ }, 100);
+}
+</script>
+</html>
+
Added: trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange-expected.txt (0 => 149856)
--- trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange-expected.txt 2013-05-09 23:55:24 UTC (rev 149856)
@@ -0,0 +1,10 @@
+Test that scrolling the listbox does not fire change event.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS changeEventCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange.html (0 => 149856)
--- trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-disabled-scroll-no-onchange.html 2013-05-09 23:55:24 UTC (rev 149856)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<body>
+<select id="test" disabled size=3>
+<option selected>foo1</option>
+<option>foo2</option>
+<option>foo3</option>
+<option>foo4</option>
+<option>foo5</option>
+</select>
+<script src=""
+<script src=""
+<script>
+description('Test that scrolling the listbox does not fire change event.');
+
+var selectElement = document.getElementById('test');
+
+if (!window.eventSender) {
+ debug('To manually test, click and drag the select element using the mouse. It should not fire change event.');
+ selectElement.addEventListener('change', function () {
+ testFailed('A disabled select should not fire change event');
+ });
+} else {
+ var changeEventCount = 0;
+ selectElement.addEventListener('change', function () { changeEventCount++; });
+
+ mouseMoveToIndexInListbox(1, 'test');
+ eventSender.mouseDown(0);
+ mouseMoveToIndexInListbox(2, 'test');
+ eventSender.mouseUp(0);
+
+ shouldBe('changeEventCount', '0');
+}
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (149855 => 149856)
--- trunk/Source/WebCore/ChangeLog 2013-05-09 23:47:54 UTC (rev 149855)
+++ trunk/Source/WebCore/ChangeLog 2013-05-09 23:55:24 UTC (rev 149856)
@@ -1,3 +1,23 @@
+2013-05-09 Yael Aharon <[email protected]>
+
+ REGRESSION: Disabled multiline select element now responds to (certain) clicks
+ https://bugs.webkit.org/show_bug.cgi?id=115710
+
+ Reviewed by Kent Tamura.
+
+ After http://trac.webkit.org/changeset/140286, select elements can scroll whether they
+ are disabled or not. While they scroll, they also change the selected item.
+ This patch allows the select element to scroll, but does not change the selection
+ if the select element is disabled.
+
+ Test: fast/forms/select/listbox-disabled-scroll-no-onchange.html
+ Test: fast/forms/select/listbox-disabled-no-autoscroll.html
+
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::autoscroll):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::stopAutoscroll):
+
2013-05-09 Anders Carlsson <[email protected]>
Clean up SecurityOrigin::databaseIdentifier
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (149855 => 149856)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-05-09 23:47:54 UTC (rev 149855)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-05-09 23:55:24 UTC (rev 149856)
@@ -563,6 +563,9 @@
IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->lastKnownMousePosition());
int endIndex = scrollToward(pos);
+ if (selectElement()->isDisabledFormControl())
+ return;
+
if (endIndex >= 0) {
HTMLSelectElement* select = selectElement();
m_inAutoscroll = true;
@@ -578,6 +581,9 @@
void RenderListBox::stopAutoscroll()
{
+ if (selectElement()->isDisabledFormControl())
+ return;
+
selectElement()->listBoxOnChange();
}