Title: [183166] tags/Safari-601.1.28.1/Source/WebCore

Diff

Modified: tags/Safari-601.1.28.1/Source/WebCore/ChangeLog (183165 => 183166)


--- tags/Safari-601.1.28.1/Source/WebCore/ChangeLog	2015-04-23 02:53:41 UTC (rev 183165)
+++ tags/Safari-601.1.28.1/Source/WebCore/ChangeLog	2015-04-23 02:55:33 UTC (rev 183166)
@@ -1,3 +1,34 @@
+2015-04-22  Babak Shafiei  <[email protected]>
+
+        Merge r183153.
+
+    2015-04-22  Myles C. Maxfield  <[email protected]>
+
+            [iOS] Caret does not line up with text when using the system font
+            https://bugs.webkit.org/show_bug.cgi?id=144076
+            <rdar://problem/20578301>
+
+            Reviewed by Enrica Casucci.
+
+            Determining caret locations often uses the complex text codepath, which means
+            the complex text codepath must know about custom tracking.
+
+            This regression is due to r182512.
+
+            Note that this patch is a short-term solution until I can solve the bigger issue of
+            having two CTFontRefs and using each in their proper place.
+
+            No new tests because there is no way to robustly test the system font.
+
+            * platform/graphics/Font.h:
+            (WebCore::Font::hasCustomTracking):
+            * platform/graphics/cocoa/FontCocoa.mm:
+            (WebCore::canUseFastGlyphAdvanceGetter):
+            (WebCore::Font::platformWidthForGlyph):
+            (WebCore::hasCustomTracking): Deleted.
+            * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+            (WebCore::Font::getCFStringAttributes):
+
 2015-04-21  Eric Carlson  <[email protected]>
 
         [Mac] Use one playback target for all web processes

Modified: tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/Font.h (183165 => 183166)


--- tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/Font.h	2015-04-23 02:53:41 UTC (rev 183165)
+++ tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/Font.h	2015-04-23 02:55:33 UTC (rev 183166)
@@ -195,6 +195,7 @@
 #endif
 #if PLATFORM(COCOA)
     CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const;
+    bool hasCustomTracking() const { return isSystemFont(); }
 #endif
 
 #if PLATFORM(COCOA) || USE(HARFBUZZ)

Modified: tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (183165 => 183166)


--- tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-04-23 02:53:41 UTC (rev 183165)
+++ tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-04-23 02:55:33 UTC (rev 183166)
@@ -455,11 +455,6 @@
 #endif
 }
 
-static inline bool hasCustomTracking(const Font& font)
-{
-    return font.isSystemFont();
-}
-
 static inline bool isEmoji(const FontPlatformData& platformData)
 {
 #if PLATFORM(IOS)
@@ -474,7 +469,7 @@
 {
     const FontPlatformData& platformData = font.platformData();
     // Fast getter doesn't take custom tracking into account
-    if (hasCustomTracking(font))
+    if (font.hasCustomTracking())
         return false;
     // Fast getter doesn't work for emoji
     if (isEmoji(platformData))
@@ -501,13 +496,10 @@
             advance.width = 0;
         }
     } else if (!populatedAdvance) {
-        // m_platformData.font() returns the original font that was passed into the FontPlatformData constructor. In the case of fonts that have custom tracking,
+        // m_platformData.font() returns the original font that was passed into the FontPlatformData constructor. In the case of fonts that have custom tracking,
         // the custom tracking does not survive the transformation to either m_platformData.cgFont() nor m_platformData.ctFont(), so we must use the original
         // font() that was passed in. However, for web fonts, m_platformData.font() is null, so we must use m_platformData.ctFont() for those cases.
-        if (hasCustomTracking(*this))
-            CTFontGetAdvancesForGlyphs(m_platformData.font(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
-        else
-            CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
+        CTFontGetAdvancesForGlyphs(hasCustomTracking() ? m_platformData.font() : m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
     }
 
     return advance.width + m_syntheticBoldOffset;

Modified: tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (183165 => 183166)


--- tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-04-23 02:53:41 UTC (rev 183165)
+++ tags/Safari-601.1.28.1/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2015-04-23 02:55:33 UTC (rev 183166)
@@ -46,7 +46,10 @@
     attributesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attributesDictionary.get();
 
-    CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData().ctFont());
+    // m_platformData.font() returns the original font that was passed into the FontPlatformData constructor. In the case of fonts that have custom tracking,
+    // the custom tracking does not survive the transformation to either m_platformData.cgFont() nor m_platformData.ctFont(), so we must use the original
+    // font() that was passed in. However, for web fonts, m_platformData.font() is null, so we must use m_platformData.ctFont() for those cases.
+    CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, hasCustomTracking() ? platformData().font() : platformData().ctFont());
 
     if (!(typesettingFeatures & Kerning)) {
         const float zero = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to