OLD | NEW |
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 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "core/loader/FrameLoader.h" | 37 #include "core/loader/FrameLoader.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 38 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/fonts/FontCache.h" | 39 #include "platform/fonts/FontCache.h" |
40 #include "platform/fonts/SimpleFontData.h" | 40 #include "platform/fonts/SimpleFontData.h" |
41 #include "wtf/text/AtomicString.h" | 41 #include "wtf/text/AtomicString.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 CSSFontSelector::CSSFontSelector(Document* document) | 45 CSSFontSelector::CSSFontSelector(Document* document) |
46 : m_document(document) | 46 : m_document(document) |
47 , m_fontLoader(FontLoader::create(this, document)) | |
48 , m_genericFontFamilySettings(document->frame()->settings()->genericFontFami
lySettings()) | 47 , m_genericFontFamilySettings(document->frame()->settings()->genericFontFami
lySettings()) |
49 { | 48 { |
50 // FIXME: An old comment used to say there was no need to hold a reference t
o m_document | 49 // FIXME: An old comment used to say there was no need to hold a reference t
o m_document |
51 // because "we are guaranteed to be destroyed before the document". But ther
e does not | 50 // because "we are guaranteed to be destroyed before the document". But ther
e does not |
52 // seem to be any such guarantee. | 51 // seem to be any such guarantee. |
53 | 52 |
54 ASSERT(m_document); | 53 ASSERT(m_document); |
55 ASSERT(m_document->frame()); | 54 ASSERT(m_document->frame()); |
56 FontCache::fontCache()->addClient(this); | 55 FontCache::fontCache()->addClient(this); |
57 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache,
this); | 56 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache,
this); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 { | 157 { |
159 AtomicString family = familyNameFromSettings(m_genericFontFamilySettings, fo
ntDescription, passedFamily); | 158 AtomicString family = familyNameFromSettings(m_genericFontFamilySettings, fo
ntDescription, passedFamily); |
160 if (family.isEmpty()) | 159 if (family.isEmpty()) |
161 family = passedFamily; | 160 family = passedFamily; |
162 return FontCache::fontCache()->isPlatformFontAvailable(fontDescription, fami
ly); | 161 return FontCache::fontCache()->isPlatformFontAvailable(fontDescription, fami
ly); |
163 } | 162 } |
164 | 163 |
165 #if !ENABLE(OILPAN) | 164 #if !ENABLE(OILPAN) |
166 void CSSFontSelector::clearDocument() | 165 void CSSFontSelector::clearDocument() |
167 { | 166 { |
168 m_fontLoader->clearDocumentAndFontSelector(); | |
169 m_document = nullptr; | 167 m_document = nullptr; |
170 m_fontFaceCache.clearAll(); | 168 m_fontFaceCache.clearAll(); |
171 } | 169 } |
172 #endif | 170 #endif |
173 | 171 |
174 void CSSFontSelector::updateGenericFontFamilySettings(Document& document) | 172 void CSSFontSelector::updateGenericFontFamilySettings(Document& document) |
175 { | 173 { |
176 if (!document.settings()) | 174 if (!document.settings()) |
177 return; | 175 return; |
178 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings
(); | 176 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings
(); |
179 fontCacheInvalidated(); | 177 fontCacheInvalidated(); |
180 } | 178 } |
181 | 179 |
182 DEFINE_TRACE(CSSFontSelector) | 180 DEFINE_TRACE(CSSFontSelector) |
183 { | 181 { |
184 visitor->trace(m_document); | 182 visitor->trace(m_document); |
185 visitor->trace(m_fontFaceCache); | 183 visitor->trace(m_fontFaceCache); |
186 visitor->trace(m_clients); | 184 visitor->trace(m_clients); |
187 visitor->trace(m_fontLoader); | |
188 FontSelector::trace(visitor); | 185 FontSelector::trace(visitor); |
189 } | 186 } |
190 | 187 |
191 } // namespace blink | 188 } // namespace blink |
OLD | NEW |