[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:36:25 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit d71be72adb8651410d857f44c71952d678d04101
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 29 21:25:54 2009 +0000
2009-09-29 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
Update for .maxLength behavior change.
https://bugs.webkit.org/show_bug.cgi?id=29796
* fast/forms/input-maxlength-expected.txt:
* fast/forms/input-maxlength.html:
* fast/forms/script-tests/textarea-maxlength.js:
* fast/forms/textarea-maxlength-expected.txt:
2009-09-29 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
Follows HTML5's maxLength change in September 2009.
- Change HTMLTextAreaElement.maxLength type to signed.
- HTMLTextAreaElement.maxLength returns -1 if maxlength= attribute is missing.
- HTMLTextAreaElement.maxLength and HTMLInputElement.maxLength
throw INDEX_SIZE_ERR for setting negative values.
https://bugs.webkit.org/show_bug.cgi?id=29796
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setMaxLength):
* html/HTMLInputElement.h:
* html/HTMLInputElement.idl:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent):
(WebCore::HTMLTextAreaElement::maxLength):
(WebCore::HTMLTextAreaElement::setMaxLength):
* html/HTMLTextAreaElement.h:
* html/HTMLTextAreaElement.idl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 979ab22..f274228 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-09-29 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Update for .maxLength behavior change.
+ https://bugs.webkit.org/show_bug.cgi?id=29796
+
+ * fast/forms/input-maxlength-expected.txt:
+ * fast/forms/input-maxlength.html:
+ * fast/forms/script-tests/textarea-maxlength.js:
+ * fast/forms/textarea-maxlength-expected.txt:
+
2009-09-29 Dirk Schulze <krit at webkit.org>
Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/fast/forms/input-maxlength-expected.txt b/LayoutTests/fast/forms/input-maxlength-expected.txt
index fa7f7ff..312db1d 100644
--- a/LayoutTests/fast/forms/input-maxlength-expected.txt
+++ b/LayoutTests/fast/forms/input-maxlength-expected.txt
@@ -72,6 +72,10 @@ Attempting to insert 530000 characters with maxLength = 524288.
PASS
Attempting to insert 530000 characters with maxLength = 600000.
PASS
+Some tests for .maxLength property.
+PASS input.maxLength is implicitMaxLength
+PASS input.maxLength = -1 threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS input.getAttribute('maxlength') is '100'
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/input-maxlength.html b/LayoutTests/fast/forms/input-maxlength.html
index 592b2b3..c308d48 100644
--- a/LayoutTests/fast/forms/input-maxlength.html
+++ b/LayoutTests/fast/forms/input-maxlength.html
@@ -44,6 +44,13 @@
}
}
+ debug('Some tests for .maxLength property.');
+ input = document.createElement("input");
+ shouldBe("input.maxLength", "implicitMaxLength");
+ shouldThrow("input.maxLength = -1", "'Error: INDEX_SIZE_ERR: DOM Exception 1'");
+ input.maxLength = 100;
+ shouldBe("input.getAttribute('maxlength')", "'100'");
+
var successfullyParsed = true;
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
diff --git a/LayoutTests/fast/forms/script-tests/textarea-maxlength.js b/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
index 7cf0f5d..ee2bb17 100644
--- a/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
+++ b/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
@@ -4,13 +4,13 @@ var textArea = document.createElement('textarea');
document.body.appendChild(textArea);
// No maxlength attribute
-shouldBe('textArea.maxLength', '0');
+shouldBe('textArea.maxLength', '-1');
// Invalid maxlength attributes
textArea.setAttribute('maxlength', '-3');
-shouldBe('textArea.maxLength', '0');
+shouldBe('textArea.maxLength', '-1');
textArea.setAttribute('maxlength', 'xyz');
-shouldBe('textArea.maxLength', '0');
+shouldBe('textArea.maxLength', '-1');
// Valid maxlength attributes
textArea.setAttribute('maxlength', '1');
@@ -22,9 +22,12 @@ shouldBe('textArea.maxLength', '256');
textArea.maxLength = 13;
shouldBe('textArea.getAttribute("maxlength")', '"13"');
-textArea.maxLength = -1;
-shouldBe('textArea.maxLength', '4294967295');
-shouldBe('textArea.getAttribute("maxlength")', '"4294967295"');
+shouldThrow('textArea.maxLength = -1', '"Error: INDEX_SIZE_ERR: DOM Exception 1"');
+shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed
+
+textArea.maxLength = null;
+shouldBe('textArea.maxLength', '0');
+shouldBe('textArea.getAttribute("maxlength")', '"0"');
// maxLength doesn't truncate the default value.
textArea = document.createElement('textarea');
diff --git a/LayoutTests/fast/forms/textarea-maxlength-expected.txt b/LayoutTests/fast/forms/textarea-maxlength-expected.txt
index bd1aa17..5f84e8a 100644
--- a/LayoutTests/fast/forms/textarea-maxlength-expected.txt
+++ b/LayoutTests/fast/forms/textarea-maxlength-expected.txt
@@ -3,14 +3,16 @@ Tests for HTMLTextAreaElement.maxLength behaviors.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS textArea.maxLength is 0
-PASS textArea.maxLength is 0
-PASS textArea.maxLength is 0
+PASS textArea.maxLength is -1
+PASS textArea.maxLength is -1
+PASS textArea.maxLength is -1
PASS textArea.maxLength is 1
PASS textArea.maxLength is 256
PASS textArea.getAttribute("maxlength") is "13"
-PASS textArea.maxLength is 4294967295
-PASS textArea.getAttribute("maxlength") is "4294967295"
+PASS textArea.maxLength = -1 threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS textArea.getAttribute("maxlength") is "13"
+PASS textArea.maxLength is 0
+PASS textArea.getAttribute("maxlength") is "0"
PASS textArea.value is "abcd"
PASS textArea.value is "abcde"
PASS textArea.value is "abc"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4827e22..84336a6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-09-29 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Follows HTML5's maxLength change in September 2009.
+ - Change HTMLTextAreaElement.maxLength type to signed.
+ - HTMLTextAreaElement.maxLength returns -1 if maxlength= attribute is missing.
+ - HTMLTextAreaElement.maxLength and HTMLInputElement.maxLength
+ throw INDEX_SIZE_ERR for setting negative values.
+ https://bugs.webkit.org/show_bug.cgi?id=29796
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setMaxLength):
+ * html/HTMLInputElement.h:
+ * html/HTMLInputElement.idl:
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent):
+ (WebCore::HTMLTextAreaElement::maxLength):
+ (WebCore::HTMLTextAreaElement::setMaxLength):
+ * html/HTMLTextAreaElement.h:
+ * html/HTMLTextAreaElement.idl:
+
2009-09-29 Dimitri Glazkov <dglazkov at chromium.org>
No review, rolling out r48894, because review discussion was not complete.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index 0aefe7f..e6b8228 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -34,6 +34,7 @@
#include "Event.h"
#include "EventHandler.h"
#include "EventNames.h"
+#include "ExceptionCode.h"
#include "File.h"
#include "FileList.h"
#include "FocusController.h"
@@ -1609,9 +1610,12 @@ int HTMLInputElement::maxLength() const
return m_data.maxLength();
}
-void HTMLInputElement::setMaxLength(int _maxLength)
+void HTMLInputElement::setMaxLength(int _maxLength, ExceptionCode& exceptionCode)
{
- setAttribute(maxlengthAttr, String::number(_maxLength));
+ if (_maxLength < 0)
+ exceptionCode = INDEX_SIZE_ERR;
+ else
+ setAttribute(maxlengthAttr, String::number(_maxLength));
}
bool HTMLInputElement::multiple() const
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index 63d1634..16e3b58 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -201,7 +201,7 @@ public:
#endif
int maxLength() const;
- void setMaxLength(int);
+ void setMaxLength(int, ExceptionCode&);
bool multiple() const;
void setMultiple(bool);
diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl
index 07bab90..7cdf487 100644
--- a/WebCore/html/HTMLInputElement.idl
+++ b/WebCore/html/HTMLInputElement.idl
@@ -42,7 +42,8 @@ module html {
#if defined(ENABLE_DATALIST) && ENABLE_DATALIST
readonly attribute HTMLElement list;
#endif
- attribute long maxLength;
+ attribute long maxLength
+ setter raises(DOMException);
attribute boolean multiple;
attribute [ConvertNullToNullString] DOMString name;
attribute [Reflect] DOMString pattern;
diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp
index f398fc2..b5e4ced 100644
--- a/WebCore/html/HTMLTextAreaElement.cpp
+++ b/WebCore/html/HTMLTextAreaElement.cpp
@@ -32,6 +32,7 @@
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
+#include "ExceptionCode.h"
#include "FocusController.h"
#include "FormDataList.h"
#include "Frame.h"
@@ -283,16 +284,16 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
{
ASSERT(event);
ASSERT(renderer());
- bool ok;
- unsigned maxLength = getAttribute(maxlengthAttr).string().toUInt(&ok);
- if (!ok)
+ int signedMaxLength = maxLength();
+ if (signedMaxLength < 0)
return;
+ unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength);
unsigned currentLength = toRenderTextControl(renderer())->text().numGraphemeClusters();
unsigned selectionLength = plainText(document()->frame()->selection()->selection().toNormalizedRange().get()).numGraphemeClusters();
ASSERT(currentLength >= selectionLength);
unsigned baseLength = currentLength - selectionLength;
- unsigned appendableLength = maxLength > baseLength ? maxLength - baseLength : 0;
+ unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0;
event->setText(sanitizeUserInputValue(event->text(), appendableLength));
}
@@ -401,14 +402,19 @@ void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
setValue(value);
}
-unsigned HTMLTextAreaElement::maxLength() const
+int HTMLTextAreaElement::maxLength() const
{
- return getAttribute(maxlengthAttr).string().toUInt();
+ bool ok;
+ int value = getAttribute(maxlengthAttr).string().toInt(&ok);
+ return ok && value >= 0 ? value : -1;
}
-void HTMLTextAreaElement::setMaxLength(unsigned newValue)
+void HTMLTextAreaElement::setMaxLength(int newValue, ExceptionCode& exceptionCode)
{
- setAttribute(maxlengthAttr, String::number(newValue));
+ if (newValue < 0)
+ exceptionCode = INDEX_SIZE_ERR;
+ else
+ setAttribute(maxlengthAttr, String::number(newValue));
}
void HTMLTextAreaElement::accessKeyAction(bool)
diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h
index ef96fc5..cfd471a 100644
--- a/WebCore/html/HTMLTextAreaElement.h
+++ b/WebCore/html/HTMLTextAreaElement.h
@@ -79,8 +79,8 @@ public:
String defaultValue() const;
void setDefaultValue(const String&);
int textLength() const { return value().length(); }
- unsigned maxLength() const;
- void setMaxLength(unsigned);
+ int maxLength() const;
+ void setMaxLength(int, ExceptionCode&);
void rendererWillBeDestroyed();
diff --git a/WebCore/html/HTMLTextAreaElement.idl b/WebCore/html/HTMLTextAreaElement.idl
index 84583f5..db5154e 100644
--- a/WebCore/html/HTMLTextAreaElement.idl
+++ b/WebCore/html/HTMLTextAreaElement.idl
@@ -34,7 +34,8 @@ module html {
attribute long cols;
attribute boolean disabled;
attribute boolean autofocus;
- attribute unsigned long maxLength;
+ attribute long maxLength
+ setter raises(DOMException);
attribute [ConvertNullToNullString] DOMString name;
attribute [ConvertNullToNullString, Reflect] DOMString placeholder;
attribute boolean readOnly;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list