RESOLVED FIXED 157310
Rework FontFace promise attribute handling
https://bugs.webkit.org/show_bug.cgi?id=157310
Summary Rework FontFace promise attribute handling
youenn fablet
Reported 2016-05-03 07:30:58 PDT
Current implementation requires passing an ExecState to create the promise. It may be better to create the promise in custom binding code.
Attachments
WIP (18.78 KB, patch)
2016-05-03 07:49 PDT, youenn fablet
no flags
WIP (18.78 KB, patch)
2016-05-03 08:00 PDT, youenn fablet
no flags
Archive of layout-test-results from ews101 for mac-yosemite (1.01 MB, application/zip)
2016-05-03 08:30 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (976.17 KB, application/zip)
2016-05-03 08:32 PDT, Build Bot
no flags
Archive of layout-test-results from ews115 for mac-yosemite (1.52 MB, application/zip)
2016-05-03 09:03 PDT, Build Bot
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (677.58 KB, application/zip)
2016-05-03 09:09 PDT, Build Bot
no flags
Patch (20.83 KB, patch)
2016-05-04 05:51 PDT, youenn fablet
no flags
Improving style (20.56 KB, patch)
2016-05-04 08:59 PDT, youenn fablet
no flags
Patch for landing (22.34 KB, patch)
2016-05-07 12:34 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-05-03 07:49:55 PDT
youenn fablet
Comment 2 2016-05-03 08:00:13 PDT
Build Bot
Comment 3 2016-05-03 08:30:37 PDT
Comment on attachment 277994 [details] WIP Attachment 277994 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1261204 New failing tests: fast/text/font-face-set-document.html fast/text/font-face-set-javascript.html
Build Bot
Comment 4 2016-05-03 08:30:40 PDT
Created attachment 277996 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 5 2016-05-03 08:32:24 PDT
Comment on attachment 277994 [details] WIP Attachment 277994 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1261205 New failing tests: fast/text/font-face-set-document.html fast/text/font-face-set-javascript.html
Build Bot
Comment 6 2016-05-03 08:32:26 PDT
Created attachment 277997 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 7 2016-05-03 09:02:57 PDT
Comment on attachment 277994 [details] WIP Attachment 277994 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1261299 New failing tests: fast/text/font-face-set-document.html fast/text/font-face-set-javascript.html
Build Bot
Comment 8 2016-05-03 09:03:00 PDT
Created attachment 278003 [details] Archive of layout-test-results from ews115 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 9 2016-05-03 09:09:24 PDT
Comment on attachment 277994 [details] WIP Attachment 277994 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1261307 New failing tests: fast/text/font-face-set-document.html fast/text/font-face-set-javascript.html
Build Bot
Comment 10 2016-05-03 09:09:27 PDT
Created attachment 278004 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.4
youenn fablet
Comment 11 2016-05-04 05:51:08 PDT
youenn fablet
Comment 12 2016-05-04 08:59:31 PDT
Created attachment 278092 [details] Improving style
Myles C. Maxfield
Comment 13 2016-05-04 12:52:38 PDT
Comment on attachment 278092 [details] Improving style View in context: https://bugs.webkit.org/attachment.cgi?id=278092&action=review This is good. Thanks for doing this. > Source/WebCore/bindings/js/JSFontFaceCustom.cpp:-41 > - return promise.deferred().promise(); I believe I added the deferred() function because of this use. We should try to remove that function now that the use use gone. > Source/WebCore/bindings/js/JSFontFaceCustom.cpp:43 > + wrapped().loaded(WTFMove(promise)); Because the semantics of this internal function have changed (rather than being an accessor, it is now a mutator), I don't think we should keep the name. Perhaps something like registerPromise()? > Source/WebCore/css/FontFace.cpp:350 > + ASSERT_NOT_REACHED(); I think we should replace the "default" with "CSSFontFace::Pending" to guarantee the case list is exhaustive. > Source/WebCore/css/FontFace.cpp:364 > + promise.resolve(*this); Perhaps we could add some ASSERTs around that m_promise is always in a non-terminal state (but this may be more trouble than it's worth). > Source/WebCore/css/FontFace.cpp:370 > + default: Same comment as above - we should make the list exhaustive instead of providing a default: > Source/WebCore/css/FontFaceSet.cpp:171 > +void FontFaceSet::ready(Promise&& promise) Same comment as above - I think we should rename this function. > Source/WebCore/css/FontFaceSet.cpp:207 > + m_isReady = true; It appears that m_isReady is only true iff m_promise is Nullopt. Perhaps we can remove the redundancy.
youenn fablet
Comment 14 2016-05-07 12:12:37 PDT
> > Source/WebCore/bindings/js/JSFontFaceCustom.cpp:-41 > > - return promise.deferred().promise(); > > I believe I added the deferred() function because of this use. We should try > to remove that function now that the use use gone. OK, I will check it. > > Source/WebCore/bindings/js/JSFontFaceCustom.cpp:43 > > + wrapped().loaded(WTFMove(promise)); > > Because the semantics of this internal function have changed (rather than > being an accessor, it is now a mutator), I don't think we should keep the > name. Perhaps something like registerPromise()? I am not quite sure about it, this is somehow the standard behavior for cached attribute. Let's rename it to registerLoaded. > > Source/WebCore/css/FontFace.cpp:350 > > + ASSERT_NOT_REACHED(); > > I think we should replace the "default" with "CSSFontFace::Pending" to > guarantee the case list is exhaustive. OK > > Source/WebCore/css/FontFace.cpp:364 > > + promise.resolve(*this); > > Perhaps we could add some ASSERTs around that m_promise is always in a > non-terminal state (but this may be more trouble than it's worth). This is done within promise.resolve call. > > Source/WebCore/css/FontFace.cpp:370 > > + default: > > Same comment as above - we should make the list exhaustive instead of > OK > > Source/WebCore/css/FontFaceSet.cpp:171 > > +void FontFaceSet::ready(Promise&& promise) > > Same comment as above - I think we should rename this function. Let's change it to registerReady. > > Source/WebCore/css/FontFaceSet.cpp:207 > > + m_isReady = true; > > It appears that m_isReady is only true iff m_promise is Nullopt. Perhaps we > can remove the redundancy. We need to know whether the set is already loaded, so as to resolve the promise when registering it loading is completed. We can probably remove m_isReady if FontFaceSet backing has this information.
youenn fablet
Comment 15 2016-05-07 12:34:13 PDT
Created attachment 278334 [details] Patch for landing
WebKit Commit Bot
Comment 16 2016-05-07 13:03:43 PDT
Comment on attachment 278334 [details] Patch for landing Clearing flags on attachment: 278334 Committed r200546: <http://trac.webkit.org/changeset/200546>
WebKit Commit Bot
Comment 17 2016-05-07 13:03:47 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.