| OLD | NEW |
| 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 | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 if (m_status == Loaded) | 419 if (m_status == Loaded) |
| 420 m_loadedProperty->resolve(this); | 420 m_loadedProperty->resolve(this); |
| 421 else if (m_status == Error) | 421 else if (m_status == Error) |
| 422 m_loadedProperty->reject(m_error.get()); | 422 m_loadedProperty->reject(m_error.get()); |
| 423 } | 423 } |
| 424 return m_loadedProperty->promise(scriptState->world()); | 424 return m_loadedProperty->promise(scriptState->world()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 ScriptPromise FontFace::load(ScriptState* scriptState) { | 427 ScriptPromise FontFace::load(ScriptState* scriptState) { |
| 428 if (m_status == Unloaded) | 428 if (m_status == Unloaded) |
| 429 m_cssFontFace->load(); | 429 m_cssFontFace->load(toDocument(scriptState->getExecutionContext())); |
| 430 return fontStatusPromise(scriptState); | 430 return fontStatusPromise(scriptState); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void FontFace::loadWithCallback(LoadFontCallback* callback) { | 433 void FontFace::loadWithCallback(Document* document, |
| 434 LoadFontCallback* callback) { |
| 434 if (m_status == Unloaded) | 435 if (m_status == Unloaded) |
| 435 m_cssFontFace->load(); | 436 m_cssFontFace->load(document); |
| 436 addCallback(callback); | 437 addCallback(callback); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void FontFace::addCallback(LoadFontCallback* callback) { | 440 void FontFace::addCallback(LoadFontCallback* callback) { |
| 440 if (m_status == Loaded) | 441 if (m_status == Loaded) |
| 441 callback->notifyLoaded(this); | 442 callback->notifyLoaded(this); |
| 442 else if (m_status == Error) | 443 else if (m_status == Error) |
| 443 callback->notifyError(this); | 444 callback->notifyError(this); |
| 444 else | 445 else |
| 445 m_callbacks.push_back(callback); | 446 m_callbacks.push_back(callback); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 | 672 |
| 672 bool FontFace::hadBlankText() const { | 673 bool FontFace::hadBlankText() const { |
| 673 return m_cssFontFace->hadBlankText(); | 674 return m_cssFontFace->hadBlankText(); |
| 674 } | 675 } |
| 675 | 676 |
| 676 bool FontFace::hasPendingActivity() const { | 677 bool FontFace::hasPendingActivity() const { |
| 677 return m_status == Loading && getExecutionContext(); | 678 return m_status == Loading && getExecutionContext(); |
| 678 } | 679 } |
| 679 | 680 |
| 680 } // namespace blink | 681 } // namespace blink |
| OLD | NEW |