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

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: Update tests for landing 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;
51 49
52 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override; 50 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override;
53 51
54 virtual void didAddClient(ResourceClient*) override; 52 virtual void didAddClient(ResourceClient*) override;
55 53
56 virtual void allClientsRemoved() override; 54 virtual void allClientsRemoved() override;
57 void beginLoadIfNeeded(ResourceFetcher* dl); 55 void beginLoadIfNeeded(ResourceFetcher* dl);
58 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; } 56 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; }
59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } 57 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; }
60 58
61 bool loadScheduled() const { return m_state != Unloaded; } 59 bool loadScheduled() const { return m_state != Unloaded; }
62 void didScheduleLoad(); 60 void didScheduleLoad();
63 void didUnscheduleLoad(); 61 void didUnscheduleLoad();
64 62
65 void setCORSFailed() { m_corsFailed = true; } 63 void setCORSFailed() { m_corsFailed = true; }
66 bool isCORSFailed() const { return m_corsFailed; } 64 bool isCORSFailed() const { return m_corsFailed; }
67 65
68 bool ensureCustomFontData(); 66 bool ensureCustomFontData();
69 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 67 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
70 68
71 #if ENABLE(SVG_FONTS)
72 bool ensureSVGFontData();
73 SVGFontElement* getSVGFontById(const String&) const;
74 #endif
75
76 protected: 69 protected:
77 virtual bool isSafeToUnlock() const override; 70 virtual bool isSafeToUnlock() const override;
78 71
79 private: 72 private:
80 virtual void checkNotify() override; 73 virtual void checkNotify() override;
81 void fontLoadWaitLimitCallback(Timer<FontResource>*); 74 void fontLoadWaitLimitCallback(Timer<FontResource>*);
82 75
83 enum State { Unloaded, LoadScheduled, LoadInitiated }; 76 enum State { Unloaded, LoadScheduled, LoadInitiated };
84 77
85 OwnPtr<FontCustomPlatformData> m_fontData; 78 OwnPtr<FontCustomPlatformData> m_fontData;
86 State m_state; 79 State m_state;
87 bool m_exceedsFontLoadWaitLimit; 80 bool m_exceedsFontLoadWaitLimit;
88 bool m_corsFailed; 81 bool m_corsFailed;
89 Timer<FontResource> m_fontLoadWaitLimitTimer; 82 Timer<FontResource> m_fontLoadWaitLimitTimer;
90 83
91 #if ENABLE(SVG_FONTS)
92 RefPtrWillBeMember<Document> m_externalSVGDocument;
93 #endif
94
95 friend class MemoryCache; 84 friend class MemoryCache;
96 }; 85 };
97 86
98 DEFINE_RESOURCE_TYPE_CASTS(Font); 87 DEFINE_RESOURCE_TYPE_CASTS(Font);
99 88
100 class FontResourceClient : public ResourceClient { 89 class FontResourceClient : public ResourceClient {
101 public: 90 public:
102 virtual ~FontResourceClient() { } 91 virtual ~FontResourceClient() { }
103 static ResourceClientType expectedType() { return FontType; } 92 static ResourceClientType expectedType() { return FontType; }
104 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); } 93 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); }
105 virtual void fontLoaded(FontResource*) { } 94 virtual void fontLoaded(FontResource*) { }
106 virtual void didStartFontLoad(FontResource*) { } 95 virtual void didStartFontLoad(FontResource*) { }
107 virtual void fontLoadWaitLimitExceeded(FontResource*) { } 96 virtual void fontLoadWaitLimitExceeded(FontResource*) { }
108 }; 97 };
109 98
110 } 99 }
111 100
112 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698