Diff
Modified: trunk/LayoutTests/ChangeLog (91836 => 91837)
--- trunk/LayoutTests/ChangeLog 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/LayoutTests/ChangeLog 2011-07-27 13:07:42 UTC (rev 91837)
@@ -1,3 +1,13 @@
+2011-07-27 Shinya Kawanaka <[email protected]>
+
+ Added a test to normalize option.text.
+ https://bugs.webkit.org/show_bug.cgi?id=57746
+
+ Reviewed by Kent Tamura.
+
+ * fast/forms/option-strip-unicode-spaces-expected.txt: Added.
+ * fast/forms/option-strip-unicode-spaces.html: Added.
+
2011-07-27 Csaba Osztrogonác <[email protected]>
Add Qt specific expected result for a new test introduced in r91777.
Added: trunk/LayoutTests/fast/forms/option-strip-unicode-spaces-expected.txt (0 => 91837)
--- trunk/LayoutTests/fast/forms/option-strip-unicode-spaces-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/option-strip-unicode-spaces-expected.txt 2011-07-27 13:07:42 UTC (rev 91837)
@@ -0,0 +1,510 @@
+Test for .text for OPTION element
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Insert one HTMLspace before/after/between the text
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+
+Insert multiple HTMLspaces before/after/between the text
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+
+
+Insert one nonHTMLspace before/after/between the text
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+
+Insert multiple nonHTMLspaces before/after/between the text
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+PASS option.text is expected
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/option-strip-unicode-spaces.html (0 => 91837)
--- trunk/LayoutTests/fast/forms/option-strip-unicode-spaces.html (rev 0)
+++ trunk/LayoutTests/fast/forms/option-strip-unicode-spaces.html 2011-07-27 13:07:42 UTC (rev 91837)
@@ -0,0 +1,101 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description('Test for .text for OPTION element');
+
+// See http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character
+var HTMLSpaces = [
+ String.fromCharCode(0x20),
+ String.fromCharCode(0x09),
+ String.fromCharCode(0x0A),
+ String.fromCharCode(0x0C),
+ String.fromCharCode(0x0D)
+];
+
+// Unicode white spaces which are not handled as white space
+// when removing spaces on option element.
+// These are taken from Unicode PropList.txt
+var nonHTMLSpaces = [
+ String.fromCharCode(0x0B),
+ String.fromCharCode(0x85),
+ String.fromCharCode(0xA0),
+ String.fromCharCode(0x1680),
+ String.fromCharCode(0x180E),
+ String.fromCharCode(0x2000),
+ String.fromCharCode(0x2001),
+ String.fromCharCode(0x2002),
+ String.fromCharCode(0x2003),
+ String.fromCharCode(0x2004),
+ String.fromCharCode(0x2005),
+ String.fromCharCode(0x2006),
+ String.fromCharCode(0x2007),
+ String.fromCharCode(0x2008),
+ String.fromCharCode(0x2009),
+ String.fromCharCode(0x200A),
+ String.fromCharCode(0x2028),
+ String.fromCharCode(0x2029),
+ String.fromCharCode(0x202F),
+ String.fromCharCode(0x205F),
+ String.fromCharCode(0x3000)
+];
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<select><option id=option></option></select>';
+
+var option = document.getElementById('option');
+
+var expected;
+
+debug('Insert one HTMLspace before/after/between the text');
+for (var i = 0; i < HTMLSpaces.length; ++i) {
+ option.text = HTMLSpaces[i] + 'text' + HTMLSpaces[i] + 'text' + HTMLSpaces[i];
+ expected = 'text text';
+ shouldBe('option.text', 'expected');
+}
+debug('');
+
+debug('Insert multiple HTMLspaces before/after/between the text');
+for (var i = 0; i < HTMLSpaces.length; ++i) {
+ for (var j = 0; j < HTMLSpaces.length; ++j) {
+ option.text = HTMLSpaces[i] + HTMLSpaces[j] + 'text' + HTMLSpaces[i] + HTMLSpaces[j] + 'text' + HTMLSpaces[i] + HTMLSpaces[j];
+ expected = 'text text';
+ shouldBe('option.text', 'expected');
+ }
+}
+debug('');
+
+debug('');
+
+debug('Insert one nonHTMLspace before/after/between the text');
+for (var i = 0; i < nonHTMLSpaces.length; ++i) {
+ option.text = nonHTMLSpaces[i] + 'text' + nonHTMLSpaces[i] + 'text' + nonHTMLSpaces[i];
+ expected = nonHTMLSpaces[i] + 'text' + nonHTMLSpaces[i] + 'text' + nonHTMLSpaces[i];
+ shouldBe('option.text', 'expected');
+}
+debug('');
+
+debug('Insert multiple nonHTMLspaces before/after/between the text');
+for (var i = 0; i < nonHTMLSpaces.length; ++i) {
+ for (var j = 0; j < nonHTMLSpaces.length; ++j) {
+ option.text = nonHTMLSpaces[i] + nonHTMLSpaces[j] + 'text' + nonHTMLSpaces[i] + nonHTMLSpaces[j] + 'text' + nonHTMLSpaces[i] + nonHTMLSpaces[j];
+ expected = nonHTMLSpaces[i] + nonHTMLSpaces[j] + 'text' + nonHTMLSpaces[i] + nonHTMLSpaces[j] + 'text' + nonHTMLSpaces[i] + nonHTMLSpaces[j];
+ shouldBe('option.text', 'expected');
+ }
+}
+debug('');
+
+
+var successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (91836 => 91837)
--- trunk/Source/_javascript_Core/ChangeLog 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-07-27 13:07:42 UTC (rev 91837)
@@ -1,3 +1,20 @@
+2011-07-27 Shinya Kawanaka <[email protected]>
+
+ Added an interface to take IsWhiteSpaceFunctionPtr.
+ https://bugs.webkit.org/show_bug.cgi?id=57746
+
+ Reviewed by Kent Tamura.
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::stripWhiteSpace):
+ Added an interface to take IsWhiteSpaceFunctionPtr.
+ (WTF::StringImpl::simplifyWhiteSpace): ditto.
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.cpp:
+ (WTF::String::stripWhiteSpace): ditto.
+ (WTF::String::simplifyWhiteSpace): ditto.
+ * wtf/text/WTFString.h:
+
2011-07-27 Filip Pizlo <[email protected]>
DFG JIT speculation failure code performs incorrect conversions in
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (91836 => 91837)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-07-27 13:07:42 UTC (rev 91837)
@@ -584,9 +584,11 @@
__ZNK3WTF6String13toInt64StrictEPbi
__ZNK3WTF6String14threadsafeCopyEv
__ZNK3WTF6String15stripWhiteSpaceEv
+__ZNK3WTF6String15stripWhiteSpaceEPFbtE
__ZNK3WTF6String16removeCharactersEPFbtE
__ZNK3WTF6String17crossThreadStringEv
__ZNK3WTF6String18simplifyWhiteSpaceEv
+__ZNK3WTF6String18simplifyWhiteSpaceEPFbtE
__ZNK3WTF6String19characterStartingAtEj
__ZNK3WTF6String4utf8Eb
__ZNK3WTF6String5asciiEv
Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp (91836 => 91837)
--- trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp 2011-07-27 13:07:42 UTC (rev 91837)
@@ -315,6 +315,11 @@
PassRefPtr<StringImpl> StringImpl::stripWhiteSpace()
{
+ return stripWhiteSpace(isSpaceOrNewline);
+}
+
+PassRefPtr<StringImpl> StringImpl::stripWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace)
+{
if (!m_length)
return empty();
@@ -322,7 +327,7 @@
unsigned end = m_length - 1;
// skip white space from start
- while (start <= end && isSpaceOrNewline(m_data[start]))
+ while (start <= end && isWhiteSpace(m_data[start]))
start++;
// only white space
@@ -330,7 +335,7 @@
return empty();
// skip white space from end
- while (end && isSpaceOrNewline(m_data[end]))
+ while (end && isWhiteSpace(m_data[end]))
end--;
if (!start && end == m_length - 1)
@@ -372,6 +377,11 @@
PassRefPtr<StringImpl> StringImpl::simplifyWhiteSpace()
{
+ return StringImpl::simplifyWhiteSpace(isSpaceOrNewline);
+}
+
+PassRefPtr<StringImpl> StringImpl::simplifyWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace)
+{
StringBuffer data(m_length);
const UChar* from = m_data;
@@ -382,12 +392,12 @@
UChar* to = data.characters();
while (true) {
- while (from != fromend && isSpaceOrNewline(*from)) {
+ while (from != fromend && isWhiteSpace(*from)) {
if (*from != ' ')
changedToSpace = true;
from++;
}
- while (from != fromend && !isSpaceOrNewline(*from))
+ while (from != fromend && !isWhiteSpace(*from))
to[outc++] = *from++;
if (from != fromend)
to[outc++] = ' ';
Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.h (91836 => 91837)
--- trunk/Source/_javascript_Core/wtf/text/StringImpl.h 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.h 2011-07-27 13:07:42 UTC (rev 91837)
@@ -61,6 +61,7 @@
typedef OwnFastMallocPtr<const UChar> SharableUChar;
typedef CrossThreadRefCounted<SharableUChar> SharedUChar;
typedef bool (*CharacterMatchFunctionPtr)(UChar);
+typedef bool (*IsWhiteSpaceFunctionPtr)(UChar);
class StringImpl : public StringImplBase {
friend struct JSC::IdentifierCStringTranslator;
@@ -288,7 +289,9 @@
PassRefPtr<StringImpl> foldCase();
PassRefPtr<StringImpl> stripWhiteSpace();
+ PassRefPtr<StringImpl> stripWhiteSpace(IsWhiteSpaceFunctionPtr);
PassRefPtr<StringImpl> simplifyWhiteSpace();
+ PassRefPtr<StringImpl> simplifyWhiteSpace(IsWhiteSpaceFunctionPtr);
PassRefPtr<StringImpl> removeCharacters(CharacterMatchFunctionPtr);
Modified: trunk/Source/_javascript_Core/wtf/text/WTFString.cpp (91836 => 91837)
--- trunk/Source/_javascript_Core/wtf/text/WTFString.cpp 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/wtf/text/WTFString.cpp 2011-07-27 13:07:42 UTC (rev 91837)
@@ -267,6 +267,13 @@
return m_impl->stripWhiteSpace();
}
+String String::stripWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace) const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->stripWhiteSpace(isWhiteSpace);
+}
+
String String::simplifyWhiteSpace() const
{
if (!m_impl)
@@ -274,6 +281,13 @@
return m_impl->simplifyWhiteSpace();
}
+String String::simplifyWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace) const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->simplifyWhiteSpace(isWhiteSpace);
+}
+
String String::removeCharacters(CharacterMatchFunctionPtr findMatch) const
{
if (!m_impl)
Modified: trunk/Source/_javascript_Core/wtf/text/WTFString.h (91836 => 91837)
--- trunk/Source/_javascript_Core/wtf/text/WTFString.h 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/_javascript_Core/wtf/text/WTFString.h 2011-07-27 13:07:42 UTC (rev 91837)
@@ -234,7 +234,9 @@
WTF_EXPORT_PRIVATE String upper() const;
WTF_EXPORT_PRIVATE String stripWhiteSpace() const;
+ WTF_EXPORT_PRIVATE String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const;
WTF_EXPORT_PRIVATE String simplifyWhiteSpace() const;
+ WTF_EXPORT_PRIVATE String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr) const;
WTF_EXPORT_PRIVATE String removeCharacters(CharacterMatchFunctionPtr) const;
template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const;
Modified: trunk/Source/WebCore/ChangeLog (91836 => 91837)
--- trunk/Source/WebCore/ChangeLog 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/WebCore/ChangeLog 2011-07-27 13:07:42 UTC (rev 91837)
@@ -1,3 +1,16 @@
+2011-07-27 Shinya Kawanaka <[email protected]>
+
+ Uses isHTMLSpace to normalize white spaces.
+ https://bugs.webkit.org/show_bug.cgi?id=57746
+
+ Reviewed by Kent Tamura.
+
+ Test: fast/forms/option-strip-unicode-spaces.html
+
+ * dom/OptionElement.cpp:
+ (WebCore::OptionElement::normalizeText):
+ Uses isHTMLSpace to trim and replace white spaces.
+
2011-05-15 Holger Hans Peter Freyther <[email protected]>
[chromium] Remove include of skia/ext/platform_canvas.h
Modified: trunk/Source/WebCore/dom/OptionElement.cpp (91836 => 91837)
--- trunk/Source/WebCore/dom/OptionElement.cpp 2011-07-27 13:01:00 UTC (rev 91836)
+++ trunk/Source/WebCore/dom/OptionElement.cpp 2011-07-27 13:07:42 UTC (rev 91837)
@@ -24,6 +24,7 @@
#include "Document.h"
#include "Element.h"
#include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
#include "HTMLOptionElement.h"
#include "OptionGroupElement.h"
#include "ScriptElement.h"
@@ -97,10 +98,11 @@
String text = document->displayStringModifiedByEncoding(src);
// In WinIE, leading and trailing whitespace is ignored in options and optgroups. We match this behavior.
- text = text.stripWhiteSpace();
+ text = text.stripWhiteSpace(isHTMLSpace);
// We want to collapse our whitespace too. This will match other browsers.
- text = text.simplifyWhiteSpace();
+ text = text.simplifyWhiteSpace(isHTMLSpace);
+
return text;
}