OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) OVERRIDE; | 51 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) OVERRIDE; |
52 | 52 |
53 virtual void didAddClient(ResourceClient*) OVERRIDE; | 53 virtual void didAddClient(ResourceClient*) OVERRIDE; |
54 | 54 |
55 virtual void allClientsRemoved() OVERRIDE; | 55 virtual void allClientsRemoved() OVERRIDE; |
56 void beginLoadIfNeeded(ResourceFetcher* dl); | 56 void beginLoadIfNeeded(ResourceFetcher* dl); |
57 virtual bool stillNeedsLoad() const OVERRIDE { return !m_loadInitiated; } | 57 virtual bool stillNeedsLoad() const OVERRIDE { return !m_loadInitiated; } |
58 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } | 58 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } |
59 | 59 |
60 void setCORSFailed() { m_corsFailed = true; } | |
61 bool isCORSFailed() const { return m_corsFailed; } | |
62 | |
63 bool ensureCustomFontData(); | 60 bool ensureCustomFontData(); |
64 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); | 61 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); |
65 | 62 |
66 #if ENABLE(SVG_FONTS) | 63 #if ENABLE(SVG_FONTS) |
67 bool ensureSVGFontData(); | 64 bool ensureSVGFontData(); |
68 SVGFontElement* getSVGFontById(const String&) const; | 65 SVGFontElement* getSVGFontById(const String&) const; |
69 #endif | 66 #endif |
70 | 67 |
71 protected: | 68 protected: |
72 virtual bool isSafeToUnlock() const OVERRIDE; | 69 virtual bool isSafeToUnlock() const OVERRIDE; |
73 | 70 |
74 private: | 71 private: |
75 virtual void checkNotify() OVERRIDE; | 72 virtual void checkNotify() OVERRIDE; |
76 void fontLoadWaitLimitCallback(Timer<FontResource>*); | 73 void fontLoadWaitLimitCallback(Timer<FontResource>*); |
77 | 74 |
78 OwnPtr<FontCustomPlatformData> m_fontData; | 75 OwnPtr<FontCustomPlatformData> m_fontData; |
79 bool m_loadInitiated; | 76 bool m_loadInitiated; |
80 bool m_exceedsFontLoadWaitLimit; | 77 bool m_exceedsFontLoadWaitLimit; |
81 bool m_corsFailed; | |
82 Timer<FontResource> m_fontLoadWaitLimitTimer; | 78 Timer<FontResource> m_fontLoadWaitLimitTimer; |
83 | 79 |
84 #if ENABLE(SVG_FONTS) | 80 #if ENABLE(SVG_FONTS) |
85 RefPtr<WebCore::Document> m_externalSVGDocument; | 81 RefPtr<WebCore::Document> m_externalSVGDocument; |
86 #endif | 82 #endif |
87 | 83 |
88 friend class MemoryCache; | 84 friend class MemoryCache; |
89 }; | 85 }; |
90 | 86 |
91 DEFINE_RESOURCE_TYPE_CASTS(Font); | 87 DEFINE_RESOURCE_TYPE_CASTS(Font); |
92 | 88 |
93 class FontResourceClient : public ResourceClient { | 89 class FontResourceClient : public ResourceClient { |
94 public: | 90 public: |
95 virtual ~FontResourceClient() { } | 91 virtual ~FontResourceClient() { } |
96 static ResourceClientType expectedType() { return FontType; } | 92 static ResourceClientType expectedType() { return FontType; } |
97 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } | 93 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } |
98 virtual void fontLoaded(FontResource*) { } | 94 virtual void fontLoaded(FontResource*) { } |
99 virtual void didStartFontLoad(FontResource*) { } | 95 virtual void didStartFontLoad(FontResource*) { } |
100 virtual void fontLoadWaitLimitExceeded(FontResource*) { } | 96 virtual void fontLoadWaitLimitExceeded(FontResource*) { } |
101 virtual void corsFailed(FontResource*) { } | |
102 }; | 97 }; |
103 | 98 |
104 } | 99 } |
105 | 100 |
106 #endif | 101 #endif |
OLD | NEW |