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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 FontFace* FontFace::create(ExecutionContext* context, | 90 FontFace* FontFace::create(ExecutionContext* context, |
91 const AtomicString& family, | 91 const AtomicString& family, |
92 const String& source, | 92 const String& source, |
93 const FontFaceDescriptors& descriptors) { | 93 const FontFaceDescriptors& descriptors) { |
94 FontFace* fontFace = new FontFace(context, family, descriptors); | 94 FontFace* fontFace = new FontFace(context, family, descriptors); |
95 | 95 |
96 const CSSValue* src = | 96 const CSSValue* src = |
97 parseCSSValue(toDocument(context), source, CSSPropertySrc); | 97 parseCSSValue(toDocument(context), source, CSSPropertySrc); |
98 if (!src || !src->isValueList()) | 98 if (!src || !src->isValueList()) |
99 fontFace->setError(DOMException::create( | 99 fontFace->setError( |
100 SyntaxError, "The source provided ('" + source + | 100 DOMException::create(SyntaxError, |
101 "') could not be parsed as a value list.")); | 101 "The source provided ('" + source + |
| 102 "') could not be parsed as a value list.")); |
102 | 103 |
103 fontFace->initCSSFontFace(toDocument(context), src); | 104 fontFace->initCSSFontFace(toDocument(context), src); |
104 return fontFace; | 105 return fontFace; |
105 } | 106 } |
106 | 107 |
107 FontFace* FontFace::create(ExecutionContext* context, | 108 FontFace* FontFace::create(ExecutionContext* context, |
108 const AtomicString& family, | 109 const AtomicString& family, |
109 DOMArrayBuffer* source, | 110 DOMArrayBuffer* source, |
110 const FontFaceDescriptors& descriptors) { | 111 const FontFaceDescriptors& descriptors) { |
111 FontFace* fontFace = new FontFace(context, family, descriptors); | 112 FontFace* fontFace = new FontFace(context, family, descriptors); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 371 |
371 // When promises are resolved with 'thenables', instead of the object being | 372 // When promises are resolved with 'thenables', instead of the object being |
372 // returned directly, the 'then' method is executed (the resolver tries to | 373 // returned directly, the 'then' method is executed (the resolver tries to |
373 // resolve the thenable). This can lead to synchronous script execution, so we | 374 // resolve the thenable). This can lead to synchronous script execution, so we |
374 // post a task. This does not apply to promise rejection (i.e. a thenable | 375 // post a task. This does not apply to promise rejection (i.e. a thenable |
375 // would be returned as is). | 376 // would be returned as is). |
376 if (m_status == Loaded || m_status == Error) { | 377 if (m_status == Loaded || m_status == Error) { |
377 if (m_loadedProperty) { | 378 if (m_loadedProperty) { |
378 if (m_status == Loaded) { | 379 if (m_status == Loaded) { |
379 getTaskRunner()->postTask( | 380 getTaskRunner()->postTask( |
380 BLINK_FROM_HERE, WTF::bind(&LoadedProperty::resolve<FontFace*>, | 381 BLINK_FROM_HERE, |
381 wrapPersistent(m_loadedProperty.get()), | 382 WTF::bind(&LoadedProperty::resolve<FontFace*>, |
382 wrapPersistent(this))); | 383 wrapPersistent(m_loadedProperty.get()), |
| 384 wrapPersistent(this))); |
383 } else | 385 } else |
384 m_loadedProperty->reject(m_error.get()); | 386 m_loadedProperty->reject(m_error.get()); |
385 } | 387 } |
386 | 388 |
387 getTaskRunner()->postTask( | 389 getTaskRunner()->postTask( |
388 BLINK_FROM_HERE, | 390 BLINK_FROM_HERE, |
389 WTF::bind(&FontFace::runCallbacks, wrapPersistent(this))); | 391 WTF::bind(&FontFace::runCallbacks, wrapPersistent(this))); |
390 } | 392 } |
391 } | 393 } |
392 | 394 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 673 |
672 bool FontFace::hadBlankText() const { | 674 bool FontFace::hadBlankText() const { |
673 return m_cssFontFace->hadBlankText(); | 675 return m_cssFontFace->hadBlankText(); |
674 } | 676 } |
675 | 677 |
676 bool FontFace::hasPendingActivity() const { | 678 bool FontFace::hasPendingActivity() const { |
677 return m_status == Loading && getExecutionContext(); | 679 return m_status == Loading && getExecutionContext(); |
678 } | 680 } |
679 | 681 |
680 } // namespace blink | 682 } // namespace blink |
OLD | NEW |