| 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) { | 246 if (m_ready->getState() != ReadyProperty::Pending && |
| 247 inActiveDocumentContext()) { |
| 247 // |m_ready| is already resolved, but there may be pending stylesheet | 248 // |m_ready| is already resolved, but there may be pending stylesheet |
| 248 // changes and/or layout operations that may cause another font loads. | 249 // changes and/or layout operations that may cause another font loads. |
| 249 // So synchronously update style and layout here. | 250 // So synchronously update style and layout here. |
| 250 // This may trigger font loads, and replace |m_ready| with a new Promise. | 251 // This may trigger font loads, and replace |m_ready| with a new Promise. |
| 251 document()->updateStyleAndLayout(); | 252 document()->updateStyleAndLayout(); |
| 252 } | 253 } |
| 253 return m_ready->promise(scriptState->world()); | 254 return m_ready->promise(scriptState->world()); |
| 254 } | 255 } |
| 255 | 256 |
| 256 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, | 257 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 visitor->trace(m_failedFonts); | 569 visitor->trace(m_failedFonts); |
| 569 visitor->trace(m_nonCSSConnectedFaces); | 570 visitor->trace(m_nonCSSConnectedFaces); |
| 570 visitor->trace(m_asyncRunner); | 571 visitor->trace(m_asyncRunner); |
| 571 EventTargetWithInlineData::trace(visitor); | 572 EventTargetWithInlineData::trace(visitor); |
| 572 Supplement<Document>::trace(visitor); | 573 Supplement<Document>::trace(visitor); |
| 573 SuspendableObject::trace(visitor); | 574 SuspendableObject::trace(visitor); |
| 574 FontFace::LoadFontCallback::trace(visitor); | 575 FontFace::LoadFontCallback::trace(visitor); |
| 575 } | 576 } |
| 576 | 577 |
| 577 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |