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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void FontFace::setError(DOMException* error) | 354 void FontFace::setError(DOMException* error) |
355 { | 355 { |
356 if (!m_error) | 356 if (!m_error) |
357 m_error = error ? error : DOMException::create(NetworkError); | 357 m_error = error ? error : DOMException::create(NetworkError); |
358 setLoadStatus(Error); | 358 setLoadStatus(Error); |
359 } | 359 } |
360 | 360 |
361 ScriptPromise FontFace::fontStatusPromise(ScriptState* scriptState) | 361 ScriptPromise FontFace::fontStatusPromise(ScriptState* scriptState) |
362 { | 362 { |
363 if (!m_loadedProperty) { | 363 if (!m_loadedProperty) { |
364 m_loadedProperty = new LoadedProperty(scriptState->executionContext(), t
his, LoadedProperty::Loaded); | 364 m_loadedProperty = new LoadedProperty(scriptState->getExecutionContext()
, this, LoadedProperty::Loaded); |
365 if (m_status == Loaded) | 365 if (m_status == Loaded) |
366 m_loadedProperty->resolve(this); | 366 m_loadedProperty->resolve(this); |
367 else if (m_status == Error) | 367 else if (m_status == Error) |
368 m_loadedProperty->reject(m_error.get()); | 368 m_loadedProperty->reject(m_error.get()); |
369 } | 369 } |
370 return m_loadedProperty->promise(scriptState->world()); | 370 return m_loadedProperty->promise(scriptState->world()); |
371 } | 371 } |
372 | 372 |
373 ScriptPromise FontFace::load(ScriptState* scriptState) | 373 ScriptPromise FontFace::load(ScriptState* scriptState) |
374 { | 374 { |
375 loadInternal(scriptState->executionContext()); | 375 loadInternal(scriptState->getExecutionContext()); |
376 return fontStatusPromise(scriptState); | 376 return fontStatusPromise(scriptState); |
377 } | 377 } |
378 | 378 |
379 void FontFace::loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback> callbac
k, ExecutionContext* context) | 379 void FontFace::loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback> callbac
k, ExecutionContext* context) |
380 { | 380 { |
381 loadInternal(context); | 381 loadInternal(context); |
382 if (m_status == Loaded) | 382 if (m_status == Loaded) |
383 callback->notifyLoaded(this); | 383 callback->notifyLoaded(this); |
384 else if (m_status == Error) | 384 else if (m_status == Error) |
385 callback->notifyError(this); | 385 callback->notifyError(this); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 ActiveDOMObject::trace(visitor); | 639 ActiveDOMObject::trace(visitor); |
640 } | 640 } |
641 | 641 |
642 bool FontFace::hadBlankText() const | 642 bool FontFace::hadBlankText() const |
643 { | 643 { |
644 return m_cssFontFace->hadBlankText(); | 644 return m_cssFontFace->hadBlankText(); |
645 } | 645 } |
646 | 646 |
647 bool FontFace::hasPendingActivity() const | 647 bool FontFace::hasPendingActivity() const |
648 { | 648 { |
649 return m_status == Loading && executionContext() && !executionContext()->act
iveDOMObjectsAreStopped(); | 649 return m_status == Loading && getExecutionContext() && !getExecutionContext(
)->activeDOMObjectsAreStopped(); |
650 } | 650 } |
651 | 651 |
652 } // namespace blink | 652 } // namespace blink |
OLD | NEW |