Title: [216874] trunk
Revision
216874
Author
mmaxfi...@apple.com
Date
2017-05-15 13:16:51 -0700 (Mon, 15 May 2017)

Log Message

Unicode characters which can't be rendered in any font are invisible
https://bugs.webkit.org/show_bug.cgi?id=171942
<rdar://problem/32054234>

Reviewed by Tim Horton.

Source/WebCore:

There are some Unicode characters which don't have any font on the system which can render them.
These characters should be drawn as the .notdef "tofu." This is for security and usability, as
well as what Firefox and Chrome do. However, we still shouldn't draw characters with the
Default_Ignorable_Code_Point property, because this is what CoreText does.

This behavior is also what the Unicode spec recommends: In UTR #36 Unicode Security Considerations:
http://www.unicode.org/reports/tr36/#Recommendations_General
"If there is no available glyph for a character, never show a simple "?" or omit the character."

Also relevant is the Unicode Standard section 5.3 Unknown and MIssing Characters, starting at page
marked 203 in the following: http://www.unicode.org/versions/Unicode9.0.0/ch05.pdf

Tests: fast/text/default-ignorable.html
       fast/text/unknown-char-notdef.html

* platform/graphics/WidthIterator.cpp:
(WebCore::characterMustDrawSomething):

LayoutTests:

* fast/text/default-ignorable-expected.html: Added.
* fast/text/default-ignorable.html: Added.
* fast/text/unknown-char-notdef-expected-mismatch.html: Added.
* fast/text/unknown-char-notdef.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216873 => 216874)


--- trunk/LayoutTests/ChangeLog	2017-05-15 19:54:27 UTC (rev 216873)
+++ trunk/LayoutTests/ChangeLog	2017-05-15 20:16:51 UTC (rev 216874)
@@ -1,3 +1,16 @@
+2017-05-15  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Unicode characters which can't be rendered in any font are invisible
+        https://bugs.webkit.org/show_bug.cgi?id=171942
+        <rdar://problem/32054234>
+
+        Reviewed by Tim Horton.
+
+        * fast/text/default-ignorable-expected.html: Added.
+        * fast/text/default-ignorable.html: Added.
+        * fast/text/unknown-char-notdef-expected-mismatch.html: Added.
+        * fast/text/unknown-char-notdef.html: Added.
+
 2017-05-15  Zalan Bujtas  <za...@apple.com>
 
         Simple line layout: Leading whitespace followed by a <br> produces an extra linebreak.

Added: trunk/LayoutTests/fast/text/default-ignorable-expected.html (0 => 216874)


--- trunk/LayoutTests/fast/text/default-ignorable-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/default-ignorable-expected.html	2017-05-15 20:16:51 UTC (rev 216874)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that code points which have the Default_Ignorable_Code_Point property are not rendered. The test passes if you don't see anything below.
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/default-ignorable.html (0 => 216874)


--- trunk/LayoutTests/fast/text/default-ignorable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/default-ignorable.html	2017-05-15 20:16:51 UTC (rev 216874)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that code points which have the Default_Ignorable_Code_Point property are not rendered. The test passes if you don't see anything below.
+<div style="font-size: 100px;">&#x1D173;</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/unknown-char-notdef-expected-mismatch.html (0 => 216874)


--- trunk/LayoutTests/fast/text/unknown-char-notdef-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/unknown-char-notdef-expected-mismatch.html	2017-05-15 20:16:51 UTC (rev 216874)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that code points which have no fonts to render them are drawn visibly. The test passes if you see something below.
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/unknown-char-notdef.html (0 => 216874)


--- trunk/LayoutTests/fast/text/unknown-char-notdef.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/unknown-char-notdef.html	2017-05-15 20:16:51 UTC (rev 216874)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that code points which have no fonts to render them are drawn visibly. The test passes if you see something below.
+<div style="font-size: 100px;">&#x2B616;</div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt (216873 => 216874)


--- trunk/LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt	2017-05-15 19:54:27 UTC (rev 216873)
+++ trunk/LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt	2017-05-15 20:16:51 UTC (rev 216874)
@@ -5,8 +5,8 @@
     RenderBody {BODY} at (8,8) size 784x230
       RenderBlock {DIV} at (0,0) size 784x230
         RenderBlock {DIV} at (0,0) size 784x115
-          RenderText {#text} at (0,0) size 112x115
-            text run at (0,0) width 112: "\x{E001} a \x{E001}"
+          RenderText {#text} at (0,0) size 238x115
+            text run at (0,0) width 238: "\x{E001} a \x{E001}"
         RenderBlock {DIV} at (0,115) size 784x115
-          RenderText {#text} at (0,0) size 0x115
-            text run at (0,0) width 0: "\x{E001}"
+          RenderText {#text} at (0,0) size 64x115
+            text run at (0,0) width 64: "\x{E001}"

Modified: trunk/Source/WebCore/ChangeLog (216873 => 216874)


--- trunk/Source/WebCore/ChangeLog	2017-05-15 19:54:27 UTC (rev 216873)
+++ trunk/Source/WebCore/ChangeLog	2017-05-15 20:16:51 UTC (rev 216874)
@@ -1,3 +1,29 @@
+2017-05-15  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Unicode characters which can't be rendered in any font are invisible
+        https://bugs.webkit.org/show_bug.cgi?id=171942
+        <rdar://problem/32054234>
+
+        Reviewed by Tim Horton.
+
+        There are some Unicode characters which don't have any font on the system which can render them.
+        These characters should be drawn as the .notdef "tofu." This is for security and usability, as
+        well as what Firefox and Chrome do. However, we still shouldn't draw characters with the
+        Default_Ignorable_Code_Point property, because this is what CoreText does.
+
+        This behavior is also what the Unicode spec recommends: In UTR #36 Unicode Security Considerations:
+        http://www.unicode.org/reports/tr36/#Recommendations_General
+        "If there is no available glyph for a character, never show a simple "?" or omit the character."
+
+        Also relevant is the Unicode Standard section 5.3 Unknown and MIssing Characters, starting at page
+        marked 203 in the following: http://www.unicode.org/versions/Unicode9.0.0/ch05.pdf
+
+        Tests: fast/text/default-ignorable.html
+               fast/text/unknown-char-notdef.html
+
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::characterMustDrawSomething):
+
 2017-05-15  Timothy Horton  <timothy_hor...@apple.com>
 
         Null deref under WebContentReader::readURL when interacting with a file URL

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (216873 => 216874)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2017-05-15 19:54:27 UTC (rev 216873)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2017-05-15 20:16:51 UTC (rev 216874)
@@ -162,11 +162,9 @@
     return std::make_pair(expandLeft, expandRight);
 }
 
-static bool characterMustDrawSomething(UChar32 character)
+static inline bool characterMustDrawSomething(UChar32 character)
 {
-    // u_hasBinaryProperty(character, UCHAR_EMOJI) would be better to use, but many OSes which
-    // WebKit runs on only have ICU version 55.1 or earlier. UCHAR_EMOJI was added in ICU 57.
-    return character >= 0x1F900 && character <= 0x1F9FF;
+    return !u_hasBinaryProperty(character, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
 }
 
 template <typename TextIterator>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to