Bug 193109

Summary: Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, megan_gardner, mitz, rniwa, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 193328    
Bug Blocks: 193111    
Attachments:
Description Flags
WIP
none
Patch
rniwa: review+
Patch for EWS none

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>.