Diff
Modified: trunk/LayoutTests/ChangeLog (239821 => 239822)
--- trunk/LayoutTests/ChangeLog 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/LayoutTests/ChangeLog 2019-01-10 10:03:53 UTC (rev 239822)
@@ -1,3 +1,15 @@
+2019-01-10 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [FreeType] Color emoji not properly supported
+ https://bugs.webkit.org/show_bug.cgi?id=191976
+
+ Reviewed by Michael Catanzaro.
+
+ Add new test to ensure we fallback to noto color emoji for emojis.
+
+ * platform/gtk/fonts/font-emoji-system-fallback-expected.html: Added.
+ * platform/gtk/fonts/font-emoji-system-fallback.html: Added.
+
2019-01-10 cathie chen <cathiec...@igalia.com>
Import css-lists testcases from WPT.
Added: trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback-expected.html (0 => 239822)
--- trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback-expected.html (rev 0)
+++ trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback-expected.html 2019-01-10 10:03:53 UTC (rev 239822)
@@ -0,0 +1,2 @@
+<span style="font-family: 'Noto Color Emoji';">😁</span>
+
Added: trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback.html (0 => 239822)
--- trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback.html (rev 0)
+++ trunk/LayoutTests/platform/gtk/fonts/font-emoji-system-fallback.html 2019-01-10 10:03:53 UTC (rev 239822)
@@ -0,0 +1 @@
+😁
Modified: trunk/Source/WTF/ChangeLog (239821 => 239822)
--- trunk/Source/WTF/ChangeLog 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WTF/ChangeLog 2019-01-10 10:03:53 UTC (rev 239822)
@@ -1,3 +1,14 @@
+2019-01-10 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [FreeType] Color emoji not properly supported
+ https://bugs.webkit.org/show_bug.cgi?id=191976
+
+ Reviewed by Michael Catanzaro.
+
+ Add a name for combining enclosing keycap character.
+
+ * wtf/unicode/CharacterNames.h:
+
2019-01-09 Carlos Eduardo Ramalho <cadubent...@gmail.com> and Fujii Hironori <hironori.fu...@sony.com>
Use directory local sequential numbers for Unified Sources filenames instead of global sequential numbers for CMake
Modified: trunk/Source/WTF/wtf/unicode/CharacterNames.h (239821 => 239822)
--- trunk/Source/WTF/wtf/unicode/CharacterNames.h 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WTF/wtf/unicode/CharacterNames.h 2019-01-10 10:03:53 UTC (rev 239822)
@@ -46,6 +46,7 @@
const UChar bullet = 0x2022;
const UChar bullseye = 0x25CE;
const UChar carriageReturn = 0x000D;
+const UChar combiningEnclosingKeycap = 0x20E3;
const UChar ethiopicPrefaceColon = 0x1366;
const UChar ethiopicWordspace = 0x1361;
const UChar firstStrongIsolate = 0x2068;
@@ -114,6 +115,7 @@
using WTF::Unicode::bullet;
using WTF::Unicode::bullseye;
using WTF::Unicode::carriageReturn;
+using WTF::Unicode::combiningEnclosingKeycap;
using WTF::Unicode::ethiopicPrefaceColon;
using WTF::Unicode::ethiopicWordspace;
using WTF::Unicode::firstStrongIsolate;
Modified: trunk/Source/WebCore/ChangeLog (239821 => 239822)
--- trunk/Source/WebCore/ChangeLog 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/ChangeLog 2019-01-10 10:03:53 UTC (rev 239822)
@@ -1,3 +1,44 @@
+2019-01-10 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [FreeType] Color emoji not properly supported
+ https://bugs.webkit.org/show_bug.cgi?id=191976
+
+ Reviewed by Michael Catanzaro.
+
+ Always try to fallback to a colored font for emojis.
+
+ Test: platform/gtk/fonts/font-emoji-system-fallback.html
+
+ * platform/graphics/ComplexTextController.cpp:
+ (WebCore::advanceByCombiningCharacterSequence): Group regional indicators in pairs.
+ * platform/graphics/Font.cpp:
+ (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
+ (WebCore::Font::systemFallbackFontForCharacter const): Pass PreferColoredFont::No to FontCache::systemFallbackForCharacters.
+ * platform/graphics/Font.h: Add IsForPlatformFont enum to replace the bool parameter in systemFallbackFontForCharacter().
+ * platform/graphics/FontCache.h:
+ * platform/graphics/FontCascadeFonts.cpp:
+ (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
+ * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+ (WebCore::characterSequenceIsEmoji): Check whether the character sequence is an emoji.
+ (WebCore::FontCascade::fontForCombiningCharacterSequence const): In case of emojis try to fallback to a colored
+ font even if base font can render the emoji in black and white.
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
+ * platform/graphics/freetype/FontCacheFreeType.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter.
+ * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+ (WebCore::FontPlatformData::FontPlatformData): Initialize m_isColorBitmapFont.
+ * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+ (WebCore::Font::variantCapsSupportsCharacterForSynthesis const): Moved from cross-platform file.
+ (WebCore::Font::platformSupportsCodePoint const): Add freetype implementation.
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
+ * platform/text/CharacterProperties.h:
+ (WebCore::isEmojiKeycapBase):
+ (WebCore::isEmojiRegionalIndicator):
+ (WebCore::isEmojiWithPresentationByDefault):
+ (WebCore::isEmojiModifierBase):
+
2019-01-09 Antoine Quint <grao...@apple.com>
[Web Animations] Audit Web Animations classes for memory reduction
Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -286,6 +286,7 @@
// Consume marks.
bool sawEmojiGroupCandidate = isEmojiGroupCandidate(baseCharacter);
bool sawJoiner = false;
+ bool sawRegionalIndicator = isEmojiRegionalIndicator(baseCharacter);
while (iterator < end) {
UChar32 nextCharacter;
unsigned markLength = 0;
@@ -296,6 +297,11 @@
if (isVariationSelector(nextCharacter) || isEmojiFitzpatrickModifier(nextCharacter))
shouldContinue = true;
+ if (sawRegionalIndicator && isEmojiRegionalIndicator(nextCharacter)) {
+ shouldContinue = true;
+ sawRegionalIndicator = false;
+ }
+
if (sawJoiner && isEmojiGroupCandidate(nextCharacter))
shouldContinue = true;
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -502,10 +502,10 @@
{
}
- CharacterFallbackMapKey(const AtomicString& locale, UChar32 character, bool isForPlatformFont)
+ CharacterFallbackMapKey(const AtomicString& locale, UChar32 character, IsForPlatformFont isForPlatformFont)
: locale(locale)
, character(character)
- , isForPlatformFont(isForPlatformFont)
+ , isForPlatformFont(isForPlatformFont == IsForPlatformFont::Yes)
{
}
@@ -560,13 +560,13 @@
return map.get();
}
-RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, bool isForPlatformFont) const
+RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont) const
{
auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap());
if (!character) {
UChar codeUnit = 0;
- return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, &codeUnit, 1);
+ return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1);
}
auto key = CharacterFallbackMapKey(description.locale(), character, isForPlatformFont);
@@ -586,7 +586,7 @@
codeUnitsLength = 2;
}
- fallbackFont = FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, codeUnits, codeUnitsLength).get();
+ fallbackFont = FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get();
if (fallbackFont)
fallbackFont->m_isUsedInSystemFallbackCache = true;
}
@@ -612,7 +612,7 @@
}
}
-#if !PLATFORM(COCOA)
+#if !PLATFORM(COCOA) && !USE(FREETYPE)
bool Font::variantCapsSupportsCharacterForSynthesis(FontVariantCaps fontVariantCaps, UChar32) const
{
switch (fontVariantCaps) {
Modified: trunk/Source/WebCore/platform/graphics/Font.h (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/Font.h 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2019-01-10 10:03:53 UTC (rev 239822)
@@ -65,6 +65,7 @@
enum FontVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
+enum class IsForPlatformFont : uint8_t { No, Yes };
class Font : public RefCounted<Font> {
public:
@@ -176,7 +177,7 @@
bool supportsCodePoint(UChar32) const;
bool platformSupportsCodePoint(UChar32) const;
- RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, bool isForPlatformFont) const;
+ RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont) const;
const GlyphPage* glyphPage(unsigned pageNumber) const;
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2019-01-10 10:03:53 UTC (rev 239822)
@@ -60,6 +60,7 @@
class FontSelector;
class OpenTypeVerticalData;
class Font;
+enum class IsForPlatformFont : uint8_t;
#if PLATFORM(WIN)
#if USE(IMLANG_FONT_LINK2)
@@ -190,7 +191,8 @@
WEBCORE_EXPORT static FontCache& singleton();
// These methods are implemented by the platform.
- RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length);
+ enum class PreferColoredFont : uint8_t { No, Yes };
+ RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, IsForPlatformFont, PreferColoredFont, const UChar* characters, unsigned length);
Vector<String> systemFontFamilies();
void platformInit();
Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -345,7 +345,7 @@
if (!font)
font = &realizeFallbackRangesAt(description, 0).fontForFirstRange();
- auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont);
+ auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No);
if (!systemFallbackFont)
return GlyphData();
Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -29,6 +29,7 @@
#if USE(CAIRO)
+#include "CharacterProperties.h"
#include "FontCache.h"
#include "SurrogatePairAwareTextIterator.h"
#include <unicode/normlzr.h>
@@ -45,6 +46,60 @@
return false;
}
+static bool characterSequenceIsEmoji(const Vector<UChar, 4>& normalizedCharacters, int32_t normalizedLength)
+{
+ UChar32 character;
+ unsigned clusterLength = 0;
+ SurrogatePairAwareTextIterator iterator(normalizedCharacters.data(), 0, normalizedLength, normalizedLength);
+ if (!iterator.consume(character, clusterLength))
+ return false;
+
+ if (isEmojiKeycapBase(character)) {
+ iterator.advance(clusterLength);
+ UChar32 nextCharacter;
+ if (!iterator.consume(nextCharacter, clusterLength))
+ return false;
+
+ if (nextCharacter == combiningEnclosingKeycap)
+ return true;
+
+ // Variation selector 16.
+ if (nextCharacter == 0xFE0F) {
+ iterator.advance(clusterLength);
+ if (!iterator.consume(nextCharacter, clusterLength))
+ return false;
+
+ if (nextCharacter == combiningEnclosingKeycap)
+ return true;
+ }
+
+ return false;
+ }
+
+ // Regional indicator.
+ if (isEmojiRegionalIndicator(character)) {
+ iterator.advance(clusterLength);
+ UChar32 nextCharacter;
+ if (!iterator.consume(nextCharacter, clusterLength))
+ return false;
+
+ if (isEmojiRegionalIndicator(nextCharacter))
+ return true;
+
+ return false;
+ }
+
+ if (character == combiningEnclosingKeycap)
+ return true;
+
+ if (isEmojiWithPresentationByDefault(character)
+ || isEmojiModifierBase(character)
+ || isEmojiFitzpatrickModifier(character))
+ return true;
+
+ return false;
+}
+
const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length) const
{
UErrorCode error = U_ZERO_ERROR;
@@ -61,8 +116,12 @@
if (!iterator.consume(character, clusterLength))
return nullptr;
+ bool isEmoji = characterSequenceIsEmoji(normalizedCharacters, normalizedLength);
+
const Font* baseFont = glyphDataForCharacter(character, false, NormalVariant).font;
- if (baseFont && (static_cast<int32_t>(clusterLength) == normalizedLength || baseFont->canRenderCombiningCharacterSequence(characters, length)))
+ if (baseFont
+ && (static_cast<int32_t>(clusterLength) == normalizedLength || baseFont->canRenderCombiningCharacterSequence(characters, length))
+ && (!isEmoji || baseFont->platformData().isColorBitmapFont()))
return baseFont;
for (unsigned i = 0; !fallbackRangesAt(i).isNull(); ++i) {
@@ -70,12 +129,12 @@
if (!fallbackFont || fallbackFont == baseFont)
continue;
- if (fallbackFont->canRenderCombiningCharacterSequence(characters, length))
+ if (fallbackFont->canRenderCombiningCharacterSequence(characters, length) && (!isEmoji || fallbackFont->platformData().isColorBitmapFont()))
return fallbackFont;
}
- if (auto systemFallback = FontCache::singleton().systemFallbackForCharacters(m_fontDescription, baseFont, false, characters, length)) {
- if (systemFallback->canRenderCombiningCharacterSequence(characters, length))
+ if (auto systemFallback = FontCache::singleton().systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, isEmoji ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) {
+ if (systemFallback->canRenderCombiningCharacterSequence(characters, length) && (!isEmoji || systemFallback->platformData().isColorBitmapFont()))
return systemFallback.get();
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -1354,7 +1354,7 @@
return result;
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, IsForPlatformFont isForPlatformFont, PreferColoredFont, const UChar* characters, unsigned length)
{
#if PLATFORM(IOS_FAMILY)
if (length && requiresCustomFallbackFont(*characters)) {
@@ -1383,7 +1383,7 @@
CTFontRef substituteFont = fallbackDedupSet().add(result).iterator->get();
bool syntheticBold, syntheticOblique;
- std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(substituteFont, description, isPlatformFont).boldObliquePair();
+ std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(substituteFont, description, isForPlatformFont == IsForPlatformFont::Yes).boldObliquePair();
FontPlatformData alternateFont(substituteFont, platformData.size(), syntheticBold, syntheticOblique, platformData.orientation(), platformData.widthVariant(), platformData.textRenderingMode());
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -118,7 +118,7 @@
}
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font*, bool, const UChar* characters, unsigned length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font*, IsForPlatformFont, PreferColoredFont preferColoredFont, const UChar* characters, unsigned length)
{
FcUniquePtr<FcCharSet> fontConfigCharSet(FcCharSetCreate());
UTF16UChar32Iterator iterator(characters, length);
@@ -132,6 +132,8 @@
FcPatternAddCharSet(pattern.get(), FC_CHARSET, fontConfigCharSet.get());
FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue);
+ if (preferColoredFont == PreferColoredFont::Yes)
+ FcPatternAddBool(pattern.get(), FC_COLOR, FcTrue);
if (!configurePatternForFontDescription(pattern.get(), description))
return nullptr;
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -32,6 +32,7 @@
#include <cairo-ft.h>
#include <fontconfig/fcfreetype.h>
#include <ft2build.h>
+#include FT_FREETYPE_H
#include FT_TRUETYPE_TABLES_H
#include <hb-ft.h>
#include <hb-ot.h>
@@ -117,6 +118,12 @@
m_fixedWidth = fixedWidth;
buildScaledFont(fontFace);
+
+#ifdef FT_HAS_COLOR
+ CairoFtFaceLocker cairoFtFaceLocker(m_scaledFont.get());
+ if (FT_Face ftFace = cairoFtFaceLocker.ftFace())
+ m_isColorBitmapFont = FT_HAS_COLOR(ftFace);
+#endif
}
FontPlatformData::FontPlatformData(const FontPlatformData& other)
Modified: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -188,4 +188,27 @@
return width ? width : m_spaceWidth;
}
+bool Font::variantCapsSupportsCharacterForSynthesis(FontVariantCaps fontVariantCaps, UChar32) const
+{
+ switch (fontVariantCaps) {
+ case FontVariantCaps::Small:
+ case FontVariantCaps::Petite:
+ case FontVariantCaps::AllSmall:
+ case FontVariantCaps::AllPetite:
+ return false;
+ default:
+ // Synthesis only supports the variant-caps values listed above.
+ return true;
+ }
}
+
+bool Font::platformSupportsCodePoint(UChar32 character) const
+{
+ CairoFtFaceLocker cairoFtFaceLocker(m_platformData.scaledFont());
+ if (FT_Face face = cairoFtFaceLocker.ftFace())
+ return !!FcFreeTypeCharIndex(face, character);
+
+ return false;
+}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (239821 => 239822)
--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2019-01-10 10:03:53 UTC (rev 239822)
@@ -211,7 +211,7 @@
return hfont;
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, unsigned length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, IsForPlatformFont, PreferColoredFont, const UChar* characters, unsigned length)
{
UChar character = characters[0];
RefPtr<Font> fontData;
Modified: trunk/Source/WebCore/platform/text/CharacterProperties.h (239821 => 239822)
--- trunk/Source/WebCore/platform/text/CharacterProperties.h 2019-01-10 10:01:14 UTC (rev 239821)
+++ trunk/Source/WebCore/platform/text/CharacterProperties.h 2019-01-10 10:03:53 UTC (rev 239822)
@@ -76,4 +76,34 @@
return character >= 0xFE00 && character <= 0xFE0F;
}
+inline bool isEmojiKeycapBase(UChar32 character)
+{
+ return (character >= '0' && character <= '9') || character == '#' || character == '*';
}
+
+inline bool isEmojiRegionalIndicator(UChar32 character)
+{
+ return character >= 0x1F1E6 && character <= 0x1F1FF;
+}
+
+inline bool isEmojiWithPresentationByDefault(UChar32 character)
+{
+#if U_ICU_VERSION_MAJOR_NUM >= 57
+ return u_hasBinaryProperty(character, UCHAR_EMOJI_PRESENTATION);
+#else
+ UNUSED_PARAM(character);
+ return false;
+#endif
+}
+
+inline bool isEmojiModifierBase(UChar32 character)
+{
+#if U_ICU_VERSION_MAJOR_NUM >= 57
+ return u_hasBinaryProperty(character, UCHAR_EMOJI_MODIFIER_BASE);
+#else
+ UNUSED_PARAM(character);
+ return false;
+#endif
+}
+
+}