Bug 167062

Summary: De-duplicate some (nearly) identical code in Editor(Mac|IOS).mm
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, enrica, mitz, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Tim Horton
Reported 2017-01-14 19:40:33 PST
De-duplicate some (nearly) identical code in Editor(Mac|IOS).mm
Attachments
Patch (23.43 KB, patch)
2017-01-14 19:40 PST, Tim Horton
no flags
Patch (28.69 KB, patch)
2017-01-14 20:23 PST, Tim Horton
no flags
Patch (30.03 KB, patch)
2017-01-14 21:14 PST, Tim Horton
no flags
Patch (30.35 KB, patch)
2017-01-14 22:09 PST, Tim Horton
no flags
Tim Horton
Comment 1 2017-01-14 19:40:58 PST
mitz
Comment 2 2017-01-14 19:56:50 PST
Comment on attachment 298876 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298876&action=review > Source/WebCore/ChangeLog:22 > + Move these six methods here. functions > Source/WebCore/ChangeLog:29 > + and Editor(Mac|IOS), so we'll make them class methods. static member functions > Source/WebCore/editing/Editor.cpp:3657 > + const Font* result = nullptr; Should we call this font like the other one below? > Source/WebCore/editing/Editor.cpp:3670 > + if (range && startNode) { Maybe change this to an early return and only declare the font variable after? > Source/WebCore/editing/Editor.cpp:3672 > + // In the loop below, n should eventually match pastEnd and not become nil, but we've seen at least one null > Source/WebCore/editing/Editor.h:446 > + WEBCORE_EXPORT const Font* fontForSelection(bool&) const; The boolean needs to be named here. > Source/WebCore/editing/cocoa/EditorCocoa.mm:133 > + content.dataInRTFDFormat = attributedString.containsAttachments ? dataInRTFDFormat(attributedString) : 0; nullptr?
Tim Horton
Comment 3 2017-01-14 20:23:10 PST
Darin Adler
Comment 4 2017-01-14 20:41:48 PST
Comment on attachment 298876 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298876&action=review >> Source/WebCore/editing/Editor.h:446 >> + WEBCORE_EXPORT const Font* fontForSelection(bool&) const; > > The boolean needs to be named here. Another option that could clean things up in the future would to change this to return a struct so we can have both the font and the "has multiple fonts" boolean without using an out argument. Even a tuple or pair might be better, but then we would not have a name for the boolean.
Tim Horton
Comment 5 2017-01-14 21:14:10 PST
Tim Horton
Comment 6 2017-01-14 22:09:00 PST
WebKit Commit Bot
Comment 7 2017-01-14 22:47:06 PST
Comment on attachment 298887 [details] Patch Clearing flags on attachment: 298887 Committed r210773: <http://trac.webkit.org/changeset/210773>
WebKit Commit Bot
Comment 8 2017-01-14 22:47:11 PST
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.