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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 return m_nonCSSConnectedFaces.size(); | 341 return m_nonCSSConnectedFaces.size(); |
342 return cssConnectedFontFaceList().size() + m_nonCSSConnectedFaces.size(); | 342 return cssConnectedFontFaceList().size() + m_nonCSSConnectedFaces.size(); |
343 } | 343 } |
344 | 344 |
345 void FontFaceSet::fireDoneEventIfPossible() | 345 void FontFaceSet::fireDoneEventIfPossible() |
346 { | 346 { |
347 if (m_shouldFireLoadingEvent) | 347 if (m_shouldFireLoadingEvent) |
348 return; | 348 return; |
349 if (!shouldSignalReady()) | 349 if (!shouldSignalReady()) |
350 return; | 350 return; |
| 351 Document* d = document(); |
| 352 if (!d) |
| 353 return; |
351 | 354 |
352 // If the layout was invalidated in between when we thought layout | 355 // If the layout was invalidated in between when we thought layout |
353 // was updated and when we're ready to fire the event, just wait | 356 // was updated and when we're ready to fire the event, just wait |
354 // until after the next layout before firing events. | 357 // until after the next layout before firing events. |
355 Document* d = document(); | |
356 if (!d->view() || d->view()->needsLayout()) | 358 if (!d->view() || d->view()->needsLayout()) |
357 return; | 359 return; |
358 | 360 |
359 if (m_isLoading) { | 361 if (m_isLoading) { |
360 FontFaceSetLoadEvent* doneEvent = nullptr; | 362 FontFaceSetLoadEvent* doneEvent = nullptr; |
361 FontFaceSetLoadEvent* errorEvent = nullptr; | 363 FontFaceSetLoadEvent* errorEvent = nullptr; |
362 doneEvent = FontFaceSetLoadEvent::createForFontFaces(EventTypeNames::loa
dingdone, m_loadedFonts); | 364 doneEvent = FontFaceSetLoadEvent::createForFontFaces(EventTypeNames::loa
dingdone, m_loadedFonts); |
363 m_loadedFonts.clear(); | 365 m_loadedFonts.clear(); |
364 if (!m_failedFonts.isEmpty()) { | 366 if (!m_failedFonts.isEmpty()) { |
365 errorEvent = FontFaceSetLoadEvent::createForFontFaces(EventTypeNames
::loadingerror, m_failedFonts); | 367 errorEvent = FontFaceSetLoadEvent::createForFontFaces(EventTypeNames
::loadingerror, m_failedFonts); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 visitor->trace(m_loadedFonts); | 552 visitor->trace(m_loadedFonts); |
551 visitor->trace(m_failedFonts); | 553 visitor->trace(m_failedFonts); |
552 visitor->trace(m_nonCSSConnectedFaces); | 554 visitor->trace(m_nonCSSConnectedFaces); |
553 visitor->trace(m_asyncRunner); | 555 visitor->trace(m_asyncRunner); |
554 EventTargetWithInlineData::trace(visitor); | 556 EventTargetWithInlineData::trace(visitor); |
555 Supplement<Document>::trace(visitor); | 557 Supplement<Document>::trace(visitor); |
556 ActiveDOMObject::trace(visitor); | 558 ActiveDOMObject::trace(visitor); |
557 } | 559 } |
558 | 560 |
559 } // namespace blink | 561 } // namespace blink |
OLD | NEW |