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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSFontSelector.h

Issue 2728513002: Revert of Move the FontFaceCache stored in CSSFontSelector to be stored in Document. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSFontSelector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef CSSFontSelector_h 26 #ifndef CSSFontSelector_h
27 #define CSSFontSelector_h 27 #define CSSFontSelector_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/css/FontFaceCache.h" 30 #include "core/css/FontFaceCache.h"
31 #include "core/dom/Document.h"
32 #include "platform/fonts/FontSelector.h" 31 #include "platform/fonts/FontSelector.h"
33 #include "platform/fonts/GenericFontFamilySettings.h" 32 #include "platform/fonts/GenericFontFamilySettings.h"
34 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
35 #include "wtf/Forward.h" 34 #include "wtf/Forward.h"
36 #include "wtf/HashMap.h" 35 #include "wtf/HashMap.h"
37 #include "wtf/HashSet.h" 36 #include "wtf/HashSet.h"
38 37
39 namespace blink { 38 namespace blink {
40 39
41 class CSSFontSelectorClient; 40 class CSSFontSelectorClient;
41 class Document;
42 class FontDescription; 42 class FontDescription;
43 43
44 class CORE_EXPORT CSSFontSelector : public FontSelector { 44 class CORE_EXPORT CSSFontSelector : public FontSelector {
45 public: 45 public:
46 static CSSFontSelector* create(Document* document) { 46 static CSSFontSelector* create(Document* document) {
47 return new CSSFontSelector(document); 47 return new CSSFontSelector(document);
48 } 48 }
49 ~CSSFontSelector() override; 49 ~CSSFontSelector() override;
50 50
51 unsigned version() const override { 51 unsigned version() const override { return m_fontFaceCache.version(); }
52 return m_document->fontFaceCache()->version();
53 }
54 52
55 PassRefPtr<FontData> getFontData(const FontDescription&, 53 PassRefPtr<FontData> getFontData(const FontDescription&,
56 const AtomicString&) override; 54 const AtomicString&) override;
57 void willUseFontData(const FontDescription&, 55 void willUseFontData(const FontDescription&,
58 const AtomicString& family, 56 const AtomicString& family,
59 const String& text) override; 57 const String& text) override;
60 void willUseRange(const FontDescription&, 58 void willUseRange(const FontDescription&,
61 const AtomicString& familyName, 59 const AtomicString& familyName,
62 const FontDataForRangeSet&) override; 60 const FontDataForRangeSet&) override;
63 bool isPlatformFontAvailable(const FontDescription&, 61 bool isPlatformFontAvailable(const FontDescription&,
64 const AtomicString& family); 62 const AtomicString& family);
65 63
66 void fontFaceInvalidated(); 64 void fontFaceInvalidated();
67 65
68 // FontCacheClient implementation 66 // FontCacheClient implementation
69 void fontCacheInvalidated() override; 67 void fontCacheInvalidated() override;
70 68
71 void registerForInvalidationCallbacks(CSSFontSelectorClient*); 69 void registerForInvalidationCallbacks(CSSFontSelectorClient*);
72 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); 70 void unregisterForInvalidationCallbacks(CSSFontSelectorClient*);
73 71
74 Document* document() const { return m_document; } 72 Document* document() const { return m_document; }
73 FontFaceCache* fontFaceCache() { return &m_fontFaceCache; }
75 74
76 const GenericFontFamilySettings& genericFontFamilySettings() const { 75 const GenericFontFamilySettings& genericFontFamilySettings() const {
77 return m_genericFontFamilySettings; 76 return m_genericFontFamilySettings;
78 } 77 }
79 void updateGenericFontFamilySettings(Document&); 78 void updateGenericFontFamilySettings(Document&);
80 79
81 DECLARE_VIRTUAL_TRACE(); 80 DECLARE_VIRTUAL_TRACE();
82 81
83 protected: 82 protected:
84 explicit CSSFontSelector(Document*); 83 explicit CSSFontSelector(Document*);
85 84
86 void dispatchInvalidationCallbacks(); 85 void dispatchInvalidationCallbacks();
87 86
88 private: 87 private:
89 CSSSegmentedFontFace* getFontFaceFromCache(
90 const FontDescription& fontDescription,
91 const AtomicString& family) {
92 return m_document->fontFaceCache()->get(fontDescription, family);
93 }
94
95 // TODO(Oilpan): Ideally this should just be a traced Member but that will 88 // TODO(Oilpan): Ideally this should just be a traced Member but that will
96 // currently leak because ComputedStyle and its data are not on the heap. 89 // currently leak because ComputedStyle and its data are not on the heap.
97 // See crbug.com/383860 for details. 90 // See crbug.com/383860 for details.
98 WeakMember<Document> m_document; 91 WeakMember<Document> m_document;
92 // FIXME: Move to Document or StyleEngine.
93 FontFaceCache m_fontFaceCache;
99 HeapHashSet<WeakMember<CSSFontSelectorClient>> m_clients; 94 HeapHashSet<WeakMember<CSSFontSelectorClient>> m_clients;
100 GenericFontFamilySettings m_genericFontFamilySettings; 95 GenericFontFamilySettings m_genericFontFamilySettings;
101 }; 96 };
102 97
103 } // namespace blink 98 } // namespace blink
104 99
105 #endif // CSSFontSelector_h 100 #endif // CSSFontSelector_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSFontSelector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698