Bug 193109 - Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
Summary: Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on: 193328
Blocks: 193111
  Show dependency treegraph
 
Reported: 2019-01-03 09:06 PST by Wenson Hsieh
Modified: 2019-01-11 10:30 PST (History)
8 users (show)

See Also:


Attachments
WIP (47.58 KB, patch)
2019-01-03 15:47 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Patch (44.78 KB, patch)
2019-01-10 16:17 PST, Wenson Hsieh
rniwa: review+
Details | Formatted Diff | Diff
Patch for EWS (47.19 KB, patch)
2019-01-10 21:43 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2019-01-03 09:06:45 PST
Work towards <rdar://problem/44807048>
Comment 1 Wenson Hsieh 2019-01-03 15:47:40 PST
Created attachment 358282 [details]
WIP
Comment 2 Wenson Hsieh 2019-01-10 16:17:43 PST
Created attachment 358847 [details]
Patch
Comment 3 Ryosuke Niwa 2019-01-10 19:40:45 PST
Comment on attachment 358847 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=358847&action=review

> Source/WebCore/page/UndoItem.idl:35
> +    Constructor(DOMString label, UndoItemInit initDict)

We might wanna consider making label simply an attribute of UndoItemInit.

> Source/WebCore/page/UndoManager.h:37
> +class UndoManager : public RefCounted<UndoManager> {
> +public:

Maybe make it fast allocated & iso-heaped?

> Source/WebCore/page/UndoManager.h:43
> +    virtual ~UndoManager() = default;

I don't think we need this.
Just add ImplementationLacksVTable to IDL.

> Source/WebCore/page/UndoManager.idl:27
> +    EnabledAtRuntime=UndoManagerAPI

Add GenerateIsReachable=ImplDocument. Add a test if possible too.

> LayoutTests/ChangeLog:13
> +        * editing/undo/UndoManager/undo-manager-interfaces-expected.txt: Added.
> +        * editing/undo/UndoManager/undo-manager-interfaces.html: Added.

Why don't we just add it to editing/undo-manager/
Comment 4 Ryosuke Niwa 2019-01-10 19:52:08 PST
Comment on attachment 358847 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=358847&action=review

> Source/WebCore/page/UndoItem.idl:34
> +    EnabledAtRuntime=UndoManagerAPI,

In the future, you'd need to add JSCustomMarkFunction here,
then in JSUndoManagerCustom.cpp you need to invoke wrapped().callback().visitJSFunction in JSMutationObserver::visitAdditionalChildren.
Then you have to make these objects reachable from the document/frame...
Comment 5 Wenson Hsieh 2019-01-10 21:11:14 PST
Comment on attachment 358847 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=358847&action=review

Thanks for the review!

>> Source/WebCore/page/UndoItem.idl:34
>> +    EnabledAtRuntime=UndoManagerAPI,
> 
> In the future, you'd need to add JSCustomMarkFunction here,
> then in JSUndoManagerCustom.cpp you need to invoke wrapped().callback().visitJSFunction in JSMutationObserver::visitAdditionalChildren.
> Then you have to make these objects reachable from the document/frame...

Sounds good — I'll augment the next patch (for addItem support) with this change.

>> Source/WebCore/page/UndoItem.idl:35
>> +    Constructor(DOMString label, UndoItemInit initDict)
> 
> We might wanna consider making label simply an attribute of UndoItemInit.

Ok! I moved the label attribute into UndoItemInit.

>> Source/WebCore/page/UndoManager.h:37
>> +public:
> 
> Maybe make it fast allocated & iso-heaped?

👍

(Also did this to UndoItem)

>> Source/WebCore/page/UndoManager.h:43
>> +    virtual ~UndoManager() = default;
> 
> I don't think we need this.
> Just add ImplementationLacksVTable to IDL.

👍

(I also fixed this for UndoItem)

>> LayoutTests/ChangeLog:13
>> +        * editing/undo/UndoManager/undo-manager-interfaces.html: Added.
> 
> Why don't we just add it to editing/undo-manager/

👍
Comment 6 Wenson Hsieh 2019-01-10 21:34:33 PST
Comment on attachment 358847 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=358847&action=review

>> Source/WebCore/page/UndoManager.idl:27
>> +    EnabledAtRuntime=UndoManagerAPI
> 
> Add GenerateIsReachable=ImplDocument. Add a test if possible too.

👍 Fixed, and also added a test to verify that the wrapper survives GC.
Comment 7 Wenson Hsieh 2019-01-10 21:43:44 PST
Created attachment 358873 [details]
Patch for EWS
Comment 8 Wenson Hsieh 2019-01-11 10:17:56 PST
Comment on attachment 358873 [details]
Patch for EWS

It looks like commit queue is unresponsive :(
Comment 9 Wenson Hsieh 2019-01-11 10:30:10 PST
Committed <https://trac.webkit.org/changeset/239864/webkit>.