[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mitz at apple.com mitz at apple.com
Wed Dec 22 16:35:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5f0b9a276c6b56d7fb29b83e501cd8a290674a1c
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 26 20:18:09 2010 +0000

    <rdar://problem/8681368> Avoid unnecessary calls to CTFontGetPlatformFont()
    https://bugs.webkit.org/show_bug.cgi?id=50096
    
    Reviewed by Antti Koivisto.
    
    No new test, since functionality is unchanged.
    
    * platform/graphics/chromium/CrossProcessFontLoading.mm:
    (WebCore::FontPlatformData::loadFont): Removed the ATSUFontID argument.
    * platform/graphics/cocoa/FontPlatformData.h:
    (WebCore::FontPlatformData::FontPlatformData): Ditto.
    (WebCore::FontPlatformData::operator==): Removed comparison of font IDs.
    * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
    (WebCore::FontPlatformData::loadFont): Removed the ATSUFontID argument.
    (WebCore::FontPlatformData::FontPlatformData): Updated.
    (WebCore::FontPlatformData::operator=): Removed copying of font ID.
    (WebCore::FontPlatformData::setFont): Removed setting of font ID.
    * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
    (WebCore::initializeATSUStyle): Call CTFontGetPlatformFont() here if necessary.
    * platform/graphics/mac/FontCustomPlatformData.cpp:
    (WebCore::FontCustomPlatformData::fontPlatformData): Updated for FontPlatformData change.
    (WebCore::createFontCustomPlatformData): Updated for FontCustomPlatformData change.
    * platform/graphics/mac/FontCustomPlatformData.h:
    (WebCore::FontCustomPlatformData::FontCustomPlatformData): Removed ATSUFontID argument and
    data member.
    * platform/graphics/mac/SimpleFontDataATSUI.mm:
    (WebCore::SimpleFontData::checkShapesArabic): Call CTFontGetPlatformFont() here if necessary.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72774 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fc4dbf6..7bd9848 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-11-26  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Antti Koivisto.
+
+        <rdar://problem/8681368> Avoid unnecessary calls to CTFontGetPlatformFont()
+        https://bugs.webkit.org/show_bug.cgi?id=50096
+
+        No new test, since functionality is unchanged.
+
+        * platform/graphics/chromium/CrossProcessFontLoading.mm:
+        (WebCore::FontPlatformData::loadFont): Removed the ATSUFontID argument.
+        * platform/graphics/cocoa/FontPlatformData.h:
+        (WebCore::FontPlatformData::FontPlatformData): Ditto.
+        (WebCore::FontPlatformData::operator==): Removed comparison of font IDs.
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::loadFont): Removed the ATSUFontID argument.
+        (WebCore::FontPlatformData::FontPlatformData): Updated.
+        (WebCore::FontPlatformData::operator=): Removed copying of font ID.
+        (WebCore::FontPlatformData::setFont): Removed setting of font ID.
+        * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
+        (WebCore::initializeATSUStyle): Call CTFontGetPlatformFont() here if necessary.
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::fontPlatformData): Updated for FontPlatformData change.
+        (WebCore::createFontCustomPlatformData): Updated for FontCustomPlatformData change.
+        * platform/graphics/mac/FontCustomPlatformData.h:
+        (WebCore::FontCustomPlatformData::FontCustomPlatformData): Removed ATSUFontID argument and
+        data member.
+        * platform/graphics/mac/SimpleFontDataATSUI.mm:
+        (WebCore::SimpleFontData::checkShapesArabic): Call CTFontGetPlatformFont() here if necessary.
+
 2010-11-26  François Sausset  <sausset at gmail.com>
 
         Reviewed by Daniel Bates.
diff --git a/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm b/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
index a7ec03a..72e3369 100644
--- a/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
+++ b/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
@@ -181,11 +181,10 @@ MemoryActivatedFont::~MemoryActivatedFont()
 //   that was picked in the end.  The caller is responsible for calling
 //   CFRelease() on this parameter when done with it.
 // * fontID - on output, the ID corresponding to nsFont.
-void FontPlatformData::loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFont, CGFontRef& cgFont, ATSUFontID& fontID)
+void FontPlatformData::loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFont, CGFontRef& cgFont)
 {
     outNSFont = nsFont;
     cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0);
-    MemoryActivatedFont* memFont = 0;
     if (OutOfProcessFontLoadingEnabled() && outNSFont && cgFont && isLastResortFont(cgFont)) {
         // Release old CGFontRef since it points at the LastResort font which we don't want.
         CFRelease(cgFont);
@@ -206,12 +205,6 @@ void FontPlatformData::loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFo
             cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0);
         }
     }
-    
-    if (memFont) {
-        fontID = m_inMemoryFont->atsFontRef();
-    } else {
-        fontID = CTFontGetPlatformFont(toCTFontRef(outNSFont), 0);
-    }
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/cocoa/FontPlatformData.h b/WebCore/platform/graphics/cocoa/FontPlatformData.h
index 7ab84f5..8cf08fb 100644
--- a/WebCore/platform/graphics/cocoa/FontPlatformData.h
+++ b/WebCore/platform/graphics/cocoa/FontPlatformData.h
@@ -63,7 +63,6 @@ class FontPlatformData {
         : m_syntheticBold(syntheticBold)
         , m_syntheticOblique(syntheticOblique)
         , m_orientation(orientation)
-        , m_atsuFontID(0)
         , m_size(size)
         , m_font(0)
 #ifdef BUILDING_ON_TIGER
@@ -75,11 +74,10 @@ class FontPlatformData {
 
     FontPlatformData(NSFont *nsFont, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal);
     
-    FontPlatformData(CGFontRef cgFont, ATSUFontID fontID, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
+    FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
         : m_syntheticBold(syntheticBold)
         , m_syntheticOblique(syntheticOblique)
         , m_orientation(orientation)
-        , m_atsuFontID(fontID)
         , m_size(size)
         , m_font(0)
         , m_cgFont(cgFont)
@@ -103,7 +101,6 @@ class FontPlatformData {
     bool m_syntheticOblique;
     FontOrientation m_orientation;
 
-    ATSUFontID m_atsuFontID;
     float m_size;
 
     unsigned hash() const
@@ -118,7 +115,7 @@ class FontPlatformData {
     bool operator==(const FontPlatformData& other) const
     { 
         return m_font == other.m_font && m_syntheticBold == other.m_syntheticBold && m_syntheticOblique == other.m_syntheticOblique && 
-               m_cgFont == other.m_cgFont && m_size == other.m_size && m_atsuFontID == other.m_atsuFontID && m_orientation == other.m_orientation;
+               m_cgFont == other.m_cgFont && m_size == other.m_size && m_orientation == other.m_orientation;
     }
 
     NSFont *font() const { return m_font; }
@@ -149,8 +146,7 @@ private:
     // * outNSFont - The font that was actually loaded, for the Chromium port this may be different than nsFont.
     // The caller is responsible for calling CFRelease() on this parameter when done with it.
     // * cgFont - CGFontRef representing the input font at the specified point size.
-    // * fontID - ID of loaded font.
-    void loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFont, CGFontRef& cgFont, ATSUFontID& fontID);
+    void loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFont, CGFontRef& cgFont);
 
     NSFont *m_font;
 
diff --git a/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
index 52a88ed..8dacbe3 100644
--- a/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
+++ b/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
@@ -31,15 +31,13 @@
 namespace WebCore {
 
 #if PLATFORM(MAC)
-void FontPlatformData::loadFont(NSFont* nsFont, float, NSFont*& outNSFont, CGFontRef& cgFont, ATSUFontID& fontID)
+void FontPlatformData::loadFont(NSFont* nsFont, float, NSFont*& outNSFont, CGFontRef& cgFont)
 {
     outNSFont = nsFont;
 #ifndef BUILDING_ON_TIGER
     cgFont = CTFontCopyGraphicsFont(toCTFontRef(nsFont), 0);
-    fontID = CTFontGetPlatformFont(toCTFontRef(nsFont), 0);
 #else
     cgFont = wkGetCGFontFromNSFont(nsFont);
-    fontID = wkGetNSFontATSUFontId(nsFont);
 #endif
 }
 #endif  // PLATFORM(MAC)
@@ -60,7 +58,7 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBol
     ASSERT_ARG(nsFont, nsFont);
 
     CGFontRef cgFont = 0;
-    loadFont(nsFont, size, m_font, cgFont, m_atsuFontID);
+    loadFont(nsFont, size, m_font, cgFont);
 
     m_orientation = orientation;
 
@@ -82,7 +80,6 @@ FontPlatformData::FontPlatformData(const FontPlatformData& f)
     m_syntheticOblique = f.m_syntheticOblique;
     m_size = f.m_size;
     m_cgFont = f.m_cgFont;
-    m_atsuFontID = f.m_atsuFontID;
     m_isColorBitmapFont = f.m_isColorBitmapFont;
     m_orientation = f.m_orientation;
     m_CTFont = f.m_CTFont;
@@ -103,7 +100,6 @@ const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& f)
     m_syntheticOblique = f.m_syntheticOblique;
     m_size = f.m_size;
     m_cgFont = f.m_cgFont;
-    m_atsuFontID = f.m_atsuFontID;
     if (m_font == f.m_font)
         return *this;
     if (f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1))
@@ -136,7 +132,7 @@ void FontPlatformData::setFont(NSFont *font)
     
     CGFontRef cgFont = 0;
     NSFont* loadedFont = 0;
-    loadFont(m_font, m_size, loadedFont, cgFont, m_atsuFontID);
+    loadFont(m_font, m_size, loadedFont, cgFont);
     
 #if PLATFORM(CHROMIUM) && OS(DARWIN)
     // If loadFont replaced m_font with a fallback font, then release the
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index 7ff316c..c24a914 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -280,7 +280,7 @@ static ATSUStyle initializeATSUStyle(const SimpleFontData* fontData, Typesetting
     if (!addResult.second)
         return atsuStyle;
 
-    ATSUFontID fontID = fontData->platformData().m_atsuFontID;
+    ATSUFontID fontID = fontData->platformData().ctFont() ? CTFontGetPlatformFont(fontData->platformData().ctFont(), 0) : 0;
     if (!fontID) {
         LOG_ERROR("unable to get ATSUFontID for %p", fontData->platformData().font());
         fontData->m_ATSUStyleMap.remove(addResult.first);
diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
index cead71b..d04d0e4 100644
--- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
@@ -40,7 +40,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
 
 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontRenderingMode)
 {
-    return FontPlatformData(m_cgFont, (ATSUFontID)m_atsFont, size, bold, italic, orientation);
+    return FontPlatformData(m_cgFont, size, bold, italic, orientation);
 }
 
 FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
@@ -66,7 +66,6 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
 #endif
 
     ATSFontContainerRef containerRef = 0;
-    ATSFontRef fontRef = 0;
 
     RetainPtr<CGFontRef> cgFontRef;
 
@@ -93,6 +92,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
         return 0;
     }
     
+    ATSFontRef fontRef = 0;
     ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, &fontRef, NULL);
     if (!fontRef) {
         ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault);
@@ -111,7 +111,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     }
 #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
 
-    return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef());
+    return new FontCustomPlatformData(containerRef, cgFontRef.releaseRef());
 }
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
index 7702457..c11858c 100644
--- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
@@ -37,9 +37,12 @@ class FontPlatformData;
 class SharedBuffer;
 
 struct FontCustomPlatformData : Noncopyable {
-    FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont)
-    : m_atsContainer(container), m_atsFont(atsFont), m_cgFont(cgFont)
-    {}
+    FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont)
+        : m_atsContainer(container)
+        , m_cgFont(cgFont)
+    {
+    }
+
     ~FontCustomPlatformData();
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode);
@@ -47,11 +50,10 @@ struct FontCustomPlatformData : Noncopyable {
     static bool supportsFormat(const String&);
 
     ATSFontContainerRef m_atsContainer;
-    ATSFontRef m_atsFont;
     CGFontRef m_cgFont;
 };
 
-FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer);
+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*);
 
 }
 
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm
index 6aa0a39..4b2e7b2 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm
+++ b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm
@@ -48,8 +48,8 @@ void SimpleFontData::checkShapesArabic() const
     ASSERT(!m_checkedShapesArabic);
 
     m_checkedShapesArabic = true;
-    
-    ATSUFontID fontID = m_platformData.m_atsuFontID;
+
+    ATSUFontID fontID = m_platformData.ctFont() ? CTFontGetPlatformFont(m_platformData.ctFont(), 0) : 0;
     if (!fontID) {
         LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font());
         return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list