Title: [188227] trunk/Source/WebCore
- Revision
- 188227
- Author
- [email protected]
- Date
- 2015-08-10 13:51:32 -0700 (Mon, 10 Aug 2015)
Log Message
Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
https://bugs.webkit.org/show_bug.cgi?id=147033
Reviewed by Joseph Pecoraro.
Implement systemFontFamilies for iOS.
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::FontCache::systemFontFamilies):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (188226 => 188227)
--- trunk/Source/WebCore/ChangeLog 2015-08-10 20:49:47 UTC (rev 188226)
+++ trunk/Source/WebCore/ChangeLog 2015-08-10 20:51:32 UTC (rev 188227)
@@ -1,5 +1,17 @@
2015-08-10 Devin Rousso <[email protected]>
+ Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
+ https://bugs.webkit.org/show_bug.cgi?id=147033
+
+ Reviewed by Joseph Pecoraro.
+
+ Implement systemFontFamilies for iOS.
+
+ * platform/graphics/ios/FontCacheIOS.mm:
+ (WebCore::FontCache::systemFontFamilies):
+
+2015-08-10 Devin Rousso <[email protected]>
+
Web Inspector: Invalid selectors can be applied to the stylesheet
https://bugs.webkit.org/show_bug.cgi?id=147230
Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (188226 => 188227)
--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2015-08-10 20:49:47 UTC (rev 188226)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2015-08-10 20:51:32 UTC (rev 188227)
@@ -33,6 +33,7 @@
#import "CoreTextSPI.h"
#import "FontCascade.h"
#import "RenderThemeIOS.h"
+#import <wtf/HashSet.h>
#import <wtf/NeverDestroyed.h>
#import <wtf/RetainPtr.h>
#import <wtf/text/CString.h>
@@ -472,8 +473,25 @@
Vector<String> FontCache::systemFontFamilies()
{
- // FIXME: <https://webkit.org/b/147033> Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
+ // FIXME: <rdar://problem/21890188>
Vector<String> fontFamilies;
+ auto emptyFontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes((CFDictionaryRef) @{ }));
+ auto matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(emptyFontDescriptor.get(), nullptr));
+ if (!matchedDescriptors)
+ return fontFamilies;
+
+ CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get());
+ if (!numMatches)
+ return fontFamilies;
+
+ HashSet<String> visited;
+ for (CFIndex i = 0; i < numMatches; ++i) {
+ auto fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matchedDescriptors.get(), i));
+ if (auto familyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute))))
+ visited.add(familyName.get());
+ }
+
+ copyToVector(visited, fontFamilies);
return fontFamilies;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes