WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
129867
Cut and copy functions should be refactored as suggested in FIXME line
https://bugs.webkit.org/show_bug.cgi?id=129867
Summary
Cut and copy functions should be refactored as suggested in FIXME line
Lukasz Bialek
Reported
2014-03-07 00:40:29 PST
Most of code in Cut and Copy functions in Editor.cpp is identical (or analogical). There is a FIXME line suggesting to refactor this part of the code to start sharing code.
Attachments
Patch
(7.14 KB, patch)
2014-03-07 00:47 PST
,
Lukasz Bialek
no flags
Details
Formatted Diff
Diff
There was small error in first version. Fixed.
(7.13 KB, patch)
2014-03-07 02:11 PST
,
Lukasz Bialek
no flags
Details
Formatted Diff
Diff
Patch
(5.49 KB, patch)
2014-03-07 03:28 PST
,
Lukasz Bialek
darin
: review-
Details
Formatted Diff
Diff
Patch
(4.96 KB, patch)
2014-03-28 02:57 PDT
,
Lukasz Bialek
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Lukasz Bialek
Comment 1
2014-03-07 00:47:20 PST
Created
attachment 226093
[details]
Patch
Lukasz Bialek
Comment 2
2014-03-07 02:11:18 PST
Created
attachment 226100
[details]
There was small error in first version. Fixed.
Lukasz Bialek
Comment 3
2014-03-07 03:28:56 PST
Created
attachment 226109
[details]
Patch copy() and cut() functions have to be kept (calling newly refactored function) to avoid changing function names in all ports (which is not a good idea...)
Darin Adler
Comment 4
2014-03-15 17:38:14 PDT
Comment on
attachment 226109
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=226109&action=review
This patch looks OK, but I don’t want to say review+ because I don’t want to add a new enum and a new public function to Editor just to restructure the code internals. I’m going to say review-, but please don’t let that discourage you!
> Source/WebCore/editing/Editor.cpp:1298 > + bool isDoneByDHTML = (action == CutAction) ? tryDHTMLCut() : tryDHTMLCopy(); > + if (isDoneByDHTML) > return; // DHTML did the whole operation > - if (!canCut()) { > + > + bool canPerformAction = (action == CutAction) ? canCut() : canCopy(); > + if (!canPerformAction) { > systemBeep(); > return; > }
Not sure that putting this part of the function into shared code is worthwhile. I think cut and copy should just do these and then they could share a helper that does the rest.
> Source/WebCore/editing/Editor.h:90 > +enum EditorActionSpecifier { CutAction, CopyAction };
This enum should be private to the Editor class rather than at the top level. The other enums are at the namespace level for convenient use outside the class, but this one does not need to be used outside the class.
> Source/WebCore/editing/Editor.h:130 > + void performCutOrCopy(EditorActionSpecifier);
This function should be private.
Lukasz Bialek
Comment 5
2014-03-28 02:57:48 PDT
Created
attachment 228033
[details]
Patch All comments were very accurate and has been addressed.
Lukasz Bialek
Comment 6
2014-03-28 03:15:14 PDT
> I’m going to say review-, but please don’t let that discourage you!
It's not so easy to discourage me :) Especially when comments are good and accurate. Fixed and ready for next review.
WebKit Commit Bot
Comment 7
2014-03-28 19:27:19 PDT
Comment on
attachment 228033
[details]
Patch Clearing flags on attachment: 228033 Committed
r166445
: <
http://trac.webkit.org/changeset/166445
>
WebKit Commit Bot
Comment 8
2014-03-28 19:27:21 PDT
All reviewed patches have been landed. Closing bug.
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