Changeset 216874 in webkit


Ignore:
Timestamp:
May 15, 2017 1:16:51 PM (7 years ago)
Author:
mmaxfield@apple.com
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.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r216861 r216874  
     12017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Unicode characters which can't be rendered in any font are invisible
     4        https://bugs.webkit.org/show_bug.cgi?id=171942
     5        <rdar://problem/32054234>
     6
     7        Reviewed by Tim Horton.
     8
     9        * fast/text/default-ignorable-expected.html: Added.
     10        * fast/text/default-ignorable.html: Added.
     11        * fast/text/unknown-char-notdef-expected-mismatch.html: Added.
     12        * fast/text/unknown-char-notdef.html: Added.
     13
    1142017-05-15  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt

    r185175 r216874  
    66      RenderBlock {DIV} at (0,0) size 784x230
    77        RenderBlock {DIV} at (0,0) size 784x115
    8           RenderText {#text} at (0,0) size 112x115
    9             text run at (0,0) width 112: "\x{E001} a \x{E001}"
     8          RenderText {#text} at (0,0) size 238x115
     9            text run at (0,0) width 238: "\x{E001} a \x{E001}"
    1010        RenderBlock {DIV} at (0,115) size 784x115
    11           RenderText {#text} at (0,0) size 0x115
    12             text run at (0,0) width 0: "\x{E001}"
     11          RenderText {#text} at (0,0) size 64x115
     12            text run at (0,0) width 64: "\x{E001}"
  • trunk/Source/WebCore/ChangeLog

    r216868 r216874  
     12017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Unicode characters which can't be rendered in any font are invisible
     4        https://bugs.webkit.org/show_bug.cgi?id=171942
     5        <rdar://problem/32054234>
     6
     7        Reviewed by Tim Horton.
     8
     9        There are some Unicode characters which don't have any font on the system which can render them.
     10        These characters should be drawn as the .notdef "tofu." This is for security and usability, as
     11        well as what Firefox and Chrome do. However, we still shouldn't draw characters with the
     12        Default_Ignorable_Code_Point property, because this is what CoreText does.
     13
     14        This behavior is also what the Unicode spec recommends: In UTR #36 Unicode Security Considerations:
     15        http://www.unicode.org/reports/tr36/#Recommendations_General
     16        "If there is no available glyph for a character, never show a simple "?" or omit the character."
     17
     18        Also relevant is the Unicode Standard section 5.3 Unknown and MIssing Characters, starting at page
     19        marked 203 in the following: http://www.unicode.org/versions/Unicode9.0.0/ch05.pdf
     20
     21        Tests: fast/text/default-ignorable.html
     22               fast/text/unknown-char-notdef.html
     23
     24        * platform/graphics/WidthIterator.cpp:
     25        (WebCore::characterMustDrawSomething):
     26
    1272017-05-15  Timothy Horton  <timothy_horton@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r211738 r216874  
    163163}
    164164
    165 static bool characterMustDrawSomething(UChar32 character)
    166 {
    167     // u_hasBinaryProperty(character, UCHAR_EMOJI) would be better to use, but many OSes which
    168     // WebKit runs on only have ICU version 55.1 or earlier. UCHAR_EMOJI was added in ICU 57.
    169     return character >= 0x1F900 && character <= 0x1F9FF;
     165static inline bool characterMustDrawSomething(UChar32 character)
     166{
     167    return !u_hasBinaryProperty(character, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
    170168}
    171169
Note: See TracChangeset for help on using the changeset viewer.