• hiroshige's avatar
    Phase III Step 2: Call imageNotifyFinished() and image load event after SVG loading completes · 396a1266
    hiroshige authored
    design doc:
    https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVLr8bE/edit#
    https://docs.google.com/document/d/1obEb8K4mJpG9Y_x4_ZhvnbFHojZoLLzMCFsalkl8voc/edit#
    
    This CL calls ImageResourceObserver::ImageNotifyFinished()
    after SVG image loading is completed, not necessarily the same time as
    ResourceLoader completion (e.g. DidFinishLoading()).
    This makes SVG's <img> load event to be fired after SVG image loading
    is completed even when the SVG has subresources loaded asynchronously.
    
    1. Image::SetData() can return SizeAvailableAndLoadingAsynchronously
       when SVG image loading is not completed synchronously (due to
       subresources), and notifies the completion asynchronously via
       ImageObserver:LoadCompleted().
       LocalFrameClient::DispatchDidHandleOnloadEvents() is used as a
       notification of SVG image loading completion in SVGImage.
    
    2. ImageResourceContent delays calling ImageNotifyFinished() and
       setting |content_status_| to kCached until SVG image loading is
       completed.
    
    3. ImageLoader additionally delays the Document load event
       - from the first ImageChanged() during image loading
       - until (potentially delayed) ImageNotifyFinished().
    
    In image loading not by ImageLoader, the Document load event is not
    delayed from ResourceLoader completion until ImageNotifyFinished(),
    but this is not a regression.
    
    In image loading by ImageLoader, the Document load event is delayed
    until ImageNotifyFinished() by the combination of
    ResourceFetcher::loaders_ and ImageLoader.
    ImageLoader starts delaying the Document load event
    - Not from |image_| is set, because we shouldn't delay the Document
      load event when image loading is deferred.
    - Not from ImageResourceContent::NotifyStartLoad(), to avoid additional
      ImageResourceObserver callbacks.
    
    BUG=382170, 690480, 667641
    
    Review-Url: https://codereview.chromium.org/2613853002
    Cr-Commit-Position: refs/heads/master@{#472229}
    396a1266
data-font-in-css-invalid-font-crash.html 849 Bytes