Index: Source/core/css/FontLoader.cpp |
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp |
index c4d62ecbf9d4a1cbda4544461a060e76087d6e62..920440515fc5e48e31019a3c0d1ac2f17fe9f120 100644 |
--- a/Source/core/css/FontLoader.cpp |
+++ b/Source/core/css/FontLoader.cpp |
@@ -45,29 +45,32 @@ static const char* const defaultFontFamily = "sans-serif"; |
class LoadFontCallback : public CSSSegmentedFontFace::LoadFontCallback { |
public: |
- static PassRefPtr<LoadFontCallback> create(int numLoading, PassRefPtr<VoidCallback> loadCallback, PassRefPtr<VoidCallback> errorCallback) |
+ static Result<LoadFontCallback> create(int numLoading, PassRefPtr<VoidCallback> loadCallback, PassRefPtr<VoidCallback> errorCallback) |
{ |
- return adoptRef<LoadFontCallback>(new LoadFontCallback(numLoading, loadCallback, errorCallback)); |
+ return adopt(new LoadFontCallback(numLoading, loadCallback, errorCallback)); |
} |
- static PassRefPtr<LoadFontCallback> createFromParams(const Dictionary& params, const FontFamily& family) |
+ static Result<LoadFontCallback> createFromParams(const Dictionary& params, const FontFamily& family) |
{ |
RefPtr<VoidCallback> onsuccess; |
RefPtr<VoidCallback> onerror; |
params.get("onsuccess", onsuccess); |
params.get("onerror", onerror); |
if (!onsuccess && !onerror) |
- return 0; |
+ return nullptr; |
int numFamilies = 0; |
for (const FontFamily* f = &family; f; f = f->next()) |
numFamilies++; |
return LoadFontCallback::create(numFamilies, onsuccess, onerror); |
} |
- virtual void notifyLoaded(CSSSegmentedFontFace*) OVERRIDE; |
- virtual void notifyError(CSSSegmentedFontFace*) OVERRIDE; |
+ virtual void notifyLoaded(Handle<CSSSegmentedFontFace>) OVERRIDE; |
+ virtual void notifyError(Handle<CSSSegmentedFontFace>) OVERRIDE; |
void loaded(Document*); |
void error(Document*); |
+ |
+ virtual void accept(Visitor*) const { } |
+ |
private: |
LoadFontCallback(int numLoading, PassRefPtr<VoidCallback> loadCallback, PassRefPtr<VoidCallback> errorCallback) |
: m_numLoading(numLoading) |
@@ -103,12 +106,12 @@ void LoadFontCallback::error(Document* document) |
loaded(document); |
} |
-void LoadFontCallback::notifyLoaded(CSSSegmentedFontFace* face) |
+void LoadFontCallback::notifyLoaded(Handle<CSSSegmentedFontFace> face) |
{ |
loaded(face->fontSelector()->document()); |
} |
-void LoadFontCallback::notifyError(CSSSegmentedFontFace* face) |
+void LoadFontCallback::notifyError(Handle<CSSSegmentedFontFace> face) |
{ |
error(face->fontSelector()->document()); |
} |
@@ -272,10 +275,11 @@ void FontLoader::loadFont(const Dictionary& params) |
Font font; |
if (!resolveFontStyle(fontString, font)) |
return; |
- RefPtr<LoadFontCallback> callback = LoadFontCallback::createFromParams(params, font.family()); |
+ Handle<LoadFontCallback> callback = LoadFontCallback::createFromParams(params, font.family()); |
+ Handle<CSSSegmentedFontFace> face; |
for (const FontFamily* f = &font.family(); f; f = f->next()) { |
- CSSSegmentedFontFace* face = m_document->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family()); |
+ face = m_document->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family()); |
if (!face) { |
if (callback) |
callback->error(m_document); |
@@ -291,8 +295,9 @@ bool FontLoader::checkFont(const String& fontString, const String&) |
Font font; |
if (!resolveFontStyle(fontString, font)) |
return false; |
+ Handle<CSSSegmentedFontFace> face; |
for (const FontFamily* f = &font.family(); f; f = f->next()) { |
- CSSSegmentedFontFace* face = m_document->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family()); |
+ face = m_document->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family()); |
if (!face || !face->checkFont()) |
return false; |
} |