document.fonts.ready should result in a promise that resolves when the document finishes loading fonts.
Created attachment 242179 [details]
Created attachment 242206 [details]
Comment on attachment 242206 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=242206&action=review
> + OwnPtr<DeferredWrapper> m_ready;
We have so far been able to keep DeferredWrapper in the bindings layer only, and I would prefer to keep it that way. Instead, what I recommend is having two std::functions (one for success, one for failure) that capture the DeferredWrapper. See JSSubtleCrypto::generateKey() for an example of how we do this.
Created attachment 243130 [details]
Comment on attachment 243130 [details]
Looks good. I would like to see a test that calls document.fonts.ready multiple times. I am not clear whether ready should return the same promise each time it is called, but it should be tested either way (and we should verify with the spec author what the intent is).
I can add a test containing multiple ready reads. I'm not clear on when/if the ready attribute must return the same value on read, and have a question out to the style list.
Storing the promise without sharing DeferredWrapper with FontLoader seemed a bit tricky to me, as I couldn't find an example of code that added a member variable to the JS layer like JSFontLoaderCustom.h would need to. Would that be the right way, and is it possible?
Created attachment 243326 [details]
document.fonts.ready should return the same promise until it has been fulfilled and a font begins loading, at which point document.fonts.ready should return a new, unfulfilled promise. See http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-events
Created attachment 243366 [details]
Fixing ready test
Sam, it looks like he added the test you asked for. Was there anything else you wanted to see here?
Bear: Could you please upload a rebaselined patch we can apply to the tree?
(In reply to comment #9)
> Sam, it looks like he added the test you asked for. Was there anything else
> you wanted to see here?
> Bear: Could you please upload a rebaselined patch we can apply to the tree?
This is done already. (since r196747)
Also, IIRC Bear doesn't work on WebKit anymore.