Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1290)

Side by Side Diff: Source/core/fetch/FontResource.h

Issue 656913006: Remove SVG fonts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
31 #include "platform/Timer.h" 31 #include "platform/Timer.h"
32 #include "platform/fonts/FontOrientation.h" 32 #include "platform/fonts/FontOrientation.h"
33 #include "platform/fonts/FontWidthVariant.h" 33 #include "platform/fonts/FontWidthVariant.h"
34 #include "wtf/OwnPtr.h" 34 #include "wtf/OwnPtr.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class Document; 38 class Document;
39 class ResourceFetcher; 39 class ResourceFetcher;
40 class FontPlatformData; 40 class FontPlatformData;
41 class SVGFontElement;
42 class FontCustomPlatformData; 41 class FontCustomPlatformData;
43 42
44 class FontResource final : public Resource { 43 class FontResource final : public Resource {
45 public: 44 public:
46 typedef ResourceClient ClientType; 45 typedef ResourceClient ClientType;
47 46
48 FontResource(const ResourceRequest&); 47 FontResource(const ResourceRequest&);
49 virtual ~FontResource(); 48 virtual ~FontResource();
50 virtual void trace(Visitor*) override; 49 virtual void trace(Visitor*) override;
51 50
52 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override; 51 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override;
53 52
54 virtual void didAddClient(ResourceClient*) override; 53 virtual void didAddClient(ResourceClient*) override;
55 54
56 virtual void allClientsRemoved() override; 55 virtual void allClientsRemoved() override;
57 void beginLoadIfNeeded(ResourceFetcher* dl); 56 void beginLoadIfNeeded(ResourceFetcher* dl);
58 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; } 57 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; }
59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } 58 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; }
60 59
61 bool loadScheduled() const { return m_state != Unloaded; } 60 bool loadScheduled() const { return m_state != Unloaded; }
62 void didScheduleLoad(); 61 void didScheduleLoad();
63 void didUnscheduleLoad(); 62 void didUnscheduleLoad();
64 63
65 void setCORSFailed() { m_corsFailed = true; } 64 void setCORSFailed() { m_corsFailed = true; }
66 bool isCORSFailed() const { return m_corsFailed; } 65 bool isCORSFailed() const { return m_corsFailed; }
67 66
68 bool ensureCustomFontData(); 67 bool ensureCustomFontData();
69 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 68 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
70 69
71 #if ENABLE(SVG_FONTS)
72 bool ensureSVGFontData();
73 SVGFontElement* getSVGFontById(const String&) const;
74 #endif
75
76 protected: 70 protected:
77 virtual bool isSafeToUnlock() const override; 71 virtual bool isSafeToUnlock() const override;
78 72
79 private: 73 private:
80 virtual void checkNotify() override; 74 virtual void checkNotify() override;
81 void fontLoadWaitLimitCallback(Timer<FontResource>*); 75 void fontLoadWaitLimitCallback(Timer<FontResource>*);
82 76
83 enum State { Unloaded, LoadScheduled, LoadInitiated }; 77 enum State { Unloaded, LoadScheduled, LoadInitiated };
84 78
85 OwnPtr<FontCustomPlatformData> m_fontData; 79 OwnPtr<FontCustomPlatformData> m_fontData;
86 State m_state; 80 State m_state;
87 bool m_exceedsFontLoadWaitLimit; 81 bool m_exceedsFontLoadWaitLimit;
88 bool m_corsFailed; 82 bool m_corsFailed;
89 Timer<FontResource> m_fontLoadWaitLimitTimer; 83 Timer<FontResource> m_fontLoadWaitLimitTimer;
90 84
91 #if ENABLE(SVG_FONTS)
92 RefPtrWillBeMember<Document> m_externalSVGDocument;
93 #endif
94
95 friend class MemoryCache; 85 friend class MemoryCache;
96 }; 86 };
97 87
98 DEFINE_RESOURCE_TYPE_CASTS(Font); 88 DEFINE_RESOURCE_TYPE_CASTS(Font);
99 89
100 class FontResourceClient : public ResourceClient { 90 class FontResourceClient : public ResourceClient {
101 public: 91 public:
102 virtual ~FontResourceClient() { } 92 virtual ~FontResourceClient() { }
103 static ResourceClientType expectedType() { return FontType; } 93 static ResourceClientType expectedType() { return FontType; }
104 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); } 94 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); }
105 virtual void fontLoaded(FontResource*) { } 95 virtual void fontLoaded(FontResource*) { }
106 virtual void didStartFontLoad(FontResource*) { } 96 virtual void didStartFontLoad(FontResource*) { }
107 virtual void fontLoadWaitLimitExceeded(FontResource*) { } 97 virtual void fontLoadWaitLimitExceeded(FontResource*) { }
108 }; 98 };
109 99
110 } 100 }
111 101
112 #endif 102 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698