Bug 216336 - [WebIDL] Split supplemental interfaces out of Document
Summary: [WebIDL] Split supplemental interfaces out of Document
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-09 18:42 PDT by Sam Weinig
Modified: 2020-09-11 09:09 PDT (History)
14 users (show)

See Also:


Attachments
Patch (52.37 KB, patch)
2020-09-09 18:45 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (50.01 KB, patch)
2020-09-11 08:27 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2020-09-09 18:42:37 PDT
[WebIDL] Split supplemental interfaces out of Document
Comment 1 Sam Weinig 2020-09-09 18:45:57 PDT
Created attachment 408393 [details]
Patch
Comment 2 Darin Adler 2020-09-09 20:17:38 PDT
Comment on attachment 408393 [details]
Patch

Do these really all need to be separate source files?
Comment 3 Sam Weinig 2020-09-10 06:39:38 PDT
(In reply to Darin Adler from comment #2)
> Comment on attachment 408393 [details]
> Patch
> 
> Do these really all need to be separate source files?

That’s a great point. I’m not sure what the best thing to do here is. Currently we only support supplements that are in their own files, but that is easy to fix and shouldn’t affect the decision. It would be good to have an easy to follow rule for how we divide things up.
Comment 4 Konstantin Tokarev 2020-09-10 07:32:03 PDT
Speaking as one who often refers to idl files to determine if certain API is available, it would be more convenient to have all parts of Document in the same file. OTOH, if respective C++ implementations were located in separate files, it would make sense to have separate IDLs, though AFAICS it's not the case here.
Comment 5 Sam Weinig 2020-09-10 08:08:35 PDT
I think it might help me think about this more clearly if I break down the different types of supplemental interfaces we have:

1) 'partial interface' which uses Supplemental model

An example of this is DocumentPictureInPicture.idl, which uses the class DocumentPictureInPicture (`class DocumentPictureInPicture : public Supplement<Document>...`) from DocumentPictureInPicture.h/cpp. 

2) `partial interface` which is completely implemented in the main class.

An example of this is DocumentAnimations.idl. It adds the timeline attribute to Document, which is completely implemented in Document.h/cpp.

3) `interface mixin`

These, currently, all must be implemented by the interface they are included into. An example of this is FontFaceSource.idl which adds the fonts attribute to Document, which is completely implemented in Document.h/cpp. However, as this is a mixin that can also used by other interfaces, putting it in Document.idl would not make sense.

4) `partial interface mixin`

These also, currently, all must be implemented by the interface they are included into. An example of this is DocumentOrShadowRootStyleSheets.idl, which adds the stylesheets attribute to Document and is completely implemented in Document.h/cpp. However, as this is an addition to a mixin that can also used by other interfaces, putting it in Document.idl would not make sense. It might make sense to put it in DocumentOrShadowRoot.idl though.
Comment 6 Sam Weinig 2020-09-10 08:12:58 PDT
(In reply to Konstantin Tokarev from comment #4)
> Speaking as one who often refers to idl files to determine if certain API is
> available, it would be more convenient to have all parts of Document in the
> same file. OTOH, if respective C++ implementations were located in separate
> files, it would make sense to have separate IDLs, though AFAICS it's not the
> case here.

One idea to make this easier would be to have a consistent naming of partial interface IDL files, perhaps one that is distinct from our normal naming conventions. For instance, perhaps we could take inspiration from some cocoa naming conventions for categories and do something like Document+WebAnimationAdditions.idl instead of DocumentAnimations.idl. Then, when looking for things in Document, one would search for "Document+".
Comment 7 EWS 2020-09-10 10:06:43 PDT
Tools/Scripts/svn-apply failed to apply attachment 408393 [details] to trunk.
Please resolve the conflicts and upload a new patch.
Comment 8 Sam Weinig 2020-09-11 08:27:44 PDT
Created attachment 408533 [details]
Patch
Comment 9 EWS 2020-09-11 09:08:38 PDT
Committed r266926: <https://trac.webkit.org/changeset/266926>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408533 [details].
Comment 10 Radar WebKit Bug Importer 2020-09-11 09:09:16 PDT
<rdar://problem/68713612>