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 28 matching lines...) Expand all Loading... |
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_genericFontFamilySettings( | 47 m_genericFontFamilySettings( |
48 document->frame()->settings()->genericFontFamilySettings()) { | 48 document->frame()->settings()->genericFontFamilySettings()) { |
49 // FIXME: An old comment used to say there was no need to hold a reference to
m_document | 49 // FIXME: An old comment used to say there was no need to hold a reference to |
50 // because "we are guaranteed to be destroyed before the document". But there
does not | 50 // m_document because "we are guaranteed to be destroyed before the document". |
51 // seem to be any such guarantee. | 51 // But there does not seem to be any such guarantee. |
52 | |
53 ASSERT(m_document); | 52 ASSERT(m_document); |
54 DCHECK(m_document->frame()); | 53 DCHECK(m_document->frame()); |
55 FontCache::fontCache()->addClient(this); | 54 FontCache::fontCache()->addClient(this); |
56 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache, | 55 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache, |
57 this); | 56 this); |
58 } | 57 } |
59 | 58 |
60 CSSFontSelector::~CSSFontSelector() {} | 59 CSSFontSelector::~CSSFontSelector() {} |
61 | 60 |
62 void CSSFontSelector::registerForInvalidationCallbacks( | 61 void CSSFontSelector::registerForInvalidationCallbacks( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return emptyAtom; | 119 return emptyAtom; |
121 } | 120 } |
122 | 121 |
123 PassRefPtr<FontData> CSSFontSelector::getFontData( | 122 PassRefPtr<FontData> CSSFontSelector::getFontData( |
124 const FontDescription& fontDescription, | 123 const FontDescription& fontDescription, |
125 const AtomicString& familyName) { | 124 const AtomicString& familyName) { |
126 if (CSSSegmentedFontFace* face = | 125 if (CSSSegmentedFontFace* face = |
127 m_fontFaceCache.get(fontDescription, familyName)) | 126 m_fontFaceCache.get(fontDescription, familyName)) |
128 return face->getFontData(fontDescription); | 127 return face->getFontData(fontDescription); |
129 | 128 |
130 // Try to return the correct font based off our settings, in case we were hand
ed the generic font family name. | 129 // Try to return the correct font based off our settings, in case we were |
| 130 // handed the generic font family name. |
131 AtomicString settingsFamilyName = familyNameFromSettings( | 131 AtomicString settingsFamilyName = familyNameFromSettings( |
132 m_genericFontFamilySettings, fontDescription, familyName); | 132 m_genericFontFamilySettings, fontDescription, familyName); |
133 if (settingsFamilyName.isEmpty()) | 133 if (settingsFamilyName.isEmpty()) |
134 return nullptr; | 134 return nullptr; |
135 | 135 |
136 return FontCache::fontCache()->getFontData(fontDescription, | 136 return FontCache::fontCache()->getFontData(fontDescription, |
137 settingsFamilyName); | 137 settingsFamilyName); |
138 } | 138 } |
139 | 139 |
140 void CSSFontSelector::willUseFontData(const FontDescription& fontDescription, | 140 void CSSFontSelector::willUseFontData(const FontDescription& fontDescription, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 DEFINE_TRACE(CSSFontSelector) { | 175 DEFINE_TRACE(CSSFontSelector) { |
176 visitor->trace(m_document); | 176 visitor->trace(m_document); |
177 visitor->trace(m_fontFaceCache); | 177 visitor->trace(m_fontFaceCache); |
178 visitor->trace(m_clients); | 178 visitor->trace(m_clients); |
179 FontSelector::trace(visitor); | 179 FontSelector::trace(visitor); |
180 } | 180 } |
181 | 181 |
182 } // namespace blink | 182 } // namespace blink |
OLD | NEW |