Index: third_party/WebKit/Source/platform/fonts/CharacterEmoji.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/CharacterEmoji.cpp b/third_party/WebKit/Source/platform/fonts/CharacterEmoji.cpp |
index 5104df30f8699eb8fdc7dae9a6f9d42b67ad5628..39bf4ec7247859088e58a9c5845f068d38daedb0 100644 |
--- a/third_party/WebKit/Source/platform/fonts/CharacterEmoji.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/CharacterEmoji.cpp |
@@ -4,19 +4,24 @@ |
#include "platform/fonts/Character.h" |
+#include <unicode/uchar.h> |
+#include <unicode/uvernum.h> |
+ |
+#if defined(USING_SYSTEM_ICU) && (U_ICU_VERSION_MAJOR_NUM <= 56) |
drott
2016/04/05 19:40:40
Can we avoid #ifdef and only keep the ICU property
|
#include <unicode/uniset.h> |
+#endif |
using namespace WTF; |
using namespace Unicode; |
namespace blink { |
+// ICU 56 or earlier does not have API for Emoji properties, |
+// but Chrome's copy of ICU 56 does. |
+#if defined(USING_SYSTEM_ICU) && (U_ICU_VERSION_MAJOR_NUM <= 56) |
// The following UnicodeSet patterns were compiled from |
// http://www.unicode.org/Public/emoji/2.0//emoji-data.txt |
-// FIXME crbug.com/579552: |
-// These patterns should move to property group definitions in ICU. |
- |
static const char kEmojiTextPattern[] = |
R"([[#][*][0-9][\u00A9][\u00AE][\u203C][\u2049][\u2122][\u2139])" |
R"([\u2194-\u2199][\u21A9-\u21AA][\u231A-\u231B][\u2328][\u23CF])" |
@@ -100,7 +105,6 @@ bool Character::isEmojiEmojiPresentation(UChar32 ch) |
return emojiEmojiSet.contains(ch); |
} |
- |
bool Character::isEmojiModifierBase(UChar32 ch) |
{ |
DEFINE_STATIC_LOCAL(icu::UnicodeSet, emojieModifierBaseSet, ()); |
@@ -108,6 +112,23 @@ bool Character::isEmojiModifierBase(UChar32 ch) |
applyPatternAndFreeze(&emojieModifierBaseSet, kEmojiModifierBasePattern); |
return emojieModifierBaseSet.contains(ch); |
} |
+#else |
+bool Character::isEmojiTextPresentation(UChar32 ch) |
+{ |
+ return u_hasBinaryProperty(ch, UCHAR_EMOJI) |
+ && !u_hasBinaryProperty(ch, UCHAR_EMOJI_PRESENTATION); |
+} |
+ |
+bool Character::isEmojiEmojiPresentation(UChar32 ch) |
+{ |
+ return u_hasBinaryProperty(ch, UCHAR_EMOJI_PRESENTATION); |
+} |
+ |
+bool Character::isEmojiModifierBase(UChar32 ch) |
+{ |
+ return u_hasBinaryProperty(ch, UCHAR_EMOJI_MODIFIER_BASE); |
+} |
+#endif // defined(USING_SYSTEM_ICU) && (U_ICU_VERSION_MAJOR_NUM <= 56) |
bool Character::isEmojiKeycapBase(UChar32 ch) |
{ |