WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
150354
Use modern for-loops in WebCore/editing.
https://bugs.webkit.org/show_bug.cgi?id=150354
Summary
Use modern for-loops in WebCore/editing.
Hunseop Jeong
Reported
2015-10-19 21:57:11 PDT
Refactor the for-loops using the ranged-for loops and auto keyword in WebCore/editing.
Attachments
Patch
(39.61 KB, patch)
2015-10-19 22:07 PDT
,
Hunseop Jeong
no flags
Details
Formatted Diff
Diff
Patch
(40.51 KB, patch)
2015-10-25 21:52 PDT
,
Hunseop Jeong
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Hunseop Jeong
Comment 1
2015-10-19 22:07:15 PDT
Created
attachment 263550
[details]
Patch
Darin Adler
Comment 2
2015-10-20 09:04:07 PDT
Comment on
attachment 263550
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263550&action=review
Patch is OK as is. I spotted some things we might want to come back and improve separately.
> Source/WebCore/editing/CompositeEditCommand.cpp:578 > static void copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers, Vector<RenderedDocumentMarker>& markers)
This should have a return value, not an out argument.
> Source/WebCore/editing/CompositeEditCommand.cpp:580 > + markers.reserveCapacity(markerPointers.size());
This should be using reserveInitialCapacity.
> Source/WebCore/editing/CompositeEditCommand.cpp:582 > + markers.append(*markerPointer);
This should be using uncheckedAppend.
> Source/WebCore/editing/EditingStyle.cpp:103 > + for (auto editingProperty : editingProperties) {
I’d prefer either "int" or "auto&" here, even though auto will work fine.
> Source/WebCore/editing/mac/EditorMac.mm:517 > + if (!paths.size())
paths.isEmpty() would be better, I think.
Hunseop Jeong
Comment 3
2015-10-21 23:47:50 PDT
(In reply to
comment #2
)
> Comment on
attachment 263550
[details]
> Patch >
Thanks for the review. I have a question about your comment.
> > Source/WebCore/editing/CompositeEditCommand.cpp:578 > > static void copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers, Vector<RenderedDocumentMarker>& markers) > > This should have a return value, not an out argument. >
I don't understand here. Do I changed the function to have a return value? Could you give me the detail explanation?
Darin Adler
Comment 4
2015-10-24 15:25:19 PDT
Comment on
attachment 263550
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263550&action=review
>>> Source/WebCore/editing/CompositeEditCommand.cpp:578 >>> static void copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers, Vector<RenderedDocumentMarker>& markers) >> >> This should have a return value, not an out argument. > > I don't understand here. Do I changed the function to have a return value? > Could you give me the detail explanation?
Yes, the new function should be: static Vector<RenderedDocumentMarker> copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers) { ... return markers; } And the call site below should be changed to: auto markers = copyMarkers(markerController.markersInRange(Range::create(document(), node, offset, node, offset + count).ptr(), DocumentMarker::AllMarkers()));
Hunseop Jeong
Comment 5
2015-10-25 21:52:53 PDT
Created
attachment 264035
[details]
Patch
Hunseop Jeong
Comment 6
2015-10-25 22:07:18 PDT
(In reply to
comment #4
)
> Comment on
attachment 263550
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=263550&action=review
> > >>> Source/WebCore/editing/CompositeEditCommand.cpp:578 > >>> static void copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers, Vector<RenderedDocumentMarker>& markers) > >> > >> This should have a return value, not an out argument. > > > > I don't understand here. Do I changed the function to have a return value? > > Could you give me the detail explanation? > > Yes, the new function should be: > > static Vector<RenderedDocumentMarker> copyMarkers(const > Vector<RenderedDocumentMarker*>& markerPointers) > { > ... > return markers; > } > > And the call site below should be changed to: > > auto markers = > copyMarkers(markerController.markersInRange(Range::create(document(), node, > offset, node, offset + count).ptr(), DocumentMarker::AllMarkers()));
Thanks for the guide. I applied your comments. Could you check the patch again?
WebKit Commit Bot
Comment 7
2015-10-25 23:30:07 PDT
Comment on
attachment 264035
[details]
Patch Clearing flags on attachment: 264035 Committed
r191553
: <
http://trac.webkit.org/changeset/191553
>
WebKit Commit Bot
Comment 8
2015-10-25 23:30:11 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