Title: [206309] trunk
- Revision
- 206309
- Author
- [email protected]
- Date
- 2016-09-23 09:25:42 -0700 (Fri, 23 Sep 2016)
Log Message
document.title getter does not strip / collapse the right whitespace characters
https://bugs.webkit.org/show_bug.cgi?id=162468
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Rebaseline W3C test now that more checks are passing.
* web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt:
Source/WebCore:
The document.title getter does not strip / collapse whitespace characters
as per:
- https://html.spec.whatwg.org/#document.title
This part of the specification provides more information about which
whitespace characters:
- https://html.spec.whatwg.org/#strip-and-collapse-whitespace
- https://html.spec.whatwg.org/#space-character
Firefox matches the specification. However, WebKit was stripping / collapsing
some characters it should not.
No new tests, rebaselined existing tests.
* dom/Document.cpp:
(WebCore::canonicalizedTitle):
LayoutTests:
Update existing test to reflect behavior change.
* fast/dom/Document/script-tests/document-title-get.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (206308 => 206309)
--- trunk/LayoutTests/ChangeLog 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/LayoutTests/ChangeLog 2016-09-23 16:25:42 UTC (rev 206309)
@@ -1,5 +1,16 @@
2016-09-23 Chris Dumez <[email protected]>
+ document.title getter does not strip / collapse the right whitespace characters
+ https://bugs.webkit.org/show_bug.cgi?id=162468
+
+ Reviewed by Ryosuke Niwa.
+
+ Update existing test to reflect behavior change.
+
+ * fast/dom/Document/script-tests/document-title-get.js:
+
+2016-09-23 Chris Dumez <[email protected]>
+
Align Element.insertAdjacentHTML() with the specification
https://bugs.webkit.org/show_bug.cgi?id=162479
Modified: trunk/LayoutTests/fast/dom/Document/script-tests/document-title-get.js (206308 => 206309)
--- trunk/LayoutTests/fast/dom/Document/script-tests/document-title-get.js 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/LayoutTests/fast/dom/Document/script-tests/document-title-get.js 2016-09-23 16:25:42 UTC (rev 206309)
@@ -16,7 +16,7 @@
shouldBeEqualToString("document.title","nowhitespacetitle");
debug('Test with whitespace');
-document.title = "\u0009\u000aone\u000b\u000cspace\u000d\u0020";
+document.title = "\t \r\n\fone\t \r\n\fspace\t \r\n\f";
shouldBeEqualToString("document.title","one space");
debug('Test with various whitespace lengths and fields');
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206308 => 206309)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-23 16:25:42 UTC (rev 206309)
@@ -1,5 +1,16 @@
2016-09-23 Chris Dumez <[email protected]>
+ document.title getter does not strip / collapse the right whitespace characters
+ https://bugs.webkit.org/show_bug.cgi?id=162468
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline W3C test now that more checks are passing.
+
+ * web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt:
+
+2016-09-23 Chris Dumez <[email protected]>
+
Align Element.insertAdjacentHTML() with the specification
https://bugs.webkit.org/show_bug.cgi?id=162479
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt (206308 => 206309)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt 2016-09-23 16:25:42 UTC (rev 206309)
@@ -1,5 +1,5 @@
-FAIL Removing whitespace in document.title: U+b assert_equals: expected "\va\v\vb\vc0\v" but got "a b c0"
+PASS Removing whitespace in document.title: U+b
PASS Removing whitespace in document.title: U+85
PASS Removing whitespace in document.title: U+a0
PASS Removing whitespace in document.title: U+1680
@@ -15,8 +15,8 @@
PASS Removing whitespace in document.title: U+2008
PASS Removing whitespace in document.title: U+2009
PASS Removing whitespace in document.title: U+200a
-FAIL Removing whitespace in document.title: U+2028 assert_equals: expected "
a
b
c16
" but got " a b c16"
-FAIL Removing whitespace in document.title: U+2029 assert_equals: expected "
a
b
c17
" but got " a b c17"
+PASS Removing whitespace in document.title: U+2028
+PASS Removing whitespace in document.title: U+2029
PASS Removing whitespace in document.title: U+202f
PASS Removing whitespace in document.title: U+205f
PASS Removing whitespace in document.title: U+3000
Modified: trunk/Source/WebCore/ChangeLog (206308 => 206309)
--- trunk/Source/WebCore/ChangeLog 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/Source/WebCore/ChangeLog 2016-09-23 16:25:42 UTC (rev 206309)
@@ -1,5 +1,29 @@
2016-09-23 Chris Dumez <[email protected]>
+ document.title getter does not strip / collapse the right whitespace characters
+ https://bugs.webkit.org/show_bug.cgi?id=162468
+
+ Reviewed by Ryosuke Niwa.
+
+ The document.title getter does not strip / collapse whitespace characters
+ as per:
+ - https://html.spec.whatwg.org/#document.title
+
+ This part of the specification provides more information about which
+ whitespace characters:
+ - https://html.spec.whatwg.org/#strip-and-collapse-whitespace
+ - https://html.spec.whatwg.org/#space-character
+
+ Firefox matches the specification. However, WebKit was stripping / collapsing
+ some characters it should not.
+
+ No new tests, rebaselined existing tests.
+
+ * dom/Document.cpp:
+ (WebCore::canonicalizedTitle):
+
+2016-09-23 Chris Dumez <[email protected]>
+
Align Element.insertAdjacentHTML() with the specification
https://bugs.webkit.org/show_bug.cgi?id=162479
Modified: trunk/Source/WebCore/dom/Document.cpp (206308 => 206309)
--- trunk/Source/WebCore/dom/Document.cpp 2016-09-23 16:24:35 UTC (rev 206308)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-09-23 16:25:42 UTC (rev 206309)
@@ -1535,7 +1535,7 @@
// Skip leading spaces and leading characters that would convert to spaces
for (i = 0; i < length; ++i) {
CharacterType c = characters[i];
- if (!(c <= 0x20 || c == 0x7F))
+ if (isNotHTMLSpace(c))
break;
}
@@ -1546,7 +1546,7 @@
bool previousCharWasWS = false;
for (; i < length; ++i) {
CharacterType c = characters[i];
- if (c <= 0x20 || c == 0x7F || (U_GET_GC_MASK(c) & (U_GC_ZL_MASK | U_GC_ZP_MASK))) {
+ if (isHTMLSpace(c)) {
if (previousCharWasWS)
continue;
buffer[builderIndex++] = ' ';
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes