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

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

Issue 18375005: [oilpan] Move CSSFontFace and CSSSegmentedFontFace to the managed heap (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 params.get("onsuccess", onsuccess); 57 params.get("onsuccess", onsuccess);
58 params.get("onerror", onerror); 58 params.get("onerror", onerror);
59 if (!onsuccess && !onerror) 59 if (!onsuccess && !onerror)
60 return 0; 60 return 0;
61 int numFamilies = 0; 61 int numFamilies = 0;
62 for (const FontFamily* f = &family; f; f = f->next()) 62 for (const FontFamily* f = &family; f; f = f->next())
63 numFamilies++; 63 numFamilies++;
64 return LoadFontCallback::create(numFamilies, onsuccess, onerror); 64 return LoadFontCallback::create(numFamilies, onsuccess, onerror);
65 } 65 }
66 66
67 virtual void notifyLoaded(CSSSegmentedFontFace*) OVERRIDE; 67 virtual void notifyLoaded(Handle<CSSSegmentedFontFace>) OVERRIDE;
68 virtual void notifyError(CSSSegmentedFontFace*) OVERRIDE; 68 virtual void notifyError(Handle<CSSSegmentedFontFace>) OVERRIDE;
69 void loaded(Document*); 69 void loaded(Document*);
70 void error(Document*); 70 void error(Document*);
71 private: 71 private:
72 LoadFontCallback(int numLoading, PassRefPtr<VoidCallback> loadCallback, Pass RefPtr<VoidCallback> errorCallback) 72 LoadFontCallback(int numLoading, PassRefPtr<VoidCallback> loadCallback, Pass RefPtr<VoidCallback> errorCallback)
73 : m_numLoading(numLoading) 73 : m_numLoading(numLoading)
74 , m_errorOccured(false) 74 , m_errorOccured(false)
75 , m_loadCallback(loadCallback) 75 , m_loadCallback(loadCallback)
76 , m_errorCallback(errorCallback) 76 , m_errorCallback(errorCallback)
77 { } 77 { }
78 78
(...skipping 17 matching lines...) Expand all
96 document->fontloader()->scheduleCallback(m_loadCallback.release()); 96 document->fontloader()->scheduleCallback(m_loadCallback.release());
97 } 97 }
98 } 98 }
99 99
100 void LoadFontCallback::error(Document* document) 100 void LoadFontCallback::error(Document* document)
101 { 101 {
102 m_errorOccured = true; 102 m_errorOccured = true;
103 loaded(document); 103 loaded(document);
104 } 104 }
105 105
106 void LoadFontCallback::notifyLoaded(CSSSegmentedFontFace* face) 106 void LoadFontCallback::notifyLoaded(Handle<CSSSegmentedFontFace> face)
107 { 107 {
108 loaded(face->fontSelector()->document()); 108 loaded(face->fontSelector()->document());
109 } 109 }
110 110
111 void LoadFontCallback::notifyError(CSSSegmentedFontFace* face) 111 void LoadFontCallback::notifyError(Handle<CSSSegmentedFontFace> face)
112 { 112 {
113 error(face->fontSelector()->document()); 113 error(face->fontSelector()->document());
114 } 114 }
115 115
116 FontLoader::FontLoader(Document* document) 116 FontLoader::FontLoader(Document* document)
117 : ActiveDOMObject(document) 117 : ActiveDOMObject(document)
118 , m_document(document) 118 , m_document(document)
119 , m_loadingCount(0) 119 , m_loadingCount(0)
120 , m_timer(this, &FontLoader::timerFired) 120 , m_timer(this, &FontLoader::timerFired)
121 { 121 {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // FIXME: The text member of params is ignored. 268 // FIXME: The text member of params is ignored.
269 String fontString; 269 String fontString;
270 if (!params.get("font", fontString)) 270 if (!params.get("font", fontString))
271 return; 271 return;
272 Font font; 272 Font font;
273 if (!resolveFontStyle(fontString, font)) 273 if (!resolveFontStyle(fontString, font))
274 return; 274 return;
275 RefPtr<LoadFontCallback> callback = LoadFontCallback::createFromParams(param s, font.family()); 275 RefPtr<LoadFontCallback> callback = LoadFontCallback::createFromParams(param s, font.family());
276 276
277 for (const FontFamily* f = &font.family(); f; f = f->next()) { 277 for (const FontFamily* f = &font.family(); f; f = f->next()) {
278 CSSSegmentedFontFace* face = m_document->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 278 Handle<CSSSegmentedFontFace> face = m_document->styleResolver()->fontSel ector()->getFontFace(font.fontDescription(), f->family());
279 if (!face) { 279 if (!face) {
280 if (callback) 280 if (callback)
281 callback->error(m_document); 281 callback->error(m_document);
282 continue; 282 continue;
283 } 283 }
284 face->loadFont(font.fontDescription(), callback); 284 face->loadFont(font.fontDescription(), callback);
285 } 285 }
286 } 286 }
287 287
288 bool FontLoader::checkFont(const String& fontString, const String&) 288 bool FontLoader::checkFont(const String& fontString, const String&)
289 { 289 {
290 // FIXME: The second parameter (text) is ignored. 290 // FIXME: The second parameter (text) is ignored.
291 Font font; 291 Font font;
292 if (!resolveFontStyle(fontString, font)) 292 if (!resolveFontStyle(fontString, font))
293 return false; 293 return false;
294 for (const FontFamily* f = &font.family(); f; f = f->next()) { 294 for (const FontFamily* f = &font.family(); f; f = f->next()) {
295 CSSSegmentedFontFace* face = m_document->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 295 Handle<CSSSegmentedFontFace> face = m_document->styleResolver()->fontSel ector()->getFontFace(font.fontDescription(), f->family());
296 if (!face || !face->checkFont()) 296 if (!face || !face->checkFont())
297 return false; 297 return false;
298 } 298 }
299 return true; 299 return true;
300 } 300 }
301 301
302 static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropert yID id, const Handle<StylePropertySet>& parsedStyle) 302 static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropert yID id, const Handle<StylePropertySet>& parsedStyle)
303 { 303 {
304 styleResolver->applyPropertyToCurrentStyle(id, Handle<CSSValue>(parsedStyle- >getPropertyCSSValue(id)).raw()); 304 styleResolver->applyPropertyToCurrentStyle(id, Handle<CSSValue>(parsedStyle- >getPropertyCSSValue(id)).raw());
305 } 305 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle) ; 344 applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle) ;
345 styleResolver->updateFont(); 345 styleResolver->updateFont();
346 applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyl e); 346 applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyl e);
347 347
348 font = style->font(); 348 font = style->font();
349 font.update(styleResolver->fontSelector()); 349 font.update(styleResolver->fontSelector());
350 return true; 350 return true;
351 } 351 }
352 352
353 } // namespace WebCore 353 } // namespace WebCore
OLDNEW
« Source/core/css/CSSFontSelector.cpp ('K') | « Source/core/css/CSSSegmentedFontFace.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698