Bug 193704 - Introduce CustomUndoStep.h and CustomUndoStep.cpp
Summary: Introduce CustomUndoStep.h and CustomUndoStep.cpp
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:
Blocks:
 
Reported: 2019-01-22 19:43 PST by Wenson Hsieh
Modified: 2019-01-22 22:29 PST (History)
7 users (show)

See Also:


Attachments
Patch (13.55 KB, patch)
2019-01-22 19:46 PST, Wenson Hsieh
rniwa: review+
Details | Formatted Diff | Diff
Patch for landing (13.33 KB, patch)
2019-01-22 21:30 PST, Wenson Hsieh
wenson_hsieh: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (11.85 KB, patch)
2019-01-22 21:32 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-22 19:43:40 PST
Work towards <rdar://problem/44807048>
Comment 1 Wenson Hsieh 2019-01-22 19:46:11 PST
Created attachment 359840 [details]
Patch
Comment 2 Ryosuke Niwa 2019-01-22 19:51:39 PST
Comment on attachment 359840 [details]
Patch

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

> Source/WebCore/editing/CompositeEditCommand.h:91
> +    const String& customUndoLabel() const final { return emptyString(); }

I think a better approach is have the conversion from EditAction to label here.
Comment 3 Ryosuke Niwa 2019-01-22 19:52:33 PST
(In reply to Ryosuke Niwa from comment #2)
> Comment on attachment 359840 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359840&action=review
> 
> > Source/WebCore/editing/CompositeEditCommand.h:91
> > +    const String& customUndoLabel() const final { return emptyString(); }
> 
> I think a better approach is have the conversion from EditAction to label
> here.

Not saying that we should make such a change in this patch but I think having editAction() & customUndoLabel() is rather confusing so we probably shouldn't add such a method. Also, this label is used for redo as well so saying it's undo label is quite misleading.
Comment 4 Wenson Hsieh 2019-01-22 20:03:13 PST
(In reply to Ryosuke Niwa from comment #3)
> (In reply to Ryosuke Niwa from comment #2)
> > Comment on attachment 359840 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=359840&action=review
> > 
> > > Source/WebCore/editing/CompositeEditCommand.h:91
> > > +    const String& customUndoLabel() const final { return emptyString(); }
> > 
> > I think a better approach is have the conversion from EditAction to label
> > here.
> 
> Not saying that we should make such a change in this patch but I think
> having editAction() & customUndoLabel() is rather confusing so we probably
> shouldn't add such a method. Also, this label is used for redo as well so
> saying it's undo label is quite misleading.

That's a good point! This will take a bit of refactoring, but I think it's worth it (this should also allow us to remove some duplicate code between WebKitLegacy and WebKit). I'll land this patch (Part 2) without customUndoLabel() for now, and write up a patch to add an undoRedoLabel() method to UndoStep instead.

This refactoring patch will sit between this one (Part 2) and the Part 3 I had planned.
Comment 5 Wenson Hsieh 2019-01-22 21:30:22 PST
Created attachment 359848 [details]
Patch for landing
Comment 6 Wenson Hsieh 2019-01-22 21:32:31 PST
Created attachment 359849 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-01-22 22:10:51 PST
Comment on attachment 359849 [details]
Patch for landing

Clearing flags on attachment: 359849

Committed r240328: <https://trac.webkit.org/changeset/240328>
Comment 8 Wenson Hsieh 2019-01-22 22:29:29 PST
(In reply to Wenson Hsieh from comment #4)
> (In reply to Ryosuke Niwa from comment #3)
> > (In reply to Ryosuke Niwa from comment #2)
> > > Comment on attachment 359840 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=359840&action=review
> > > 
> > > > Source/WebCore/editing/CompositeEditCommand.h:91
> > > > +    const String& customUndoLabel() const final { return emptyString(); }
> > > 
> > > I think a better approach is have the conversion from EditAction to label
> > > here.
> > 
> > Not saying that we should make such a change in this patch but I think
> > having editAction() & customUndoLabel() is rather confusing so we probably
> > shouldn't add such a method. Also, this label is used for redo as well so
> > saying it's undo label is quite misleading.
> 
> That's a good point! This will take a bit of refactoring, but I think it's
> worth it (this should also allow us to remove some duplicate code between
> WebKitLegacy and WebKit). I'll land this patch (Part 2) without
> customUndoLabel() for now, and write up a patch to add an undoRedoLabel()
> method to UndoStep instead.
> 
> This refactoring patch will sit between this one (Part 2) and the Part 3 I
> had planned.

I filed https://bugs.webkit.org/show_bug.cgi?id=193706 to track this refactoring.