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

Side by Side Diff: Source/core/css/CSSFontSelector.cpp

Issue 321403003: Notify font loads via FontLoader (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/css/CSSFontFace.cpp ('k') | Source/core/css/CSSSegmentedFontFace.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 * (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 29 matching lines...) Expand all
40 #include "platform/fonts/FontCache.h" 40 #include "platform/fonts/FontCache.h"
41 #include "platform/fonts/SimpleFontData.h" 41 #include "platform/fonts/SimpleFontData.h"
42 #include "wtf/text/AtomicString.h" 42 #include "wtf/text/AtomicString.h"
43 43
44 using namespace std; 44 using namespace std;
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 CSSFontSelector::CSSFontSelector(Document* document) 48 CSSFontSelector::CSSFontSelector(Document* document)
49 : m_document(document) 49 : m_document(document)
50 , m_fontLoader(FontLoader::create(document->fetcher())) 50 , m_fontLoader(FontLoader::create(this, document->fetcher()))
51 , m_genericFontFamilySettings(document->frame()->settings()->genericFontFami lySettings()) 51 , m_genericFontFamilySettings(document->frame()->settings()->genericFontFami lySettings())
52 { 52 {
53 // FIXME: An old comment used to say there was no need to hold a reference t o m_document 53 // FIXME: An old comment used to say there was no need to hold a reference t o m_document
54 // because "we are guaranteed to be destroyed before the document". But ther e does not 54 // because "we are guaranteed to be destroyed before the document". But ther e does not
55 // seem to be any such guarantee. 55 // seem to be any such guarantee.
56 56
57 ASSERT(m_document); 57 ASSERT(m_document);
58 ASSERT(m_document->frame()); 58 ASSERT(m_document->frame());
59 FontCache::fontCache()->addClient(this); 59 FontCache::fontCache()->addClient(this);
60 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache, this); 60 FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache, this);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 { 153 {
154 AtomicString family = familyNameFromSettings(m_genericFontFamilySettings, fo ntDescription, passedFamily); 154 AtomicString family = familyNameFromSettings(m_genericFontFamilySettings, fo ntDescription, passedFamily);
155 if (family.isEmpty()) 155 if (family.isEmpty())
156 family = passedFamily; 156 family = passedFamily;
157 return FontCache::fontCache()->isPlatformFontAvailable(fontDescription, fami ly); 157 return FontCache::fontCache()->isPlatformFontAvailable(fontDescription, fami ly);
158 } 158 }
159 159
160 #if !ENABLE(OILPAN) 160 #if !ENABLE(OILPAN)
161 void CSSFontSelector::clearDocument() 161 void CSSFontSelector::clearDocument()
162 { 162 {
163 m_fontLoader->clearResourceFetcher(); 163 m_fontLoader->clearResourceFetcherAndFontSelector();
164 m_document = nullptr; 164 m_document = nullptr;
165 } 165 }
166 #endif 166 #endif
167 167
168 void CSSFontSelector::updateGenericFontFamilySettings(Document& document) 168 void CSSFontSelector::updateGenericFontFamilySettings(Document& document)
169 { 169 {
170 if (!document.settings()) 170 if (!document.settings())
171 return; 171 return;
172 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings (); 172 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings ();
173 // Need to increment FontFaceCache version to update RenderStyles. 173 // Need to increment FontFaceCache version to update RenderStyles.
174 m_fontFaceCache.incrementVersion(); 174 m_fontFaceCache.incrementVersion();
175 } 175 }
176 176
177 void CSSFontSelector::trace(Visitor* visitor) 177 void CSSFontSelector::trace(Visitor* visitor)
178 { 178 {
179 visitor->trace(m_document); 179 visitor->trace(m_document);
180 visitor->trace(m_fontFaceCache); 180 visitor->trace(m_fontFaceCache);
181 visitor->trace(m_clients); 181 visitor->trace(m_clients);
182 visitor->trace(m_fontLoader); 182 visitor->trace(m_fontLoader);
183 FontSelector::trace(visitor); 183 FontSelector::trace(visitor);
184 } 184 }
185 185
186 } 186 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontFace.cpp ('k') | Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698