Title: [266466] trunk
Revision
266466
Author
achristen...@apple.com
Date
2020-09-02 08:52:14 -0700 (Wed, 02 Sep 2020)

Log Message

Allow direct creation of replacement codec
https://bugs.webkit.org/show_bug.cgi?id=216063

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* web-platform-tests/encoding/replacement-encodings.any-expected.txt:
* web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt:

Source/WebCore:

Chrome and Firefox do.
Covered by a newly passing web platform test.

* platform/text/TextCodecReplacement.cpp:
(WebCore::TextCodecReplacement::registerEncodingNames):
* platform/text/TextEncoding.cpp:
(WebCore::TextEncoding::TextEncoding):

LayoutTests:

* fast/encoding/charset-replacement-expected.txt:
* fast/encoding/charset-replacement.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (266465 => 266466)


--- trunk/LayoutTests/ChangeLog	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/ChangeLog	2020-09-02 15:52:14 UTC (rev 266466)
@@ -1,3 +1,13 @@
+2020-09-02  Alex Christensen  <achristen...@webkit.org>
+
+        Allow direct creation of replacement codec
+        https://bugs.webkit.org/show_bug.cgi?id=216063
+
+        Reviewed by Youenn Fablet.
+
+        * fast/encoding/charset-replacement-expected.txt:
+        * fast/encoding/charset-replacement.html:
+
 2020-09-02  Aditya Keerthi  <akeer...@apple.com>
 
         [macOS] Update date picker when the inner control is edited

Modified: trunk/LayoutTests/fast/encoding/charset-replacement-expected.txt (266465 => 266466)


--- trunk/LayoutTests/fast/encoding/charset-replacement-expected.txt	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/fast/encoding/charset-replacement-expected.txt	2020-09-02 15:52:14 UTC (rev 266466)
@@ -1,4 +1,7 @@
-ALERT: windows-1252
-Test PASSED if the encoding of this document is the default encoding.
-Test FAILED if you see a U+FFFD character in a dumped render tree.
-
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,1) size 16x18
+        text run at (0,1) width 16: "\x{FFFD}"

Modified: trunk/LayoutTests/fast/encoding/charset-replacement.html (266465 => 266466)


--- trunk/LayoutTests/fast/encoding/charset-replacement.html	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/fast/encoding/charset-replacement.html	2020-09-02 15:52:14 UTC (rev 266466)
@@ -2,14 +2,8 @@
 <html>
 <head>
     <meta charset=rEpLaCeMeNt>
-    <script>
-    if (window.testRunner)
-        testRunner.dumpAsText();
-    alert(document.characterSet);
-    </script>
 </head>
 <body>
-    Test PASSED if the encoding of this document is the default encoding.<br>
-    Test FAILED if you see a U+FFFD character in a dumped render tree.<br>
+    Test passed if you see a U+FFFD character in a dumped render tree.<br>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (266465 => 266466)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-09-02 15:52:14 UTC (rev 266466)
@@ -1,5 +1,15 @@
 2020-09-02  Alex Christensen  <achristen...@webkit.org>
 
+        Allow direct creation of replacement codec
+        https://bugs.webkit.org/show_bug.cgi?id=216063
+
+        Reviewed by Youenn Fablet.
+
+        * web-platform-tests/encoding/replacement-encodings.any-expected.txt:
+        * web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt:
+
+2020-09-02  Alex Christensen  <achristen...@webkit.org>
+
         Align UTF-16 decoder with Chrome, Firefox, and specification
         https://bugs.webkit.org/show_bug.cgi?id=216058
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any-expected.txt (266465 => 266466)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any-expected.txt	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any-expected.txt	2020-09-02 15:52:14 UTC (rev 266466)
@@ -9,6 +9,6 @@
 PASS iso-2022-cn-ext - empty input decodes to empty output. 
 PASS iso-2022-kr - non-empty input decodes to one replacement character. 
 PASS iso-2022-kr - empty input decodes to empty output. 
-FAIL replacement - non-empty input decodes to one replacement character. assert_equals: Decoding with replacement expected "U+FFFD" but got "U+0041/U+0042/U+0043/U+0061/U+0062/U+0063/U+0031/U+0032/U+0033/U+FFFD"
+PASS replacement - non-empty input decodes to one replacement character. 
 PASS replacement - empty input decodes to empty output. 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt (266465 => 266466)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt	2020-09-02 15:52:14 UTC (rev 266466)
@@ -9,6 +9,6 @@
 PASS iso-2022-cn-ext - empty input decodes to empty output. 
 PASS iso-2022-kr - non-empty input decodes to one replacement character. 
 PASS iso-2022-kr - empty input decodes to empty output. 
-FAIL replacement - non-empty input decodes to one replacement character. assert_equals: Decoding with replacement expected "U+FFFD" but got "U+0041/U+0042/U+0043/U+0061/U+0062/U+0063/U+0031/U+0032/U+0033/U+FFFD"
+PASS replacement - non-empty input decodes to one replacement character. 
 PASS replacement - empty input decodes to empty output. 
 

Modified: trunk/Source/WebCore/ChangeLog (266465 => 266466)


--- trunk/Source/WebCore/ChangeLog	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/Source/WebCore/ChangeLog	2020-09-02 15:52:14 UTC (rev 266466)
@@ -1,3 +1,18 @@
+2020-09-02  Alex Christensen  <achristen...@webkit.org>
+
+        Allow direct creation of replacement codec
+        https://bugs.webkit.org/show_bug.cgi?id=216063
+
+        Reviewed by Youenn Fablet.
+
+        Chrome and Firefox do.
+        Covered by a newly passing web platform test.
+
+        * platform/text/TextCodecReplacement.cpp:
+        (WebCore::TextCodecReplacement::registerEncodingNames):
+        * platform/text/TextEncoding.cpp:
+        (WebCore::TextEncoding::TextEncoding):
+
 2020-09-02  Zalan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Start constructing InlineBoxes for inline runs

Modified: trunk/Source/WebCore/platform/text/TextCodecReplacement.cpp (266465 => 266466)


--- trunk/Source/WebCore/platform/text/TextCodecReplacement.cpp	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/Source/WebCore/platform/text/TextCodecReplacement.cpp	2020-09-02 15:52:14 UTC (rev 266466)
@@ -34,9 +34,6 @@
 
 void TextCodecReplacement::registerEncodingNames(EncodingNameRegistrar registrar)
 {
-    // The string 'replacement' itself is not a valid label. It is the name of
-    // a group of legacy encoding labels. Hence, it cannot be used directly.
-    // The TextEncoding class implements the above rule; here we register it normally.
     registrar("replacement", "replacement");
 
     registrar("csiso2022kr", "replacement");

Modified: trunk/Source/WebCore/platform/text/TextEncoding.cpp (266465 => 266466)


--- trunk/Source/WebCore/platform/text/TextEncoding.cpp	2020-09-02 15:50:33 UTC (rev 266465)
+++ trunk/Source/WebCore/platform/text/TextEncoding.cpp	2020-09-02 15:52:14 UTC (rev 266466)
@@ -47,9 +47,6 @@
     : m_name(atomCanonicalTextEncodingName(name))
     , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
 {
-    // Aliases are valid, but not "replacement" itself.
-    if (equalLettersIgnoringASCIICase(name, "replacement"))
-        m_name = nullptr;
 }
 
 TextEncoding::TextEncoding(const String& name)
@@ -56,9 +53,6 @@
     : m_name(atomCanonicalTextEncodingName(name))
     , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
 {
-    // Aliases are valid, but not "replacement" itself.
-    if (equalLettersIgnoringASCIICase(name, "replacement"))
-        m_name = nullptr;
 }
 
 String TextEncoding::decode(const char* data, size_t length, bool stopOnError, bool& sawError) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to