Devirtualize FontData
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jan 2015 23:57:50 +0000 (23:57 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jan 2015 23:57:50 +0000 (23:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140390

Reviewed by Andreas Kling.

This patch removes the FontData base class and turns SegmentedFontData into a non-virtual FontRanges type.

SimpleFontData remains as is (without the base) and it can be renamed later to something more sensible.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::fallbackFontDataAt):
(WebCore::CSSFontSelector::getFontData): Deleted.
(WebCore::CSSFontSelector::getFallbackFontData): Deleted.
* css/CSSFontSelector.h:
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::pruneTable):
(WebCore::appendFontDataWithInvalidUnicodeRangeIfLoading):
(WebCore::CSSSegmentedFontFace::fontRanges):
(WebCore::CSSSegmentedFontFace::loadFont):
(WebCore::CSSSegmentedFontFace::getFontData): Deleted.
* css/CSSSegmentedFontFace.h:
* platform/graphics/Font.h:
(WebCore::Font::fallbackRangesAt):
(WebCore::Font::fontDataAt): Deleted.
* platform/graphics/FontData.cpp: Removed.
* platform/graphics/FontData.h: Removed.
* platform/graphics/FontGlyphs.cpp:
(WebCore::FontGlyphs::FontGlyphs):
(WebCore::FontGlyphs::determinePitch):
(WebCore::FontGlyphs::isLoadingCustomFonts):
(WebCore::realizeNextFallback):
(WebCore::FontGlyphs::realizeFallbackRangesAt):
(WebCore::FontGlyphs::glyphDataForSystemFallback):
(WebCore::FontGlyphs::glyphDataForVariant):
(WebCore::FontGlyphs::glyphDataForNormalVariant):
(WebCore::glyphPageFromFontRanges):
(WebCore::FontGlyphs::glyphDataForCharacter):
(WebCore::realizeNextFamily): Deleted.
(WebCore::FontGlyphs::realizeFontDataAt): Deleted.
(WebCore::glyphPageFromFontData): Deleted.
* platform/graphics/FontGlyphs.h:
(WebCore::FontGlyphs::primarySimpleFontData):
* platform/graphics/FontRanges.cpp: Copied from Source/WebCore/platform/graphics/SegmentedFontData.cpp.
(WebCore::FontRanges::FontRanges):
(WebCore::FontRanges::~FontRanges):
(WebCore::FontRanges::fontDataForCharacter):
(WebCore::FontRanges::fontDataForFirstRange):
(WebCore::FontRanges::isLoading):
(WebCore::SegmentedFontData::SegmentedFontData): Deleted.
(WebCore::SegmentedFontData::~SegmentedFontData): Deleted.
(WebCore::SegmentedFontData::simpleFontDataForCharacter): Deleted.
(WebCore::SegmentedFontData::simpleFontDataForFirstRange): Deleted.
(WebCore::SegmentedFontData::isCustomFont): Deleted.
(WebCore::SegmentedFontData::isLoading): Deleted.
(WebCore::SegmentedFontData::isSegmented): Deleted.
(WebCore::SegmentedFontData::description): Deleted.
* platform/graphics/FontRanges.h: Copied from Source/WebCore/platform/graphics/SegmentedFontData.h.
(WebCore::FontRanges::Range::Range):
(WebCore::FontRanges::Range::from):
(WebCore::FontRanges::Range::to):
(WebCore::FontRanges::Range::fontData):
(WebCore::FontRanges::isEmpty):
(WebCore::FontRanges::appendRange):
(WebCore::FontRanges::size):
(WebCore::FontRanges::rangeAt):
(WebCore::FontDataRange::FontDataRange): Deleted.
(WebCore::FontDataRange::from): Deleted.
(WebCore::FontDataRange::to): Deleted.
(WebCore::FontDataRange::fontData): Deleted.
(WebCore::SegmentedFontData::create): Deleted.
(WebCore::SegmentedFontData::appendRange): Deleted.
(WebCore::SegmentedFontData::numRanges): Deleted.
(WebCore::SegmentedFontData::rangeAt): Deleted.
(isType): Deleted.
* platform/graphics/FontSelector.h:
* platform/graphics/SegmentedFontData.cpp: Removed.
* platform/graphics/SegmentedFontData.h: Removed.
* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::simpleFontDataForCharacter): Deleted.
(WebCore::SimpleFontData::simpleFontDataForFirstRange): Deleted.
(WebCore::SimpleFontData::isSegmented): Deleted.
* platform/graphics/SimpleFontData.h:
(WebCore::SimpleFontData::isCustomFont):
(WebCore::SimpleFontData::isLoading):
(isType): Deleted.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(-[WebCascadeList initWithFont:character:]):
(-[WebCascadeList objectAtIndex:]):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::fontDataForCombiningCharacterSequence):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSFontSelector.h
Source/WebCore/css/CSSSegmentedFontFace.cpp
Source/WebCore/css/CSSSegmentedFontFace.h
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/FontData.cpp [deleted file]
Source/WebCore/platform/graphics/FontGlyphs.cpp
Source/WebCore/platform/graphics/FontGlyphs.h
Source/WebCore/platform/graphics/FontRanges.cpp [moved from Source/WebCore/platform/graphics/SegmentedFontData.cpp with 70% similarity]
Source/WebCore/platform/graphics/FontRanges.h [moved from Source/WebCore/platform/graphics/FontData.h with 52% similarity]
Source/WebCore/platform/graphics/FontSelector.h
Source/WebCore/platform/graphics/SegmentedFontData.h [deleted file]
Source/WebCore/platform/graphics/SimpleFontData.cpp
Source/WebCore/platform/graphics/SimpleFontData.h
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp

index 8b46266..ddbe837 100644 (file)
@@ -2051,12 +2051,12 @@ set(WebCore_SOURCES
     platform/graphics/FloatSize.cpp
     platform/graphics/Font.cpp
     platform/graphics/FontCache.cpp
-    platform/graphics/FontData.cpp
     platform/graphics/FontDescription.cpp
     platform/graphics/FontFastPath.cpp
     platform/graphics/FontFeatureSettings.cpp
     platform/graphics/FontGenericFamilies.cpp
     platform/graphics/FontGlyphs.cpp
+    platform/graphics/FontRanges.cpp
     platform/graphics/GeneratedImage.cpp
     platform/graphics/GeometryUtilities.cpp
     platform/graphics/Gradient.cpp
@@ -2084,7 +2084,6 @@ set(WebCore_SOURCES
     platform/graphics/Region.cpp
     platform/graphics/RoundedRect.cpp
     platform/graphics/SVGGlyph.cpp
-    platform/graphics/SegmentedFontData.cpp
     platform/graphics/ShadowBlur.cpp
     platform/graphics/SimpleFontData.cpp
     platform/graphics/StringTruncator.cpp
index cb43c5d..d21b0bc 100644 (file)
@@ -1,3 +1,100 @@
+2015-01-13  Antti Koivisto  <antti@apple.com>
+
+        Devirtualize FontData
+        https://bugs.webkit.org/show_bug.cgi?id=140390
+
+        Reviewed by Andreas Kling.
+
+        This patch removes the FontData base class and turns SegmentedFontData into a non-virtual FontRanges type.
+
+        SimpleFontData remains as is (without the base) and it can be renamed later to something more sensible.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::fontRangesForFamily):
+        (WebCore::CSSFontSelector::fallbackFontDataAt):
+        (WebCore::CSSFontSelector::getFontData): Deleted.
+        (WebCore::CSSFontSelector::getFallbackFontData): Deleted.
+        * css/CSSFontSelector.h:
+        * css/CSSSegmentedFontFace.cpp:
+        (WebCore::CSSSegmentedFontFace::pruneTable):
+        (WebCore::appendFontDataWithInvalidUnicodeRangeIfLoading):
+        (WebCore::CSSSegmentedFontFace::fontRanges):
+        (WebCore::CSSSegmentedFontFace::loadFont):
+        (WebCore::CSSSegmentedFontFace::getFontData): Deleted.
+        * css/CSSSegmentedFontFace.h:
+        * platform/graphics/Font.h:
+        (WebCore::Font::fallbackRangesAt):
+        (WebCore::Font::fontDataAt): Deleted.
+        * platform/graphics/FontData.cpp: Removed.
+        * platform/graphics/FontData.h: Removed.
+        * platform/graphics/FontGlyphs.cpp:
+        (WebCore::FontGlyphs::FontGlyphs):
+        (WebCore::FontGlyphs::determinePitch):
+        (WebCore::FontGlyphs::isLoadingCustomFonts):
+        (WebCore::realizeNextFallback):
+        (WebCore::FontGlyphs::realizeFallbackRangesAt):
+        (WebCore::FontGlyphs::glyphDataForSystemFallback):
+        (WebCore::FontGlyphs::glyphDataForVariant):
+        (WebCore::FontGlyphs::glyphDataForNormalVariant):
+        (WebCore::glyphPageFromFontRanges):
+        (WebCore::FontGlyphs::glyphDataForCharacter):
+        (WebCore::realizeNextFamily): Deleted.
+        (WebCore::FontGlyphs::realizeFontDataAt): Deleted.
+        (WebCore::glyphPageFromFontData): Deleted.
+        * platform/graphics/FontGlyphs.h:
+        (WebCore::FontGlyphs::primarySimpleFontData):
+        * platform/graphics/FontRanges.cpp: Copied from Source/WebCore/platform/graphics/SegmentedFontData.cpp.
+        (WebCore::FontRanges::FontRanges):
+        (WebCore::FontRanges::~FontRanges):
+        (WebCore::FontRanges::fontDataForCharacter):
+        (WebCore::FontRanges::fontDataForFirstRange):
+        (WebCore::FontRanges::isLoading):
+        (WebCore::SegmentedFontData::SegmentedFontData): Deleted.
+        (WebCore::SegmentedFontData::~SegmentedFontData): Deleted.
+        (WebCore::SegmentedFontData::simpleFontDataForCharacter): Deleted.
+        (WebCore::SegmentedFontData::simpleFontDataForFirstRange): Deleted.
+        (WebCore::SegmentedFontData::isCustomFont): Deleted.
+        (WebCore::SegmentedFontData::isLoading): Deleted.
+        (WebCore::SegmentedFontData::isSegmented): Deleted.
+        (WebCore::SegmentedFontData::description): Deleted.
+        * platform/graphics/FontRanges.h: Copied from Source/WebCore/platform/graphics/SegmentedFontData.h.
+        (WebCore::FontRanges::Range::Range):
+        (WebCore::FontRanges::Range::from):
+        (WebCore::FontRanges::Range::to):
+        (WebCore::FontRanges::Range::fontData):
+        (WebCore::FontRanges::isEmpty):
+        (WebCore::FontRanges::appendRange):
+        (WebCore::FontRanges::size):
+        (WebCore::FontRanges::rangeAt):
+        (WebCore::FontDataRange::FontDataRange): Deleted.
+        (WebCore::FontDataRange::from): Deleted.
+        (WebCore::FontDataRange::to): Deleted.
+        (WebCore::FontDataRange::fontData): Deleted.
+        (WebCore::SegmentedFontData::create): Deleted.
+        (WebCore::SegmentedFontData::appendRange): Deleted.
+        (WebCore::SegmentedFontData::numRanges): Deleted.
+        (WebCore::SegmentedFontData::rangeAt): Deleted.
+        (isType): Deleted.
+        * platform/graphics/FontSelector.h:
+        * platform/graphics/SegmentedFontData.cpp: Removed.
+        * platform/graphics/SegmentedFontData.h: Removed.
+        * platform/graphics/SimpleFontData.cpp:
+        (WebCore::SimpleFontData::simpleFontDataForCharacter): Deleted.
+        (WebCore::SimpleFontData::simpleFontDataForFirstRange): Deleted.
+        (WebCore::SimpleFontData::isSegmented): Deleted.
+        * platform/graphics/SimpleFontData.h:
+        (WebCore::SimpleFontData::isCustomFont):
+        (WebCore::SimpleFontData::isLoading):
+        (isType): Deleted.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (-[WebCascadeList initWithFont:character:]):
+        (-[WebCascadeList objectAtIndex:]):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+        * platform/graphics/mac/FontComplexTextMac.cpp:
+        (WebCore::Font::fontDataForCombiningCharacterSequence):
+
 2015-01-13  Dean Jackson  <dino@apple.com>
 
         Filters aren't applied to elements in columns after the first
index b52b4b0..6c3bb43 100644 (file)
@@ -75,7 +75,7 @@ __ZN7WebCore10Credential28encodingRequiresPlatformDataEP15NSURLCredential
 __ZN7WebCore10CredentialC1EP15NSURLCredential
 __ZN7WebCore10FloatPointC1ERK7CGPoint
 __ZN7WebCore10FloatPointC1ERKNS_8IntPointE
-__ZN7WebCore10FontGlyphs17realizeFontDataAtERKNS_15FontDescriptionEj
+__ZN7WebCore10FontGlyphs23realizeFallbackRangesAtERKNS_15FontDescriptionEj
 __ZN7WebCore10FontGlyphsD1Ev
 __ZN7WebCore10JSDocument6s_infoE
 __ZN7WebCore10JSDocument9toWrappedEN3JSC7JSValueE
@@ -459,6 +459,7 @@ __ZN7WebCore14SecurityPolicy22generateReferrerHeaderENS_14ReferrerPolicyERKNS_3U
 __ZN7WebCore14SecurityPolicy27resetOriginAccessWhitelistsEv
 __ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
 __ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
+__ZN7WebCore14SimpleFontDataD1Ev
 __ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE
 __ZN7WebCore14TileController14setTilesOpaqueEb
 __ZN7WebCore14TileController15containerLayersEv
@@ -1585,6 +1586,8 @@ __ZNK3WTF6String14createCFStringEv
 __ZNK7WebCore10Credential12nsCredentialEv
 __ZNK7WebCore10Credential7isEmptyEv
 __ZNK7WebCore10FloatPointcv7CGPointEv
+__ZNK7WebCore10FontRanges20fontDataForCharacterEi
+__ZNK7WebCore10FontRanges21fontDataForFirstRangeEv
 __ZNK7WebCore10LayoutRect8containsERKS0_
 __ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringENS0_18AllowedPluginTypesE
 __ZNK7WebCore10RenderText16firstRunLocationEv
index a627cfd..949375e 100644 (file)
     <ClCompile Include="..\platform\graphics\FloatSize.cpp" />
     <ClCompile Include="..\platform\graphics\Font.cpp" />
     <ClCompile Include="..\platform\graphics\FontCache.cpp" />
-    <ClCompile Include="..\platform\graphics\FontData.cpp" />
     <ClCompile Include="..\platform\graphics\FontDescription.cpp" />
     <ClCompile Include="..\platform\graphics\FontGenericFamilies.cpp" />
     <ClCompile Include="..\platform\graphics\FontGlyphs.cpp" />
     <ClCompile Include="..\platform\graphics\FontFastPath.cpp" />
     <ClCompile Include="..\platform\graphics\FontFeatureSettings.cpp" />
     <ClCompile Include="..\platform\graphics\FontPlatformData.cpp" />
+    <ClCompile Include="..\platform\graphics\FontRanges.cpp" />
     <ClCompile Include="..\platform\graphics\GeometryUtilities.cpp" />
     <ClCompile Include="..\platform\graphics\GeneratedImage.cpp" />
     <ClCompile Include="..\platform\graphics\Gradient.cpp" />
     <ClCompile Include="..\platform\graphics\PlatformTimeRanges.cpp" />
     <ClCompile Include="..\platform\graphics\Region.cpp" />
     <ClCompile Include="..\platform\graphics\RoundedRect.cpp" />
-    <ClCompile Include="..\platform\graphics\SegmentedFontData.cpp" />
     <ClCompile Include="..\platform\graphics\ShadowBlur.cpp" />
     <ClCompile Include="..\platform\graphics\SimpleFontData.cpp" />
     <ClCompile Include="..\platform\graphics\TextRun.cpp" />
     <ClInclude Include="..\platform\graphics\FloatSizeHash.h" />
     <ClInclude Include="..\platform\graphics\Font.h" />
     <ClInclude Include="..\platform\graphics\FontCache.h" />
-    <ClInclude Include="..\platform\graphics\FontData.h" />
     <ClInclude Include="..\platform\graphics\FontDescription.h" />
     <ClInclude Include="..\platform\graphics\FontGenericFamilies.h" />
     <ClInclude Include="..\platform\graphics\FontGlyphs.h" />
     <ClInclude Include="..\platform\graphics\FontFeatureSettings.h" />
     <ClInclude Include="..\platform\graphics\FontMetrics.h" />
     <ClInclude Include="..\platform\graphics\FontPlatformData.h" />
+    <ClInclude Include="..\platform\graphics\FontRanges.h" />
     <ClInclude Include="..\platform\graphics\FontRenderingMode.h" />
     <ClInclude Include="..\platform\graphics\FontSelector.h" />
     <ClInclude Include="..\platform\graphics\FontSmoothingMode.h" />
     <ClInclude Include="..\platform\graphics\PlatformTimeRanges.h" />
     <ClInclude Include="..\platform\graphics\Region.h" />
     <ClInclude Include="..\platform\graphics\RoundedRect.h" />
-    <ClInclude Include="..\platform\graphics\SegmentedFontData.h" />
     <ClInclude Include="..\platform\graphics\ShadowBlur.h" />
     <ClInclude Include="..\platform\graphics\SimpleFontData.h" />
     <ClInclude Include="..\platform\graphics\TextRun.h" />
index 2215c7a..aa76580 100644 (file)
                371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */; };
                371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */; };
                371E65CE13661EED00BEEDB0 /* PageSerializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */; };
-               371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */; };
-               371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; };
-               371F4FFD0D25E7F300ECE0D5 /* SegmentedFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */; };
+               371F4FFC0D25E7F300ECE0D5 /* FontRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* FontRanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               371F4FFD0D25E7F300ECE0D5 /* FontRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4FFB0D25E7F300ECE0D5 /* FontRanges.cpp */; };
                371F51A10D262FA000ECE0D5 /* CSSSegmentedFontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F519F0D262FA000ECE0D5 /* CSSSegmentedFontFace.h */; };
                371F51A20D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F51A00D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp */; };
                371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */; };
                371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HyphenationCF.cpp; sourceTree = "<group>"; };
                371E65CB13661EDC00BEEDB0 /* PageSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageSerializer.h; sourceTree = "<group>"; };
                371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageSerializer.cpp; sourceTree = "<group>"; };
-               371F4F3E0D25B9AF00ECE0D5 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; };
-               371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; };
-               371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; };
-               371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentedFontData.cpp; sourceTree = "<group>"; };
+               371F4FFA0D25E7F300ECE0D5 /* FontRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRanges.h; sourceTree = "<group>"; };
+               371F4FFB0D25E7F300ECE0D5 /* FontRanges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontRanges.cpp; sourceTree = "<group>"; };
                371F519F0D262FA000ECE0D5 /* CSSSegmentedFontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSegmentedFontFace.h; sourceTree = "<group>"; };
                371F51A00D262FA000ECE0D5 /* CSSSegmentedFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSSegmentedFontFace.cpp; sourceTree = "<group>"; };
                371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSUnicodeRangeValue.h; sourceTree = "<group>"; };
                                BCB92D4E1293550B00C8387F /* FontBaseline.h */,
                                B2C3DA510D006CD600EF6F26 /* FontCache.cpp */,
                                B2C3DA520D006CD600EF6F26 /* FontCache.h */,
-                               371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */,
-                               371F4F3E0D25B9AF00ECE0D5 /* FontData.h */,
                                37ACCE620DA2AA960089E602 /* FontDescription.cpp */,
                                B2C3DA550D006CD600EF6F26 /* FontDescription.h */,
                                72626E010EF022FE00A07E20 /* FontFastPath.cpp */,
                                BCAB418013E356E800D8AAF3 /* Region.h */,
                                A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */,
                                A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */,
-                               371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */,
-                               371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */,
+                               371F4FFB0D25E7F300ECE0D5 /* FontRanges.cpp */,
+                               371F4FFA0D25E7F300ECE0D5 /* FontRanges.h */,
                                0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */,
                                0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
                                B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
                                BCB92D4F1293550B00C8387F /* FontBaseline.h in Headers */,
                                B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */,
                                B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */,
-                               371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */,
                                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */,
                                4A6E9FC813C17D570046A7F8 /* FontFeatureSettings.h in Headers */,
                                B2C3DA680D006CD600EF6F26 /* FontGlyphs.h in Headers */,
                                BCD0E0FC0E972C3500265DEA /* SecurityOriginHash.h in Headers */,
                                974D2DA5146A535D00D51F8B /* SecurityPolicy.h in Headers */,
                                2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */,
-                               371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */,
+                               371F4FFC0D25E7F300ECE0D5 /* FontRanges.h in Headers */,
                                99CC0B5E18BE984A006CEBCC /* SegmentedInputStorage.h in Headers */,
                                B2C3DA2F0D006C1D00EF6F26 /* SegmentedString.h in Headers */,
                                BEA807C90F714A0300524199 /* SelectionRect.h in Headers */,
                                B2AFFC7C0D00A5C10030074D /* FontCacheMac.mm in Sources */,
                                37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */,
                                B2AFFC7D0D00A5C10030074D /* FontCustomPlatformData.cpp in Sources */,
-                               371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */,
                                37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */,
                                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */,
                                4A6E9FC713C17D570046A7F8 /* FontFeatureSettings.cpp in Sources */,
                                976F36EA14686225005E93B4 /* SecurityContext.cpp in Sources */,
                                BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */,
                                974D2DA4146A535D00D51F8B /* SecurityPolicy.cpp in Sources */,
-                               371F4FFD0D25E7F300ECE0D5 /* SegmentedFontData.cpp in Sources */,
+                               371F4FFD0D25E7F300ECE0D5 /* FontRanges.cpp in Sources */,
                                99CC0B5D18BE984A006CEBCC /* SegmentedInputStorage.cpp in Sources */,
                                B2C3DA2E0D006C1D00EF6F26 /* SegmentedString.cpp in Sources */,
                                BEA807C80F714A0300524199 /* SelectionRect.cpp in Sources */,
index 76bd167..3cb7cf2 100644 (file)
@@ -468,7 +468,7 @@ static inline bool compareFontFaces(CSSFontFace* first, CSSFontFace* second)
     return false;
 }
 
-PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
+FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescription, const AtomicString& familyName)
 {
     // FIXME: The spec (and Firefox) says user specified generic families (sans-serif etc.) should be resolved before the @font-face lookup too.
     bool resolveGenericFamilyFirst = familyName == standardFamily;
@@ -478,10 +478,10 @@ PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDes
     if (!face) {
         if (!resolveGenericFamilyFirst)
             familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName);
-        return fontCache().fontForFamily(fontDescription, familyForLookup);
+        return FontRanges(fontCache().fontForFamily(fontDescription, familyForLookup));
     }
 
-    return face->getFontData(fontDescription);
+    return face->fontRanges(fontDescription);
 }
 
 CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDescription, const AtomicString& family)
@@ -623,7 +623,7 @@ size_t CSSFontSelector::fallbackFontDataCount()
     return 0;
 }
 
-PassRefPtr<FontData> CSSFontSelector::getFallbackFontData(const FontDescription& fontDescription, size_t index)
+PassRefPtr<SimpleFontData> CSSFontSelector::fallbackFontDataAt(const FontDescription& fontDescription, size_t index)
 {
     ASSERT_UNUSED(index, !index);
 
index c541c45..93383f4 100644 (file)
@@ -58,9 +58,9 @@ public:
     virtual unsigned version() const override { return m_version; }
     virtual unsigned uniqueId() const override { return m_uniqueId; }
 
-    virtual PassRefPtr<FontData> getFontData(const FontDescription&, const AtomicString&) override;
+    virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) override;
     virtual size_t fallbackFontDataCount() override;
-    virtual PassRefPtr<FontData> getFallbackFontData(const FontDescription&, size_t) override;
+    virtual PassRefPtr<SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) override;
     CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family);
 
     virtual bool resolvesFamilyFor(const FontDescription&) const override;
index 8d7a41b..3725692 100644 (file)
@@ -32,7 +32,6 @@
 #include "Document.h"
 #include "FontDescription.h"
 #include "RuntimeEnabledFeatures.h"
-#include "SegmentedFontData.h"
 #include "SimpleFontData.h"
 
 namespace WebCore {
@@ -52,11 +51,7 @@ CSSSegmentedFontFace::~CSSSegmentedFontFace()
 
 void CSSSegmentedFontFace::pruneTable()
 {
-    // Make sure the glyph page tree prunes out all uses of this custom font.
-    if (m_fontDataTable.isEmpty())
-        return;
-
-    m_fontDataTable.clear();
+    m_descriptionToRangesMap.clear();
 }
 
 bool CSSSegmentedFontFace::isValid() const
@@ -95,28 +90,27 @@ void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace)
     m_fontFaces.append(fontFace);
 }
 
-static void appendFontDataWithInvalidUnicodeRangeIfLoading(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const Vector<CSSFontFace::UnicodeRange>& ranges)
+static void appendFontDataWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<SimpleFontData>&& fontData, const Vector<CSSFontFace::UnicodeRange>& unicodeRanges)
 {
-    RefPtr<SimpleFontData> faceFontData = prpFaceFontData;
-    if (faceFontData->isLoading()) {
-        newFontData->appendRange(FontDataRange(0, 0, faceFontData));
+    if (fontData->isLoading()) {
+        ranges.appendRange(FontRanges::Range(0, 0, WTF::move(fontData)));
         return;
     }
 
-    unsigned numRanges = ranges.size();
+    unsigned numRanges = unicodeRanges.size();
     if (!numRanges) {
-        newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData));
+        ranges.appendRange(FontRanges::Range(0, 0x7FFFFFFF, WTF::move(fontData)));
         return;
     }
 
     for (unsigned j = 0; j < numRanges; ++j)
-        newFontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData));
+        ranges.appendRange(FontRanges::Range(unicodeRanges[j].from(), unicodeRanges[j].to(), fontData.copyRef()));
 }
 
-PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription)
+FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
 {
     if (!isValid())
-        return 0;
+        return FontRanges();
 
     FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
     unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
@@ -124,37 +118,28 @@ PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fo
         | fontDescription.widthVariant() << FontTraitsMaskWidth
         | desiredTraitsMask;
 
-    RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(hashKey, nullptr).iterator->value;
-    if (fontData && fontData->numRanges())
-        return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
-
-    if (!fontData)
-        fontData = SegmentedFontData::create();
-
-    unsigned size = m_fontFaces.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (!m_fontFaces[i]->isValid())
-            continue;
-        FontTraitsMask traitsMask = m_fontFaces[i]->traitsMask();
-        bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
-        bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
-        if (RefPtr<SimpleFontData> faceFontData = m_fontFaces[i]->getFontData(fontDescription, syntheticBold, syntheticItalic)) {
-            ASSERT(!faceFontData->isSegmented());
-            appendFontDataWithInvalidUnicodeRangeIfLoading(fontData.get(), faceFontData.release(), m_fontFaces[i]->ranges());
+    auto addResult = m_descriptionToRangesMap.add(hashKey, FontRanges());
+    auto& fontRanges = addResult.iterator->value;
+
+    if (addResult.isNewEntry) {
+        for (auto& face : m_fontFaces) {
+            if (!face->isValid())
+                continue;
+            FontTraitsMask traitsMask = face->traitsMask();
+            bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
+            bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
+            if (RefPtr<SimpleFontData> faceFontData = face->getFontData(fontDescription, syntheticBold, syntheticItalic))
+                appendFontDataWithInvalidUnicodeRangeIfLoading(fontRanges, faceFontData.releaseNonNull(), face->ranges());
         }
     }
-    if (fontData->numRanges())
-        return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
-
-    return 0;
+    return fontRanges;
 }
 
 #if ENABLE(FONT_LOAD_EVENTS)
 bool CSSSegmentedFontFace::isLoading() const
 {
-    unsigned size = m_fontFaces.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (m_fontFaces[i]->loadState() == CSSFontFace::Loading)
+    for (auto& face : m_fontFaces) {
+        if (face->loadState() == CSSFontFace::Loading)
             return true;
     }
     return false;
@@ -162,9 +147,8 @@ bool CSSSegmentedFontFace::isLoading() const
 
 bool CSSSegmentedFontFace::checkFont() const
 {
-    unsigned size = m_fontFaces.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (m_fontFaces[i]->loadState() != CSSFontFace::Loaded)
+    for (auto& face : m_fontFaces) {
+        if (face->loadState() != CSSFontFace::Loaded)
             return false;
     }
     return true;
@@ -172,7 +156,7 @@ bool CSSSegmentedFontFace::checkFont() const
 
 void CSSSegmentedFontFace::loadFont(const FontDescription& fontDescription, PassRefPtr<LoadFontCallback> callback)
 {
-    getFontData(fontDescription); // Kick off the load.
+    fontRanges(fontDescription); // Kick off the load.
 
     if (callback) {
         if (isLoading())
index d23c14d..f627fd1 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef CSSSegmentedFontFace_h
 #define CSSSegmentedFontFace_h
 
+#include "FontRanges.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -35,9 +36,7 @@ namespace WebCore {
 
 class CSSFontFace;
 class CSSFontSelector;
-class FontData;
 class FontDescription;
-class SegmentedFontData;
 
 class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> {
 public:
@@ -50,7 +49,7 @@ public:
 
     void appendFontFace(PassRefPtr<CSSFontFace>);
 
-    PassRefPtr<FontData> getFontData(const FontDescription&);
+    FontRanges fontRanges(const FontDescription&);
 
 #if ENABLE(FONT_LOAD_EVENTS)
     class LoadFontCallback : public RefCounted<LoadFontCallback> {
@@ -74,7 +73,7 @@ private:
 #endif
 
     CSSFontSelector* m_fontSelector;
-    HashMap<unsigned, RefPtr<SegmentedFontData>> m_fontDataTable;
+    HashMap<unsigned, FontRanges> m_descriptionToRangesMap;
     Vector<RefPtr<CSSFontFace>, 1> m_fontFaces;
 #if ENABLE(FONT_LOAD_EVENTS)
     Vector<RefPtr<LoadFontCallback>> m_callbacks;
index 212b555..a36ddd7 100644 (file)
@@ -184,7 +184,7 @@ public:
     int emphasisMarkHeight(const AtomicString&) const;
 
     const SimpleFontData& primaryFontData() const;
-    const FontData* fontDataAt(unsigned) const;
+    const FontRanges& fallbackRangesAt(unsigned) const;
     GlyphData glyphDataForCharacter(UChar32, bool mirror, FontDataVariant = AutoVariant) const;
     
 #if PLATFORM(COCOA)
@@ -357,10 +357,10 @@ inline const SimpleFontData& Font::primaryFontData() const
     return m_glyphs->primarySimpleFontData(m_fontDescription);
 }
 
-inline const FontData* Font::fontDataAt(unsigned index) const
+inline const FontRanges& Font::fallbackRangesAt(unsigned index) const
 {
     ASSERT(m_glyphs);
-    return m_glyphs->realizeFontDataAt(m_fontDescription, index);
+    return m_glyphs->realizeFallbackRangesAt(m_fontDescription, index);
 }
 
 inline bool Font::isFixedPitch() const
diff --git a/Source/WebCore/platform/graphics/FontData.cpp b/Source/WebCore/platform/graphics/FontData.cpp
deleted file mode 100644 (file)
index eacd431..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "FontData.h"
-
-namespace WebCore {
-
-FontData::~FontData()
-{
-}
-
-} // namespace WebCore
index 3b239fb..3d2405d 100644 (file)
@@ -32,7 +32,6 @@
 #include "Font.h"
 #include "FontCache.h"
 #include "GlyphPage.h"
-#include "SegmentedFontData.h"
 
 namespace WebCore {
 
@@ -52,7 +51,7 @@ FontGlyphs::FontGlyphs(const FontPlatformData& platformData)
     , m_generation(fontCache().generation())
     , m_isForPlatformFont(true)
 {
-    m_realizedFontData.append(fontCache().fontForPlatformData(platformData));
+    m_realizedFallbackRanges.append(FontRanges(fontCache().fontForPlatformData(platformData)));
 }
 
 FontGlyphs::~FontGlyphs()
@@ -61,29 +60,24 @@ FontGlyphs::~FontGlyphs()
 
 void FontGlyphs::determinePitch(const FontDescription& description)
 {
-    const FontData& fontData = *realizeFontDataAt(description, 0);
-    if (is<SimpleFontData>(fontData))
-        m_pitch = downcast<SimpleFontData>(fontData).pitch();
-    else {
-        const SegmentedFontData& segmentedFontData = downcast<SegmentedFontData>(fontData);
-        unsigned numRanges = segmentedFontData.numRanges();
-        if (numRanges == 1)
-            m_pitch = segmentedFontData.rangeAt(0).fontData()->pitch();
-        else
-            m_pitch = VariablePitch;
-    }
+    auto& primaryRanges = realizeFallbackRangesAt(description, 0);
+    unsigned numRanges = primaryRanges.size();
+    if (numRanges == 1)
+        m_pitch = primaryRanges.rangeAt(0).fontData().pitch();
+    else
+        m_pitch = VariablePitch;
 }
 
 bool FontGlyphs::isLoadingCustomFonts() const
 {
-    for (auto& font : m_realizedFontData) {
-        if (font->isLoading())
+    for (auto& fontRanges : m_realizedFallbackRanges) {
+        if (fontRanges.isLoading())
             return true;
     }
     return false;
 }
 
-static RefPtr<FontData> realizeNextFamily(const FontDescription& description, unsigned& index, FontSelector* fontSelector)
+static FontRanges realizeNextFallback(const FontDescription& description, unsigned& index, FontSelector* fontSelector)
 {
     ASSERT(index < description.familyCount());
 
@@ -92,55 +86,53 @@ static RefPtr<FontData> realizeNextFamily(const FontDescription& description, un
         if (family.isEmpty())
             continue;
         if (fontSelector) {
-            if (auto font = fontSelector->getFontData(description, family))
-                return font;
+            auto ranges = fontSelector->fontRangesForFamily(description, family);
+            if (!ranges.isNull())
+                return ranges;
         }
         if (auto font = fontCache().fontForFamily(description, family))
-            return font;
+            return FontRanges(WTF::move(font));
     }
     // We didn't find a font. Try to find a similar font using our own specific knowledge about our platform.
     // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the
     // Geeza Pro font.
-    return fontCache().similarFontPlatformData(description);
+    return FontRanges(fontCache().similarFontPlatformData(description));
 }
 
-const FontData* FontGlyphs::realizeFontDataAt(const FontDescription& description, unsigned index)
+const FontRanges& FontGlyphs::realizeFallbackRangesAt(const FontDescription& description, unsigned index)
 {
-    if (index < m_realizedFontData.size())
-        return &m_realizedFontData[index].get();
+    if (index < m_realizedFallbackRanges.size())
+        return m_realizedFallbackRanges[index];
 
-    ASSERT(index == m_realizedFontData.size());
+    ASSERT(index == m_realizedFallbackRanges.size());
     ASSERT(fontCache().generation() == m_generation);
 
+    m_realizedFallbackRanges.append(FontRanges());
+    auto& fontRanges = m_realizedFallbackRanges.last();
+
     if (!index) {
-        RefPtr<FontData> result = realizeNextFamily(description, m_lastRealizedFamilyIndex, m_fontSelector.get());
-        if (!result && m_fontSelector)
-            result = m_fontSelector->getFontData(description, standardFamily);
-        if (!result)
-            result = fontCache().lastResortFallbackFont(description);
-
-        m_realizedFontData.append(*result);
-        return result.get();
+        fontRanges = realizeNextFallback(description, m_lastRealizedFallbackIndex, m_fontSelector.get());
+        if (fontRanges.isNull() && m_fontSelector)
+            fontRanges = m_fontSelector->fontRangesForFamily(description, standardFamily);
+        if (fontRanges.isNull())
+            fontRanges = FontRanges(fontCache().lastResortFallbackFont(description));
+        return fontRanges;
     }
 
-    RefPtr<FontData> result;
-    if (m_lastRealizedFamilyIndex < description.familyCount())
-        result = realizeNextFamily(description, m_lastRealizedFamilyIndex, m_fontSelector.get());
+    if (m_lastRealizedFallbackIndex < description.familyCount())
+        fontRanges = realizeNextFallback(description, m_lastRealizedFallbackIndex, m_fontSelector.get());
 
-    if (!result && m_fontSelector) {
-        ASSERT(m_lastRealizedFamilyIndex >= description.familyCount());
+    if (fontRanges.isNull() && m_fontSelector) {
+        ASSERT(m_lastRealizedFallbackIndex >= description.familyCount());
 
-        unsigned fontSelectorFallbackIndex = m_lastRealizedFamilyIndex - description.familyCount();
+        unsigned fontSelectorFallbackIndex = m_lastRealizedFallbackIndex - description.familyCount();
         if (fontSelectorFallbackIndex == m_fontSelector->fallbackFontDataCount())
-            return nullptr;
-        ++m_lastRealizedFamilyIndex;
-        result = m_fontSelector->getFallbackFontData(description, fontSelectorFallbackIndex);
+            return fontRanges;
+        ++m_lastRealizedFallbackIndex;
+        fontRanges = FontRanges(m_fontSelector->fallbackFontDataAt(description, fontSelectorFallbackIndex));
     }
-    if (!result)
-        return nullptr;
 
-    m_realizedFontData.append(*result);
-    return result.get();
+    return fontRanges;
 }
 
 static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32 upperBound)
@@ -263,10 +255,10 @@ static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 charact
 GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontDataVariant variant)
 {
     // System fallback is character-dependent.
-    auto& primaryFontData = *realizeFontDataAt(description, 0);
-    auto* originalFontData = primaryFontData.simpleFontDataForCharacter(c);
+    auto& primaryRanges = realizeFallbackRangesAt(description, 0);
+    auto* originalFontData = primaryRanges.fontDataForCharacter(c);
     if (!originalFontData)
-        originalFontData = &primaryFontData.simpleFontDataForFirstRange();
+        originalFontData = &primaryRanges.fontDataForFirstRange();
 
     RefPtr<SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont);
     if (!systemFallbackFontData)
@@ -295,9 +287,12 @@ GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescriptio
 
 GlyphData FontGlyphs::glyphDataForVariant(UChar32 c, const FontDescription& description, FontDataVariant variant, unsigned fallbackIndex)
 {
-    while (auto* fontData = realizeFontDataAt(description, fallbackIndex++)) {
-        auto* simpleFontData = fontData->simpleFontDataForCharacter(c);
-        GlyphData data = simpleFontData ? simpleFontData->glyphDataForCharacter(c) : GlyphData();
+    while (true) {
+        auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex++);
+        if (fontRanges.isNull())
+            break;
+        auto* fontData = fontRanges.fontDataForCharacter(c);
+        GlyphData data = fontData ? fontData->glyphDataForCharacter(c) : GlyphData();
         if (data.fontData) {
             // The variantFontData function should not normally return 0.
             // But if it does, we will just render the capital letter big.
@@ -316,8 +311,11 @@ GlyphData FontGlyphs::glyphDataForNormalVariant(UChar32 c, const FontDescription
 {
     const unsigned pageNumber = c / GlyphPage::size;
 
-    for (unsigned fallbackIndex = 0; auto* fontData = realizeFontDataAt(description, fallbackIndex); ++fallbackIndex) {
-        auto* simpleFontData = fontData->simpleFontDataForCharacter(c);
+    for (unsigned fallbackIndex = 0; true; ++fallbackIndex) {
+        auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex);
+        if (fontRanges.isNull())
+            break;
+        auto* simpleFontData = fontRanges.fontDataForCharacter(c);
         auto* page = simpleFontData ? simpleFontData->glyphPage(pageNumber) : nullptr;
         if (!page)
             continue;
@@ -345,25 +343,21 @@ GlyphData FontGlyphs::glyphDataForNormalVariant(UChar32 c, const FontDescription
     return glyphDataForSystemFallback(c, description, NormalVariant);
 }
 
-static RefPtr<GlyphPage> glyphPageFromFontData(unsigned pageNumber, const FontData& fontData)
+static RefPtr<GlyphPage> glyphPageFromFontRanges(unsigned pageNumber, const FontRanges& fontRanges)
 {
     const SimpleFontData* simpleFontData = nullptr;
-    if (fontData.isSegmented()) {
-        UChar32 pageRangeFrom = pageNumber * GlyphPage::size;
-        UChar32 pageRangeTo = pageRangeFrom + GlyphPage::size - 1;
-        auto& segmentedFontData = downcast<SegmentedFontData>(fontData);
-        for (unsigned i = 0; i < segmentedFontData.numRanges(); ++i) {
-            auto& range = segmentedFontData.rangeAt(i);
-            if (range.to()) {
-                if (range.from() <= pageRangeFrom && pageRangeTo <= range.to())
-                    simpleFontData = range.fontData().get();
-                break;
-            }
+    UChar32 pageRangeFrom = pageNumber * GlyphPage::size;
+    UChar32 pageRangeTo = pageRangeFrom + GlyphPage::size - 1;
+    for (unsigned i = 0; i < fontRanges.size(); ++i) {
+        auto& range = fontRanges.rangeAt(i);
+        if (range.to()) {
+            if (range.from() <= pageRangeFrom && pageRangeTo <= range.to())
+                simpleFontData = &range.fontData();
+            break;
         }
-        if (!simpleFontData)
-            return nullptr;
-    } else
-        simpleFontData = &downcast<SimpleFontData>(fontData);
+    }
+    if (!simpleFontData)
+        return nullptr;
 
     if (simpleFontData->platformData().orientation() == Vertical)
         return nullptr;
@@ -383,7 +377,7 @@ GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& de
 
     RefPtr<GlyphPage>& cachedPage = pageNumber ? m_cachedPages.add(pageNumber, nullptr).iterator->value : m_cachedPageZero;
     if (!cachedPage)
-        cachedPage = glyphPageFromFontData(pageNumber, *realizeFontDataAt(description, 0));
+        cachedPage = glyphPageFromFontRanges(pageNumber, realizeFallbackRangesAt(description, 0));
 
     GlyphData glyphData = cachedPage ? cachedPage->glyphDataForCharacter(c) : GlyphData();
     if (!glyphData.glyph) {
index 0e329bf..d80d458 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef FontGlyphs_h
 #define FontGlyphs_h
 
+#include "FontRanges.h"
 #include "FontSelector.h"
 #include "GlyphPage.h"
 #include "SimpleFontData.h"
@@ -66,7 +67,7 @@ public:
     const WidthCache& widthCache() const { return m_widthCache; }
 
     const SimpleFontData& primarySimpleFontData(const FontDescription&);
-    WEBCORE_EXPORT const FontData* realizeFontDataAt(const FontDescription&, unsigned index);
+    WEBCORE_EXPORT const FontRanges& realizeFallbackRangesAt(const FontDescription&, unsigned fallbackIndex);
 
 private:
     FontGlyphs(PassRefPtr<FontSelector>);
@@ -76,7 +77,8 @@ private:
     GlyphData glyphDataForNormalVariant(UChar32, const FontDescription&);
     GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontDataVariant, unsigned fallbackIndex);
 
-    Vector<Ref<FontData>, 1> m_realizedFontData;
+    Vector<FontRanges, 1> m_realizedFallbackRanges;
+    unsigned m_lastRealizedFallbackIndex { 0 };
 
     RefPtr<GlyphPage> m_cachedPageZero;
     HashMap<int, RefPtr<GlyphPage>> m_cachedPages;
@@ -85,10 +87,11 @@ private:
 
     const SimpleFontData* m_cachedPrimarySimpleFontData;
     RefPtr<FontSelector> m_fontSelector;
+
     WidthCache m_widthCache;
+
     unsigned m_fontSelectorVersion;
     unsigned short m_generation;
-    unsigned m_lastRealizedFamilyIndex { 0 };
     Pitch m_pitch { UnknownPitch };
     bool m_isForPlatformFont { false };
 };
@@ -104,10 +107,10 @@ inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescrip
 {
     ASSERT(isMainThread());
     if (!m_cachedPrimarySimpleFontData) {
-        auto& fontData = *realizeFontDataAt(description, 0);
-        m_cachedPrimarySimpleFontData = fontData.simpleFontDataForCharacter(' ');
+        auto& primaryRanges = realizeFallbackRangesAt(description, 0);
+        m_cachedPrimarySimpleFontData = primaryRanges.fontDataForCharacter(' ');
         if (!m_cachedPrimarySimpleFontData)
-            m_cachedPrimarySimpleFontData = &fontData.simpleFontDataForFirstRange();
+            m_cachedPrimarySimpleFontData = &primaryRanges.fontDataForFirstRange();
     }
     return *m_cachedPrimarySimpleFontData;
 }
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "SegmentedFontData.h"
+#include "FontRanges.h"
 
 #include "SimpleFontData.h"
 #include <wtf/Assertions.h>
 
 namespace WebCore {
 
-SegmentedFontData::SegmentedFontData()
+FontRanges::FontRanges()
 {
-    
 }
 
-SegmentedFontData::~SegmentedFontData()
+FontRanges::FontRanges(RefPtr<SimpleFontData>&& fontData)
 {
+    if (fontData)
+        m_ranges.append(Range { 0, 0x7FFFFFFF, fontData.releaseNonNull() });
 }
 
-const SimpleFontData* SegmentedFontData::simpleFontDataForCharacter(UChar32 c) const
+FontRanges::~FontRanges()
+{
+}
+
+const SimpleFontData* FontRanges::fontDataForCharacter(UChar32 c) const
 {
     for (auto& range : m_ranges) {
         if (range.from() <= c && c <= range.to())
-            return range.fontData().get();
+            return &range.fontData();
     }
     return nullptr;
 }
 
-const SimpleFontData& SegmentedFontData::simpleFontDataForFirstRange() const
-{
-    return *m_ranges[0].fontData();
-}
-
-bool SegmentedFontData::isCustomFont() const
+const SimpleFontData& FontRanges::fontDataForFirstRange() const
 {
-    // All segmented fonts are custom fonts.
-    return true;
+    return m_ranges[0].fontData();
 }
 
-bool SegmentedFontData::isLoading() const
+bool FontRanges::isLoading() const
 {
     for (auto& range : m_ranges) {
-        if (range.fontData()->isLoading())
+        if (range.fontData().isLoading())
             return true;
     }
     return false;
 }
 
-bool SegmentedFontData::isSegmented() const
-{
-    return true;
-}
-
-#ifndef NDEBUG
-String SegmentedFontData::description() const
-{
-    return "[segmented font]";
-}
-#endif
-
 } // namespace WebCore
similarity index 52%
rename from Source/WebCore/platform/graphics/FontData.h
rename to Source/WebCore/platform/graphics/FontRanges.h
index 09ad5a3..b49f98a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef FontData_h
-#define FontData_h
+#ifndef FontRanges_h
+#define FontRanges_h
 
-#include <unicode/utypes.h>
-#include <wtf/FastMalloc.h>
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "SimpleFontData.h"
+#include <wtf/TypeCasts.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
-class SimpleFontData;
-
-class FontData : public RefCounted<FontData> {
-    WTF_MAKE_NONCOPYABLE(FontData); WTF_MAKE_FAST_ALLOCATED;
+class FontRanges {
 public:
-    FontData()
-    {
-    }
+    struct Range {
+        Range(UChar32 from, UChar32 to, Ref<SimpleFontData>&& fontData)
+            : m_from(from)
+            , m_to(to)
+            , m_fontData(WTF::move(fontData))
+        {
+        }
 
-    virtual ~FontData();
+        UChar32 from() const { return m_from; }
+        UChar32 to() const { return m_to; }
+        const SimpleFontData& fontData() const { return *m_fontData; }
 
-    virtual const SimpleFontData* simpleFontDataForCharacter(UChar32) const = 0;
-    virtual const SimpleFontData& simpleFontDataForFirstRange() const = 0;
-    virtual bool isCustomFont() const = 0;
-    virtual bool isLoading() const = 0;
-    virtual bool isSegmented() const = 0;
+    private:
+        UChar32 m_from;
+        UChar32 m_to;
+        RefPtr<SimpleFontData> m_fontData;
+    };
 
-#ifndef NDEBUG
-    virtual String description() const = 0;
-#endif
+    FontRanges();
+    explicit FontRanges(RefPtr<SimpleFontData>&&);
+    ~FontRanges();
+
+    bool isNull() const { return m_ranges.isEmpty(); }
+
+    void appendRange(const Range& range) { m_ranges.append(range); }
+    unsigned size() const { return m_ranges.size(); }
+    const Range& rangeAt(unsigned i) const { return m_ranges[i]; }
+
+    const SimpleFontData* fontDataForCharacter(UChar32) const;
+    const SimpleFontData& fontDataForFirstRange() const;
+    bool isLoading() const;
+
+private:
+    Vector<Range, 1> m_ranges;
 };
 
-} // namespace WebCore
+}
 
-#endif // FontData_h
+#endif
index aec4a9b..d0e200f 100644 (file)
 #ifndef FontSelector_h
 #define FontSelector_h
 
+#include "FontRanges.h"
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class FontData;
 class FontDescription;
 class FontSelectorClient;
 
@@ -40,9 +40,8 @@ class FontSelector : public RefCounted<FontSelector> {
 public:
     virtual ~FontSelector() { }
 
-    // FIXME: Remove the "get" prefix from these two member functions
-    virtual PassRefPtr<FontData> getFontData(const FontDescription&, const AtomicString& familyName) = 0;
-    virtual PassRefPtr<FontData> getFallbackFontData(const FontDescription&, size_t) = 0;
+    virtual FontRanges fontRangesForFamily(const FontDescription&, const AtomicString&) = 0;
+    virtual PassRefPtr<SimpleFontData> fallbackFontDataAt(const FontDescription&, size_t) = 0;
 
     virtual size_t fallbackFontDataCount() = 0;
     virtual bool resolvesFamilyFor(const FontDescription&) const = 0;
diff --git a/Source/WebCore/platform/graphics/SegmentedFontData.h b/Source/WebCore/platform/graphics/SegmentedFontData.h
deleted file mode 100644 (file)
index 1c9e738..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2008, 2009, 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef SegmentedFontData_h
-#define SegmentedFontData_h
-
-#include "FontData.h"
-#include <wtf/TypeCasts.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class SimpleFontData;
-
-struct FontDataRange {
-    FontDataRange(UChar32 from, UChar32 to, PassRefPtr<SimpleFontData> fontData)
-        : m_from(from)
-        , m_to(to)
-        , m_fontData(fontData)
-    {
-    }
-
-    UChar32 from() const { return m_from; }
-    UChar32 to() const { return m_to; }
-    PassRefPtr<SimpleFontData> fontData() const { return m_fontData; }
-
-private:
-    UChar32 m_from;
-    UChar32 m_to;
-    RefPtr<SimpleFontData> m_fontData;
-};
-
-class SegmentedFontData : public FontData {
-public:
-    static PassRefPtr<SegmentedFontData> create() { return adoptRef(new SegmentedFontData); }
-
-    virtual ~SegmentedFontData();
-
-    void appendRange(const FontDataRange& range) { m_ranges.append(range); }
-    unsigned numRanges() const { return m_ranges.size(); }
-    const FontDataRange& rangeAt(unsigned i) const { return m_ranges[i]; }
-
-#ifndef NDEBUG
-    virtual String description() const;
-#endif
-
-private:
-    SegmentedFontData();
-
-    virtual const SimpleFontData* simpleFontDataForCharacter(UChar32) const override;
-    virtual const SimpleFontData& simpleFontDataForFirstRange() const override;
-
-    virtual bool isCustomFont() const;
-    virtual bool isLoading() const;
-    virtual bool isSegmented() const;
-
-    RefPtr<SimpleFontData> m_nullFontData;
-    Vector<FontDataRange, 1> m_ranges;
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SegmentedFontData)
-    static bool isType(const WebCore::FontData& fontData) { return fontData.isSegmented(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // SegmentedFontData_h
index d6a15db..49d6ba7 100644 (file)
@@ -157,16 +157,6 @@ SimpleFontData::~SimpleFontData()
     removeFromSystemFallbackCache();
 }
 
-const SimpleFontData* SimpleFontData::simpleFontDataForCharacter(UChar32) const
-{
-    return this;
-}
-
-const SimpleFontData& SimpleFontData::simpleFontDataForFirstRange() const
-{
-    return *this;
-}
-
 static bool fillGlyphPage(GlyphPage& pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
 #if ENABLE(SVG_FONTS)
@@ -288,11 +278,6 @@ GlyphData SimpleFontData::glyphDataForCharacter(UChar32 character) const
     return page->glyphDataForCharacter(character);
 }
 
-bool SimpleFontData::isSegmented() const
-{
-    return false;
-}
-
 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() const
 {
     if (!m_derivedFontData)
index cd9f4e1..479cd1a 100644 (file)
@@ -25,7 +25,6 @@
 #define SimpleFontData_h
 
 #include "FontBaseline.h"
-#include "FontData.h"
 #include "FontMetrics.h"
 #include "FontPlatformData.h"
 #include "FloatRect.h"
@@ -68,7 +67,7 @@ struct WidthIterator;
 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
 
-class SimpleFontData final : public FontData {
+class SimpleFontData : public RefCounted<SimpleFontData> {
 public:
     class SVGData {
         WTF_MAKE_FAST_ALLOCATED;
@@ -92,7 +91,7 @@ public:
         return adoptRef(*new SimpleFontData(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic));
     }
 
-    virtual ~SimpleFontData();
+    ~SimpleFontData();
 
     static const SimpleFontData* systemFallback() { return reinterpret_cast<const SimpleFontData*>(-1); }
 
@@ -178,12 +177,11 @@ public:
     const SVGData* svgData() const { return m_svgData.get(); }
     bool isSVGFont() const { return !!m_svgData; }
 
-    virtual bool isCustomFont() const override { return m_isCustomFont; }
-    virtual bool isLoading() const override { return m_isLoading; }
-    virtual bool isSegmented() const override;
+    bool isCustomFont() const { return m_isCustomFont; }
+    bool isLoading() const { return m_isLoading; }
 
 #ifndef NDEBUG
-    virtual String description() const override;
+    String description() const;
 #endif
 
 #if USE(APPKIT)
@@ -229,9 +227,6 @@ private:
     PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, float scaleFactor) const;
     PassRefPtr<SimpleFontData> platformCreateScaledFontData(const FontDescription&, float scaleFactor) const;
 
-    virtual const SimpleFontData* simpleFontDataForCharacter(UChar32) const override;
-    virtual const SimpleFontData& simpleFontDataForFirstRange() const override;
-
     void removeFromSystemFallbackCache();
 
 #if PLATFORM(WIN)
@@ -371,8 +366,4 @@ ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SimpleFontData)
-    static bool isType(const WebCore::FontData& fontData) { return !fontData.isSegmented(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
 #endif // SimpleFontData_h
index 955b9e1..279fb02 100644 (file)
@@ -62,7 +62,7 @@
 
     // By the time a WebCascadeList is used, the Font has already been asked to realize all of its
     // FontData, so this loop does not hit the FontCache.
-    while (_font->fontDataAt(_count))
+    while (!_font->fallbackRangesAt(_count).isNull())
         _count++;
 
     return self;
@@ -82,9 +82,9 @@
     } else
         _fontDescriptors.grow(index + 1);
 
-    const WebCore::SimpleFontData* simpleFontData = _font->fontDataAt(index)->simpleFontDataForCharacter(_character);
+    const WebCore::SimpleFontData* simpleFontData = _font->fallbackRangesAt(index).fontDataForCharacter(_character);
     if (!simpleFontData)
-        simpleFontData = &_font->fontDataAt(index)->simpleFontDataForFirstRange();
+        simpleFontData = &_font->fallbackRangesAt(index).fontDataForFirstRange();
     fontDescriptor = CTFontCopyFontDescriptor(simpleFontData->platformData().ctFont());
     _fontDescriptors[index] = adoptCF(fontDescriptor);
     return (id)fontDescriptor;
@@ -201,9 +201,9 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
         isSystemFallback = true;
 
         U16_GET(cp, 0, 0, length, baseCharacter);
-        fontData = m_font.fontDataAt(0)->simpleFontDataForCharacter(baseCharacter);
+        fontData = m_font.fallbackRangesAt(0).fontDataForCharacter(baseCharacter);
         if (!fontData)
-            fontData = &m_font.fontDataAt(0)->simpleFontDataForFirstRange();
+            fontData = &m_font.fallbackRangesAt(0).fontDataForFirstRange();
 
         RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
 
@@ -256,9 +256,9 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
             RetainPtr<CFTypeRef> runFontEqualityObject = FontPlatformData::objectForEqualityCheck(runFont);
             if (!CFEqual(runFontEqualityObject.get(), fontData->platformData().objectForEqualityCheck().get())) {
                 // Begin trying to see if runFont matches any of the fonts in the fallback list.
-                unsigned i = 0;
-                for (const FontData* candidateFontData = m_font.fontDataAt(i); candidateFontData; candidateFontData = m_font.fontDataAt(++i)) {
-                    runFontData = candidateFontData->simpleFontDataForCharacter(baseCharacter);
+
+                for (unsigned i = 0; !m_font.fallbackRangesAt(i).isNull(); ++i) {
+                    runFontData = m_font.fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
                     if (!runFontData)
                         continue;
                     RetainPtr<CFTypeRef> runFontEqualityObject = runFontData->platformData().objectForEqualityCheck();
index 11d7550..48ad796 100644 (file)
@@ -138,9 +138,8 @@ const SimpleFontData* Font::fontDataForCombiningCharacterSequence(const UChar* c
 
     bool triedBaseCharacterFontData = false;
 
-    unsigned i = 0;
-    for (const FontData* fontData = fontDataAt(0); fontData; fontData = fontDataAt(++i)) {
-        const SimpleFontData* simpleFontData = fontData->simpleFontDataForCharacter(baseCharacter);
+    for (unsigned i = 0; !fallbackRangesAt(i).isEmpty(); ++i) {
+        const SimpleFontData* simpleFontData = fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
         if (!simpleFontData)
             continue;
 #if PLATFORM(IOS)