Bug 132612

Summary: "Flash of content without image" when pasting a raw image from the pasteboard
Product: WebKit Reporter: Brady Eidson <beidson>
Component: HTML EditingAssignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, sam, thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: All   
Attachments:
Description Flags
Patch v1
thorton: review-, thorton: commit-queue-
Patch v2 - Only in the "paste a single raw image" case none

Description Brady Eidson 2014-05-06 09:54:15 PDT
"Flash of content without image" when pasting a raw image from the pasteboard

The sequence of events goes like this:

-EditorMac has an ArchiveResource for the raw image and puts it in the document loader.
-Editor inserts the new document fragment with the <img> element for the raw image
-CachedResourceLoader is asked for the CachedImage for the new image
-Because a CachedImage doesn't exist yet, a "substitute resource delivery" is scheduled, where the ArchiveResource will be loaded after a zero-delay
-But before it is loaded, a layout and paint happens with the image resource missing, causing a radical change in layout and a "flash of content without image" that is quite noticeable.

I have a simple patch which lets certain flagged ArchiveResources load into a CachedResource synchronously.

It's a little deficient in that the load does not go through ResourceLoader and therefore doesn't get load callbacks.

In this case (pasting a raw image from the pasteboard that has a webkit-fake-url: url) the tradeoff seems fine...  but going forward we really need a better solution for this type of problem.

<rdar://problem/16826199>
Comment 1 Brady Eidson 2014-05-06 10:15:13 PDT
Created attachment 230916 [details]
Patch v1
Comment 2 Tim Horton 2014-05-06 10:56:45 PDT
It would be good if alexey or someone could peek at this too.
Comment 3 Tim Horton 2014-05-06 10:57:43 PDT
r- because this affects more than just the single image case as discussed on IRC
Comment 4 Brady Eidson 2014-05-06 12:02:59 PDT
Created attachment 230922 [details]
Patch v2 - Only in the "paste a single raw image" case
Comment 5 WebKit Commit Bot 2014-05-06 13:10:30 PDT
Comment on attachment 230922 [details]
Patch v2 - Only in the "paste a single raw image" case

Clearing flags on attachment: 230922

Committed r168376: <http://trac.webkit.org/changeset/168376>
Comment 6 WebKit Commit Bot 2014-05-06 13:10:33 PDT
All reviewed patches have been landed.  Closing bug.