| 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 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 fontFace->addCallback(this); | 236 fontFace->addCallback(this); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void FontFaceSet::removeFromLoadingFonts(FontFace* fontFace) { | 239 void FontFaceSet::removeFromLoadingFonts(FontFace* fontFace) { |
| 240 m_loadingFonts.erase(fontFace); | 240 m_loadingFonts.erase(fontFace); |
| 241 if (m_loadingFonts.isEmpty()) | 241 if (m_loadingFonts.isEmpty()) |
| 242 handlePendingEventsAndPromisesSoon(); | 242 handlePendingEventsAndPromisesSoon(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 ScriptPromise FontFaceSet::ready(ScriptState* scriptState) { | 245 ScriptPromise FontFaceSet::ready(ScriptState* scriptState) { |
| 246 if (m_ready->getState() != ReadyProperty::Pending) { |
| 247 // |m_ready| is already resolved, but there may be pending stylesheet |
| 248 // changes and/or layout operations that may cause another font loads. |
| 249 // So synchronously update style and layout here. |
| 250 // This may trigger font loads, and replace |m_ready| with a new Promise. |
| 251 document()->updateStyleAndLayout(); |
| 252 } |
| 246 return m_ready->promise(scriptState->world()); | 253 return m_ready->promise(scriptState->world()); |
| 247 } | 254 } |
| 248 | 255 |
| 249 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, | 256 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, |
| 250 FontFace* fontFace, | 257 FontFace* fontFace, |
| 251 ExceptionState&) { | 258 ExceptionState&) { |
| 252 ASSERT(fontFace); | 259 ASSERT(fontFace); |
| 253 if (!inActiveDocumentContext()) | 260 if (!inActiveDocumentContext()) |
| 254 return this; | 261 return this; |
| 255 if (m_nonCSSConnectedFaces.contains(fontFace)) | 262 if (m_nonCSSConnectedFaces.contains(fontFace)) |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 visitor->trace(m_failedFonts); | 564 visitor->trace(m_failedFonts); |
| 558 visitor->trace(m_nonCSSConnectedFaces); | 565 visitor->trace(m_nonCSSConnectedFaces); |
| 559 visitor->trace(m_asyncRunner); | 566 visitor->trace(m_asyncRunner); |
| 560 EventTargetWithInlineData::trace(visitor); | 567 EventTargetWithInlineData::trace(visitor); |
| 561 Supplement<Document>::trace(visitor); | 568 Supplement<Document>::trace(visitor); |
| 562 SuspendableObject::trace(visitor); | 569 SuspendableObject::trace(visitor); |
| 563 FontFace::LoadFontCallback::trace(visitor); | 570 FontFace::LoadFontCallback::trace(visitor); |
| 564 } | 571 } |
| 565 | 572 |
| 566 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |