Title: [266517] trunk/Source/WebCore
- Revision
- 266517
- Author
- commit-qu...@webkit.org
- Date
- 2020-09-03 08:29:57 -0700 (Thu, 03 Sep 2020)
Log Message
Use unicode macros instead of manual range checks in TextCodecUTF16
https://bugs.webkit.org/show_bug.cgi?id=216098
Patch by Alex Christensen <achristen...@webkit.org> on 2020-09-03
Reviewed by Darin Adler.
No change in behavior. Just responding to feedback from bug 216058.
* platform/text/TextCodecSingleByte.cpp: Added.
(WebCore::tableForDecoding):
(WebCore::tableForEncoding):
(WebCore::TextCodecSingleByte::encode):
(WebCore::TextCodecSingleByte::decode):
(WebCore::TextCodecSingleByte::TextCodecSingleByte):
(WebCore::TextCodecSingleByte::registerEncodingNames):
(WebCore::TextCodecSingleByte::registerCodecs):
* platform/text/TextCodecSingleByte.h: Added.
* platform/text/TextCodecUTF16.cpp:
(WebCore::TextCodecUTF16::decode):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (266516 => 266517)
--- trunk/Source/WebCore/ChangeLog 2020-09-03 14:56:24 UTC (rev 266516)
+++ trunk/Source/WebCore/ChangeLog 2020-09-03 15:29:57 UTC (rev 266517)
@@ -1,3 +1,24 @@
+2020-09-03 Alex Christensen <achristen...@webkit.org>
+
+ Use unicode macros instead of manual range checks in TextCodecUTF16
+ https://bugs.webkit.org/show_bug.cgi?id=216098
+
+ Reviewed by Darin Adler.
+
+ No change in behavior. Just responding to feedback from bug 216058.
+
+ * platform/text/TextCodecSingleByte.cpp: Added.
+ (WebCore::tableForDecoding):
+ (WebCore::tableForEncoding):
+ (WebCore::TextCodecSingleByte::encode):
+ (WebCore::TextCodecSingleByte::decode):
+ (WebCore::TextCodecSingleByte::TextCodecSingleByte):
+ (WebCore::TextCodecSingleByte::registerEncodingNames):
+ (WebCore::TextCodecSingleByte::registerCodecs):
+ * platform/text/TextCodecSingleByte.h: Added.
+ * platform/text/TextCodecUTF16.cpp:
+ (WebCore::TextCodecUTF16::decode):
+
2020-09-03 Zalan Bujtas <za...@apple.com>
[LFC][IFC] Add support for vertical-align: text-bottom
Modified: trunk/Source/WebCore/platform/text/TextCodecUTF16.cpp (266516 => 266517)
--- trunk/Source/WebCore/platform/text/TextCodecUTF16.cpp 2020-09-03 14:56:24 UTC (rev 266516)
+++ trunk/Source/WebCore/platform/text/TextCodecUTF16.cpp 2020-09-03 15:29:57 UTC (rev 266517)
@@ -76,8 +76,8 @@
processBytesShared = [&] (UChar codeUnit) {
if (m_leadSurrogate) {
auto leadSurrogate = *std::exchange(m_leadSurrogate, WTF::nullopt);
- if (codeUnit >= 0xDC00 && codeUnit <= 0xDFFF) {
- result.appendCharacter(0x10000 + ((leadSurrogate - 0xD800) << 10) + codeUnit - 0xDC00);
+ if (U16_IS_TRAIL(codeUnit)) {
+ result.appendCharacter(U16_GET_SUPPLEMENTARY(leadSurrogate, codeUnit));
return;
}
sawError = true;
@@ -85,11 +85,11 @@
processBytesShared(codeUnit);
return;
}
- if (codeUnit >= 0xD800 && codeUnit <= 0xDBFF) {
+ if (U16_IS_LEAD(codeUnit)) {
m_leadSurrogate = codeUnit;
return;
}
- if (codeUnit >= 0xDC00 && codeUnit <=0xDFFF) {
+ if (U16_IS_TRAIL(codeUnit)) {
sawError = true;
result.append(replacementCharacter);
return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes