[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
tkent at chromium.org
tkent at chromium.org
Wed Mar 17 18:43:20 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 28a35d92cbd272caa56134152babe3eea19c3998
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 16 05:56:59 2010 +0000
2010-03-15 Kent Tamura <tkent at chromium.org>
Reviewed by Eric Seidel.
Don't submit disabled menu options.
https://bugs.webkit.org/show_bug.cgi?id=35056
* fast/forms/menulist-disabled-selected-option-expected.txt: Added.
* fast/forms/menulist-disabled-selected-option.html: Added.
* fast/forms/menulist-submit-without-selection-expected.txt: Added.
* fast/forms/menulist-submit-without-selection.html: Added.
* fast/forms/script-tests/menulist-disabled-selected-option.js: Added.
* fast/forms/script-tests/menulist-submit-without-selection.js: Added.
2010-03-15 Kent Tamura <tkent at chromium.org>
Reviewed by Eric Seidel.
Don't submit disabled menu options.
https://bugs.webkit.org/show_bug.cgi?id=35056
Test: fast/forms/menulist-disabled-selected-option.html
* dom/OptionElement.h:
* dom/SelectElement.cpp:
(WebCore::SelectElement::appendFormData):
If a selected option is disabled, skip it.
Remove code for non-selected menulist because of compatibility with
other browsers.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56041 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5a8dc2d..d51bc6c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-03-15 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Don't submit disabled menu options.
+ https://bugs.webkit.org/show_bug.cgi?id=35056
+
+ * fast/forms/menulist-disabled-selected-option-expected.txt: Added.
+ * fast/forms/menulist-disabled-selected-option.html: Added.
+ * fast/forms/menulist-submit-without-selection-expected.txt: Added.
+ * fast/forms/menulist-submit-without-selection.html: Added.
+ * fast/forms/script-tests/menulist-disabled-selected-option.js: Added.
+ * fast/forms/script-tests/menulist-submit-without-selection.js: Added.
+
2010-03-15 Adam Bergkvist <adam.bergkvist at ericsson.com>
Reviewed by Adam Barth.
diff --git a/LayoutTests/fast/forms/menulist-disabled-selected-option-expected.txt b/LayoutTests/fast/forms/menulist-disabled-selected-option-expected.txt
new file mode 100644
index 0000000..b1789b4
--- /dev/null
+++ b/LayoutTests/fast/forms/menulist-disabled-selected-option-expected.txt
@@ -0,0 +1,11 @@
+Check that a select control does not produce a form value if the selected option element is disabled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS query.indexOf("select=Disabled") is -1
+PASS query.indexOf("select=Enabled") is -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/menulist-disabled-selected-option.html b/LayoutTests/fast/forms/menulist-disabled-selected-option.html
new file mode 100644
index 0000000..f4b478b
--- /dev/null
+++ b/LayoutTests/fast/forms/menulist-disabled-selected-option.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/menulist-disabled-selected-option.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/menulist-submit-without-selection-expected.txt b/LayoutTests/fast/forms/menulist-submit-without-selection-expected.txt
new file mode 100644
index 0000000..48ed929
--- /dev/null
+++ b/LayoutTests/fast/forms/menulist-submit-without-selection-expected.txt
@@ -0,0 +1,10 @@
+A unselected option was submitted as fallback. This behavior was removed by the change of webkit.org/b/35056.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS query.indexOf("select=Disabled") is -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/menulist-submit-without-selection.html b/LayoutTests/fast/forms/menulist-submit-without-selection.html
new file mode 100644
index 0000000..f281422
--- /dev/null
+++ b/LayoutTests/fast/forms/menulist-submit-without-selection.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/menulist-submit-without-selection.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js b/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js
new file mode 100644
index 0000000..4ecd82c
--- /dev/null
+++ b/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js
@@ -0,0 +1,27 @@
+description('Check that a select control does not produce a form value if the selected option element is disabled.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form action="">'
+ + '<input type=hidden name="submitted" value="true">'
+ + '<select name="select">'
+ + '<option disabled>Disabled</option>'
+ + '<option>Enabled</option>'
+ + '</select>'
+ + '</form>';
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+var query = window.location.search;
+if (query.indexOf('submitted=true') == -1) {
+ var select = document.getElementsByTagName('select')[0];
+ select.selectedIndex = 0;
+ document.forms[0].submit();
+} else {
+ shouldBe('query.indexOf("select=Disabled")', '-1');
+ shouldBe('query.indexOf("select=Enabled")', '-1');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js b/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js
new file mode 100644
index 0000000..12714d6
--- /dev/null
+++ b/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js
@@ -0,0 +1,25 @@
+description('A unselected option was submitted as fallback. This behavior was removed by the change of webkit.org/b/35056.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form action="">'
+ + '<input type=hidden name="submitted" value="true">'
+ + '<select name="select">'
+ + '<option disabled>Disabled</option>'
+ + '</select>'
+ + '</form>';
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+var query = window.location.search;
+if (query.indexOf('submitted=true') == -1) {
+ var select = document.getElementsByTagName('select')[0];
+ select.selectedIndex = 0;
+ document.forms[0].submit();
+} else {
+ shouldBe('query.indexOf("select=Disabled")', '-1');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 75525ce..22101e1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-03-15 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Don't submit disabled menu options.
+ https://bugs.webkit.org/show_bug.cgi?id=35056
+
+ Test: fast/forms/menulist-disabled-selected-option.html
+
+ * dom/OptionElement.h:
+ * dom/SelectElement.cpp:
+ (WebCore::SelectElement::appendFormData):
+ If a selected option is disabled, skip it.
+ Remove code for non-selected menulist because of compatibility with
+ other browsers.
+
2010-03-15 Leandro Pereira <leandro at profusion.mobi>
Reviewed by Holger Freyther.
diff --git a/WebCore/dom/OptionElement.h b/WebCore/dom/OptionElement.h
index a765d53..232c3ee 100644
--- a/WebCore/dom/OptionElement.h
+++ b/WebCore/dom/OptionElement.h
@@ -34,6 +34,7 @@ class OptionElement {
public:
virtual ~OptionElement() { }
+ virtual bool disabled() const = 0;
virtual bool selected() const = 0;
virtual void setSelectedState(bool) = 0;
diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp
index 8b8a8ef..0096627 100644
--- a/WebCore/dom/SelectElement.cpp
+++ b/WebCore/dom/SelectElement.cpp
@@ -464,27 +464,15 @@ bool SelectElement::appendFormData(SelectElementData& data, Element* element, Fo
for (unsigned i = 0; i < items.size(); ++i) {
OptionElement* optionElement = toOptionElement(items[i]);
- if (optionElement && optionElement->selected()) {
+ if (optionElement && optionElement->selected() && !optionElement->disabled()) {
list.appendData(name, optionElement->value());
successful = true;
}
}
- // FIXME: This case should not happen. Make sure that we select the first option
- // in any case, otherwise we have no consistency with the DOM interface.
- // We return the first one if it was a combobox select
- if (!successful && !data.multiple() && data.size() <= 1 && items.size()) {
- OptionElement* optionElement = toOptionElement(items[0]);
- if (optionElement) {
- const AtomicString& value = optionElement->value();
- if (value.isNull())
- list.appendData(name, optionElement->text().stripWhiteSpace());
- else
- list.appendData(name, value);
- successful = true;
- }
- }
-
+ // It's possible that this is a menulist with multiple options and nothing
+ // will be submitted (!successful). We won't send a unselected non-disabled
+ // option as fallback. This behavior matches to other browsers.
return successful;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list