OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #import <AppKit/AppKit.h> | 33 #import <AppKit/AppKit.h> |
34 #include "platform/LayoutTestSupport.h" | 34 #include "platform/LayoutTestSupport.h" |
35 #include "platform/RuntimeEnabledFeatures.h" | 35 #include "platform/RuntimeEnabledFeatures.h" |
36 #include "platform/fonts/FontDescription.h" | 36 #include "platform/fonts/FontDescription.h" |
37 #include "platform/fonts/FontFaceCreationParams.h" | 37 #include "platform/fonts/FontFaceCreationParams.h" |
38 #include "platform/fonts/FontPlatformData.h" | 38 #include "platform/fonts/FontPlatformData.h" |
39 #include "platform/fonts/SimpleFontData.h" | 39 #include "platform/fonts/SimpleFontData.h" |
40 #include "platform/fonts/mac/FontFamilyMatcherMac.h" | 40 #include "platform/fonts/mac/FontFamilyMatcherMac.h" |
41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebTaskRunner.h" |
42 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
43 #include <wtf/Functional.h> | 44 #include <wtf/Functional.h> |
44 #include <wtf/MainThread.h> | 45 #include <wtf/MainThread.h> |
45 #include <wtf/StdLibExtras.h> | 46 #include <wtf/StdLibExtras.h> |
46 | 47 |
47 // Forward declare Mac SPIs. | 48 // Forward declare Mac SPIs. |
48 // Request for public API: rdar://13803570 | 49 // Request for public API: rdar://13803570 |
49 @interface NSFont (WebKitSPI) | 50 @interface NSFont (WebKitSPI) |
50 + (NSFont*)findFontLike:(NSFont*)font forString:(NSString*)string withRange:(NSR
ange)range inLanguage:(id)useNil; | 51 + (NSFont*)findFontLike:(NSFont*)font forString:(NSString*)string withRange:(NSR
ange)range inLanguage:(id)useNil; |
51 + (NSFont*)findFontLike:(NSFont*)font forCharacter:(UniChar)uc inLanguage:(id)us
eNil; | 52 + (NSFont*)findFontLike:(NSFont*)font forCharacter:(UniChar)uc inLanguage:(id)us
eNil; |
52 @end | 53 @end |
53 | 54 |
54 namespace blink { | 55 namespace blink { |
55 | 56 |
56 static void invalidateFontCache() | 57 static void invalidateFontCache() |
57 { | 58 { |
58 if (!isMainThread()) { | 59 if (!isMainThread()) { |
59 Platform::current()->mainThread()->postTask(FROM_HERE, bind(&invalidateF
ontCache)); | 60 Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, bin
d(&invalidateFontCache)); |
60 return; | 61 return; |
61 } | 62 } |
62 FontCache::fontCache()->invalidate(); | 63 FontCache::fontCache()->invalidate(); |
63 } | 64 } |
64 | 65 |
65 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCe
nterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) | 66 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCe
nterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) |
66 { | 67 { |
67 ASSERT_UNUSED(observer, observer == FontCache::fontCache()); | 68 ASSERT_UNUSED(observer, observer == FontCache::fontCache()); |
68 ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotifi
cation)); | 69 ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotifi
cation)); |
69 invalidateFontCache(); | 70 invalidateFontCache(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // When loading fails, we do not want to use the returned FontPlatformData s
ince it will not have | 210 // When loading fails, we do not want to use the returned FontPlatformData s
ince it will not have |
210 // a valid SkTypeface. | 211 // a valid SkTypeface. |
211 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); | 212 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); |
212 if (!platformData->typeface()) { | 213 if (!platformData->typeface()) { |
213 return nullptr; | 214 return nullptr; |
214 } | 215 } |
215 return platformData.leakPtr(); | 216 return platformData.leakPtr(); |
216 } | 217 } |
217 | 218 |
218 } // namespace blink | 219 } // namespace blink |
OLD | NEW |