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 |
60 bool ensureCustomFontData(); | 63 bool ensureCustomFontData(); |
61 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); | 64 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); |
62 | 65 |
63 #if ENABLE(SVG_FONTS) | 66 #if ENABLE(SVG_FONTS) |
64 bool ensureSVGFontData(); | 67 bool ensureSVGFontData(); |
65 SVGFontElement* getSVGFontById(const String&) const; | 68 SVGFontElement* getSVGFontById(const String&) const; |
66 #endif | 69 #endif |
67 | 70 |
68 protected: | 71 protected: |
69 virtual bool isSafeToUnlock() const OVERRIDE; | 72 virtual bool isSafeToUnlock() const OVERRIDE; |
70 | 73 |
71 private: | 74 private: |
72 virtual void checkNotify() OVERRIDE; | 75 virtual void checkNotify() OVERRIDE; |
73 void fontLoadWaitLimitCallback(Timer<FontResource>*); | 76 void fontLoadWaitLimitCallback(Timer<FontResource>*); |
74 | 77 |
75 OwnPtr<FontCustomPlatformData> m_fontData; | 78 OwnPtr<FontCustomPlatformData> m_fontData; |
76 bool m_loadInitiated; | 79 bool m_loadInitiated; |
77 bool m_exceedsFontLoadWaitLimit; | 80 bool m_exceedsFontLoadWaitLimit; |
| 81 bool m_corsFailed; |
78 Timer<FontResource> m_fontLoadWaitLimitTimer; | 82 Timer<FontResource> m_fontLoadWaitLimitTimer; |
79 | 83 |
80 #if ENABLE(SVG_FONTS) | 84 #if ENABLE(SVG_FONTS) |
81 RefPtr<WebCore::SVGDocument> m_externalSVGDocument; | 85 RefPtr<WebCore::SVGDocument> m_externalSVGDocument; |
82 #endif | 86 #endif |
83 | 87 |
84 friend class MemoryCache; | 88 friend class MemoryCache; |
85 }; | 89 }; |
86 | 90 |
87 DEFINE_RESOURCE_TYPE_CASTS(Font); | 91 DEFINE_RESOURCE_TYPE_CASTS(Font); |
88 | 92 |
89 class FontResourceClient : public ResourceClient { | 93 class FontResourceClient : public ResourceClient { |
90 public: | 94 public: |
91 virtual ~FontResourceClient() { } | 95 virtual ~FontResourceClient() { } |
92 static ResourceClientType expectedType() { return FontType; } | 96 static ResourceClientType expectedType() { return FontType; } |
93 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } | 97 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } |
94 virtual void fontLoaded(FontResource*) { } | 98 virtual void fontLoaded(FontResource*) { } |
95 virtual void didStartFontLoad(FontResource*) { } | 99 virtual void didStartFontLoad(FontResource*) { } |
96 virtual void fontLoadWaitLimitExceeded(FontResource*) { } | 100 virtual void fontLoadWaitLimitExceeded(FontResource*) { } |
| 101 virtual void corsFailed(FontResource*) { } |
97 }; | 102 }; |
98 | 103 |
99 } | 104 } |
100 | 105 |
101 #endif | 106 #endif |
OLD | NEW |