WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
74249
Push more member functions from EditCommand to CompositeEditCommand
https://bugs.webkit.org/show_bug.cgi?id=74249
Summary
Push more member functions from EditCommand to CompositeEditCommand
Ryosuke Niwa
Reported
2011-12-10 17:10:10 PST
Right now EditCommand has many member functions that are overridden by CompositeEditCommand. However, some of them only make sense on CompositeEditCommand. We should move them to CompositeEditCommand since CompositeEditCommand now exists only at the time of initial application of the command. Also, it doesn't make much sense for EditCommandComposition to share the same super class (EditCommand) with SimpleEditCommand and CompositeEditCommand.
Attachments
work in progress
(23.80 KB, patch)
2011-12-10 17:39 PST
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Cleanup + regression fix
(31.97 KB, patch)
2011-12-12 00:41 PST
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed per Enrica's comments
(33.23 KB, patch)
2011-12-12 10:52 PST
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
cleanup
(26.41 KB, patch)
2011-12-14 00:41 PST
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed per Enrica's comment
(28.16 KB, patch)
2011-12-14 13:12 PST
,
Ryosuke Niwa
enrica
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2011-12-10 17:39:07 PST
Created
attachment 118700
[details]
work in progress
Ryosuke Niwa
Comment 2
2011-12-12 00:41:03 PST
Created
attachment 118747
[details]
Cleanup + regression fix
Enrica Casucci
Comment 3
2011-12-12 10:33:02 PST
Comment on
attachment 118747
[details]
Cleanup + regression fix View in context:
https://bugs.webkit.org/attachment.cgi?id=118747&action=review
> Source/WebCore/ChangeLog:15 > + respondToUnappliedEditing exits early even when the unapplied command was a CreteLinkCommand.
Typo CreateLinkCommand.
> Source/WebCore/editing/CompositeEditCommand.cpp:74 > + const VisibleSelection& startingSelection, const VisibleSelection endingSelection, bool wasCreateLink)
I suggest using was CreateLinkCommand as parameter name.
> Source/WebCore/editing/CompositeEditCommand.h:42 > + static PassRefPtr<EditCommandComposition> create(Document*, const VisibleSelection&, const VisibleSelection, bool wasCreateLink);
Ditto.
> Source/WebCore/editing/CompositeEditCommand.h:48 > + bool wasCreateLinkCommand() { return m_wasCreateLink; }
Again I would prefer m_wasCreateLinkCommand. It just feels more understandable.
> Source/WebCore/editing/CompositeEditCommand.h:55 > + EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLink)
Ditto.
> Source/WebCore/editing/CompositeEditCommand.h:62 > + bool m_wasCreateLink;
Ditto.
> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:2246 > + frame->editor()->replaceSelectionWithText(text, selectReplacement, smartReplace);
I'm not sure this code is equivalent. The PreventNesting option seems to be lost.
> Source/WebKit/chromium/src/WebFrameImpl.cpp:1129 > + frame()->editor()->replaceSelectionWithText(text, selectReplace, smartReplace);
Ditto.
> Source/WebKit/gtk/webkit/webkitwebframe.cpp:1001 > + coreFrame->editor()->replaceSelectionWithText(text, selectReplacement, smartReplace);
Ditto.
> Source/WebKit/mac/WebView/WebFrame.mm:1049 > + _private->coreFrame->editor()->replaceSelectionWithFragment(core(fragment), selectReplacement, smartReplace, matchStyle);
Ditto.
Enrica Casucci
Comment 4
2011-12-12 10:35:48 PST
The patch shows build errors on mac. It would be better to add layout tests for the fix relative to the spellchecker regression. If you want to write the test I could run it and validate it for you, if you want.
Ryosuke Niwa
Comment 5
2011-12-12 10:40:08 PST
(In reply to
comment #3
)
> (From update of
attachment 118747
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=118747&action=review
> > > Source/WebCore/ChangeLog:15 > > + respondToUnappliedEditing exits early even when the unapplied command was a CreteLinkCommand. > > Typo CreateLinkCommand.
Will fix.
> > Source/WebCore/editing/CompositeEditCommand.cpp:74 > > + const VisibleSelection& startingSelection, const VisibleSelection endingSelection, bool wasCreateLink) > > I suggest using was CreateLinkCommand as parameter name.
Sure, will change.
> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:2246 > > + frame->editor()->replaceSelectionWithText(text, selectReplacement, smartReplace); > > I'm not sure this code is equivalent. The PreventNesting option seems to be lost.
PreventNesting is always set in Editor::replaceSelectionWithFragment.
Ryosuke Niwa
Comment 6
2011-12-12 10:52:48 PST
Created
attachment 118817
[details]
Fixed per Enrica's comments
Ryosuke Niwa
Comment 7
2011-12-12 13:14:05 PST
Comment on
attachment 118817
[details]
Fixed per Enrica's comments Let me split this patch into 3 pieces: 1a - Remove dependency on ApplyCommand in WebKit 1b - Fix a regression in SpellingCorrectionController 2 - Push member functions from EditCommand to CompositeEditCommand.
Enrica Casucci
Comment 8
2011-12-12 13:17:37 PST
(In reply to
comment #7
)
> (From update of
attachment 118817
[details]
) > Let me split this patch into 3 pieces: > 1a - Remove dependency on ApplyCommand in WebKit > 1b - Fix a regression in SpellingCorrectionController > 2 - Push member functions from EditCommand to CompositeEditCommand.
Sounds like a good plan to me.
Ryosuke Niwa
Comment 9
2011-12-14 00:41:28 PST
Created
attachment 119173
[details]
cleanup
Enrica Casucci
Comment 10
2011-12-14 09:40:38 PST
Comment on
attachment 119173
[details]
cleanup View in context:
https://bugs.webkit.org/attachment.cgi?id=119173&action=review
The changes look good, but there is a build failure. Please fix that.
> Source/WebCore/editing/Editor.cpp:871 > + EditCommandComposition* composition = cmd->composition();
Nit. I would ASSERT composition directly.
Ryosuke Niwa
Comment 11
2011-12-14 13:12:39 PST
Created
attachment 119282
[details]
Fixed per Enrica's comment
Enrica Casucci
Comment 12
2011-12-14 13:30:22 PST
Comment on
attachment 119282
[details]
Fixed per Enrica's comment Thanks!
Ryosuke Niwa
Comment 13
2011-12-14 13:31:10 PST
Great. Thanks for the review.
Ryosuke Niwa
Comment 14
2011-12-14 15:16:13 PST
Committed
r102833
: <
http://trac.webkit.org/changeset/102833
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug