Diff
Modified: trunk/LayoutTests/ChangeLog (188736 => 188737)
--- trunk/LayoutTests/ChangeLog 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/LayoutTests/ChangeLog 2015-08-21 02:12:01 UTC (rev 188737)
@@ -1,3 +1,12 @@
+2015-08-20 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [iOS] Adopt OS X's emoji behavior
+ https://bugs.webkit.org/show_bug.cgi?id=148265
+
+ Reviewed by Simon Fraser.
+
+ * platform/ios-simulator/fast/text/emoji-expected.txt:
+
2015-08-20 Chris Dumez <cdu...@apple.com>
getElementsByClassName() should return an HTMLCollection
Modified: trunk/LayoutTests/platform/ios-simulator/fast/text/emoji-expected.txt (188736 => 188737)
--- trunk/LayoutTests/platform/ios-simulator/fast/text/emoji-expected.txt 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/emoji-expected.txt 2015-08-21 02:12:01 UTC (rev 188737)
@@ -7,20 +7,20 @@
RenderText {#text} at (0,0) size 471x19
text run at (0,0) width 471: "This test validate rendering of emoji sequences and emoji with modifiers."
RenderBlock {DIV} at (0,20) size 784x27
- RenderText {#text} at (0,8) size 21x10
- text run at (0,8) width 21: "\x{D83D}\x{DE01}"
- RenderBlock {DIV} at (0,47) size 784x295
- RenderText {#text} at (0,1) size 105x41
- text run at (0,1) width 105: "\x{D83D}\x{DC66}\x{D83C}\x{DFFB}\x{D83D}\x{DC69}\x{D83C}\x{DFFC}\x{D83D}\x{DC66}\x{D83C}\x{DFFE}\x{2764}\x{FE0F}\x{D83D}\x{DC8B}"
- RenderBR {BR} at (105,34) size 0x0
- RenderText {#text} at (0,60) size 153x41
- text run at (0,60) width 153: "\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC6A} \x{D83D}\x{DC66}\x{D83C}\x{DFFB}\x{D83D}\x{DC69}\x{D83C}\x{DFFC}\x{D83D}\x{DC66}\x{D83C}\x{DFFE}"
- RenderBR {BR} at (153,93) size 0x0
- RenderText {#text} at (0,119) size 141x41
- text run at (0,119) width 141: "\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC67}"
- RenderBR {BR} at (141,152) size 0x0
- RenderText {#text} at (0,178) size 141x41
- text run at (0,178) width 141: "\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC66}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC67}"
- RenderBR {BR} at (141,211) size 0x0
- RenderText {#text} at (0,237) size 141x41
- text run at (0,237) width 141: "\x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC69} \x{D83D}\x{DC68}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC68} \x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC8B}\x{200D}\x{D83D}\x{DC69} \x{D83D}\x{DC68}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC8B}\x{200D}\x{D83D}\x{DC68} \x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC69}"
+ RenderText {#text} at (0,0) size 16x27
+ text run at (0,0) width 16: "\x{D83D}\x{DE01}"
+ RenderBlock {DIV} at (0,47) size 784x245
+ RenderText {#text} at (0,4) size 180x41
+ text run at (0,4) width 180: "\x{D83D}\x{DC66}\x{D83C}\x{DFFB}\x{D83D}\x{DC69}\x{D83C}\x{DFFC}\x{D83D}\x{DC66}\x{D83C}\x{DFFE}\x{2764}\x{FE0F}\x{D83D}\x{DC8B}"
+ RenderBR {BR} at (180,37) size 0x0
+ RenderText {#text} at (0,53) size 243x41
+ text run at (0,53) width 243: "\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC6A} \x{D83D}\x{DC66}\x{D83C}\x{DFFB}\x{D83D}\x{DC69}\x{D83C}\x{DFFC}\x{D83D}\x{DC66}\x{D83C}\x{DFFE}"
+ RenderBR {BR} at (243,86) size 0x0
+ RenderText {#text} at (0,102) size 216x41
+ text run at (0,102) width 216: "\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC66}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC69}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC67}"
+ RenderBR {BR} at (216,135) size 0x0
+ RenderText {#text} at (0,151) size 216x41
+ text run at (0,151) width 216: "\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC66}\x{200D}\x{D83D}\x{DC66} \x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC68}\x{200D}\x{D83D}\x{DC67}\x{200D}\x{D83D}\x{DC67}"
+ RenderBR {BR} at (216,184) size 0x0
+ RenderText {#text} at (0,200) size 216x41
+ text run at (0,200) width 216: "\x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC69} \x{D83D}\x{DC68}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC68} \x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC8B}\x{200D}\x{D83D}\x{DC69} \x{D83D}\x{DC68}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC8B}\x{200D}\x{D83D}\x{DC68} \x{D83D}\x{DC69}\x{200D}\x{2764}\x{FE0F}\x{200D}\x{D83D}\x{DC69}"
Modified: trunk/Source/WebCore/ChangeLog (188736 => 188737)
--- trunk/Source/WebCore/ChangeLog 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/ChangeLog 2015-08-21 02:12:01 UTC (rev 188737)
@@ -1,3 +1,38 @@
+2015-08-20 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [iOS] Adopt OS X's emoji behavior.
+ https://bugs.webkit.org/show_bug.cgi?id=148265
+
+ Reviewed by Simon Fraser.
+
+ Remove our hardcoded hacks which limit the sizes of emoji. This is how
+ OS X behaves with emoji.
+
+ Test: fast/text/emoji.html
+
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::hash):
+ (WebCore::FontPlatformData::isEmoji): Deleted.
+ (WebCore::FontPlatformData::setIsEmoji): Deleted.
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::drawGlyphs):
+ (WebCore::isOnOrAfterIOS6): Deleted.
+ (WebCore::pointAdjustedForEmoji): Deleted.
+ * platform/graphics/cocoa/FontCocoa.mm:
+ (WebCore::canUseFastGlyphAdvanceGetter):
+ (WebCore::Font::platformInit): Deleted.
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::ctFont):
+ (WebCore::FontPlatformData::platformDataInit): Deleted.
+ (WebCore::FontPlatformData::platformDataAssign): Deleted.
+ (WebCore::FontPlatformData::platformIsEqual): Deleted.
+ (WebCore::FontPlatformData::ctFontSize): Deleted.
+ * platform/graphics/ios/FontCacheIOS.mm:
+ (WebCore::FontCache::getSystemFontFallbackForCharacters): Deleted.
+ (WebCore::FontCache::createFontPlatformData): Deleted.
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Deleted.
+
2015-08-20 Chris Dumez <cdu...@apple.com>
getElementsByClassName() should return an HTMLCollection
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2015-08-21 02:12:01 UTC (rev 188737)
@@ -151,8 +151,7 @@
#if PLATFORM(WIN) && !USE(CAIRO)
return m_font ? m_font->hash() : 0;
#elif OS(DARWIN)
- ASSERT(m_font || !m_cgFont || isEmoji());
- uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 6 | m_textRenderingMode << 4 | isEmoji() << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
+ uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
#if USE(APPKIT)
uintptr_t fontHash = (uintptr_t)m_font.get();
#else
@@ -193,14 +192,6 @@
String description() const;
#endif
-#if PLATFORM(IOS)
- bool isEmoji() const { return m_isEmoji; }
- void setIsEmoji(bool isEmoji) { m_isEmoji = isEmoji; }
-#elif PLATFORM(MAC)
- bool isEmoji() const { return false; }
- void setIsEmoji(bool) { }
-#endif
-
private:
bool platformIsEqual(const FontPlatformData&) const;
void platformDataInit(const FontPlatformData&);
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-08-21 02:12:01 UTC (rev 188737)
@@ -246,48 +246,6 @@
}
#endif
-static inline bool isOnOrAfterIOS6()
-{
-#if PLATFORM(IOS)
- return iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_6_0);
-#else
- ASSERT_NOT_REACHED();
- return false;
-#endif
-}
-
-static FloatPoint pointAdjustedForEmoji(const FontPlatformData& platformData, FloatPoint point)
-{
- if (!platformData.isEmoji())
- return point;
-
- // Mimic the positioining of non-bitmap glyphs, which are not subpixel-positioned.
- point.setY(ceilf(point.y()));
-
- // Emoji glyphs snap to the CSS pixel grid.
- point.setX(floorf(point.x()));
-
- // Emoji glyphs are offset one CSS pixel to the right.
- point.move(1, 0);
-
- // Emoji glyphs are offset vertically based on font size.
- float fontSize = platformData.size();
- float y = point.y();
- if (fontSize <= 15) {
- // Undo Core Text's y adjustment.
- static float yAdjustmentFactor = isOnOrAfterIOS6() ? .19 : .1;
- point.setY(floorf(y - yAdjustmentFactor * (fontSize + 2) + 2));
- } else {
- if (fontSize < 26)
- y -= .35f * fontSize - 10;
-
- // Undo Core Text's y adjustment.
- static float yAdjustment = isOnOrAfterIOS6() ? 3.8 : 2;
- point.setY(floorf(y - yAdjustment));
- }
- return point;
-}
-
void FontCascade::drawGlyphs(GraphicsContext* context, const Font* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
{
const FontPlatformData& platformData = font->platformData();
@@ -362,7 +320,7 @@
CGContextSetFont(cgContext, platformData.cgFont());
bool useLetterpressEffect = shouldUseLetterpressEffect(*context);
- FloatPoint point = pointAdjustedForEmoji(platformData, anchorPoint);
+ FloatPoint point = anchorPoint;
#if PLATFORM(IOS)
float fontSize = platformData.size();
@@ -422,7 +380,7 @@
// If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative.
float shadowTextY = point.y() + shadowOffset.height() * (context->shadowsIgnoreTransforms() ? -1 : 1);
showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
- if (syntheticBoldOffset && !platformData.isEmoji())
+ if (syntheticBoldOffset)
showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
context->setFillColor(fillColor, fillColorSpace);
}
@@ -431,7 +389,7 @@
showLetterpressedGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
else
showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
- if (syntheticBoldOffset && !platformData.isEmoji())
+ if (syntheticBoldOffset)
showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
if (hasSimpleShadow)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2015-08-21 02:12:01 UTC (rev 188737)
@@ -239,13 +239,6 @@
if (platformData().orientation() == Vertical && !isTextOrientationFallback())
m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont());
-
- if (m_platformData.isEmoji()) {
- int thirdOfSize = m_platformData.size() / 3;
- m_fontMetrics.setAscent(thirdOfSize);
- m_fontMetrics.setDescent(thirdOfSize);
- m_fontMetrics.setLineGap(thirdOfSize);
- }
#endif
}
@@ -431,7 +424,7 @@
{
const FontPlatformData& platformData = font.platformData();
// Fast getter doesn't doesn't work for emoji, bitmap fonts, or take custom tracking into account
- if (font.hasCustomTracking() || platformData.isEmoji() || platformData.textRenderingMode() == OptimizeLegibility)
+ if (font.hasCustomTracking() || platformData.textRenderingMode() == OptimizeLegibility)
return false;
if (advanceForColorBitmapFont(platformData, glyph, advance)) {
populatedAdvance = true;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2015-08-21 02:12:01 UTC (rev 188737)
@@ -57,7 +57,6 @@
{
m_font = f.m_font;
- setIsEmoji(f.isEmoji());
m_cgFont = f.m_cgFont;
m_ctFont = f.m_ctFont;
}
@@ -65,7 +64,6 @@
const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformData& f)
{
m_cgFont = f.m_cgFont;
- setIsEmoji(f.isEmoji());
if (m_font && f.m_font && CFEqual(m_font.get(), f.m_font.get()))
return *this;
m_font = f.m_font;
@@ -83,10 +81,8 @@
#else
result = m_font == other.m_font;
#endif
- ASSERT(!result || isEmoji() == other.isEmoji());
return result;
}
- ASSERT(m_cgFont != other.m_cgFont || isEmoji() == other.isEmoji());
return m_cgFont == other.m_cgFont;
}
@@ -165,12 +161,6 @@
return descriptor;
}
-CGFloat FontPlatformData::ctFontSize() const
-{
- // On iOS, Apple Color Emoji size is adjusted (and then re-adjusted by Core Text) and capped.
- return !isEmoji() ? m_size : m_size <= 15 ? 4 * (m_size + 2) / static_cast<CGFloat>(5) : 16;
-}
-
CTFontRef FontPlatformData::ctFont() const
{
if (m_ctFont)
@@ -182,12 +172,12 @@
CTFontDescriptorRef fontDescriptor;
RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_ctFont.get()));
fontDescriptor = cascadeToLastResortFontDescriptor();
- m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), ctFontSize(), 0, fontDescriptor));
+ m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), m_size, 0, fontDescriptor));
} else {
#if CORETEXT_WEB_FONTS
ASSERT_NOT_REACHED();
#endif
- m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), ctFontSize(), 0, cascadeToLastResortFontDescriptor()));
+ m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
}
if (m_widthVariant != RegularWidth) {
Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2015-08-21 02:12:01 UTC (rev 188737)
@@ -81,7 +81,6 @@
bool syntheticOblique = (originalTraits & kCTFontTraitItalic) && !(actualTraits & kCTFontTraitItalic);
FontPlatformData alternateFont(substituteFont.get(), platformData.size(), syntheticBold, syntheticOblique, platformData.m_orientation);
- alternateFont.setIsEmoji(CTFontIsAppleColorEmoji(substituteFont.get()));
return fontForPlatformData(alternateFont);
}
@@ -386,8 +385,6 @@
bool syntheticOblique = (fontDescription.fontSynthesis() & FontSynthesisStyle) && (traits & kCTFontTraitItalic) && !(actualTraits & kCTFontTraitItalic) && !isAppleColorEmoji;
auto result = std::make_unique<FontPlatformData>(ctFont.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode());
- if (isAppleColorEmoji)
- result->setIsEmoji(true);
return result;
}
Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (188736 => 188737)
--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2015-08-21 02:10:46 UTC (rev 188736)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2015-08-21 02:12:01 UTC (rev 188737)
@@ -604,7 +604,6 @@
ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
unsigned glyphCount = complexTextRun.glyphCount();
const Font& font = complexTextRun.font();
- bool isEmoji = font.platformData().isEmoji();
// Represent the initial advance for a text run by adjusting the advance
// of the last glyph of the previous text run in the glyph buffer.
@@ -652,8 +651,6 @@
bool treatAsSpace = FontCascade::treatAsSpace(ch);
CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
- if (isEmoji && advance.width)
- advance.width = font.widthForGlyph(glyph);
if (ch == '\t' && m_run.allowTabs())
advance.width = m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);