Bug 132834 - Teach Editor to support more direct replacement of a Node
Summary: Teach Editor to support more direct replacement of a Node
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-05-12 13:34 PDT by Brady Eidson
Modified: 2014-05-12 17:08 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (28.53 KB, patch)
2014-05-12 13:43 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch v2 (29.67 KB, patch)
2014-05-12 14:24 PDT, Brady Eidson
enrica: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2014-05-12 13:34:34 PDT
Teach Editor to support more direct replacement of a Node.

When using the new API "Editor::replaceNodeFromPasteboard" the intention is that the new DocumentFragment is as similar to the old Node as possible.

In practice, the new DocumentFragment:
1 - Can represent a single node that's missing various attributes the original Node had.
2 - Can be an unwanted fragment of arbitrary depth when the replacement happens inside Mail.app

This will fix both of those problems.

<rdar://problem/16817952>
Comment 1 Brady Eidson 2014-05-12 13:43:32 PDT
Created attachment 231320 [details]
Patch v1
Comment 2 WebKit Commit Bot 2014-05-12 13:46:27 PDT
Attachment 231320 [details] did not pass style-queue:


ERROR: Source/WebCore/editing/ReplaceSelectionCommand.cpp:941:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
ERROR: Source/WebCore/editing/ReplaceSelectionCommand.cpp:941:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/dom/TextEvent.h:46:  The parameter name "view" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/dom/TextEvent.h:76:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/dom/TextEvent.cpp:85:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/dom/TextEvent.cpp:92:  Wrong number of spaces before statement. (expected: 25)  [whitespace/indent] [4]
Total errors found: 6 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Brady Eidson 2014-05-12 14:24:40 PDT
Created attachment 231325 [details]
Patch v2
Comment 4 Enrica Casucci 2014-05-12 14:57:50 PDT
Comment on attachment 231325 [details]
Patch v2

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

Looks good to me. Please make sure all the editing tests are still passing.

> Source/WebCore/editing/ReplaceSelectionCommand.h:46
> +        IgnoreMailBlockquote = 1 << 6,

No comma at the end of the last one
Comment 5 Brady Eidson 2014-05-12 15:04:06 PDT
(In reply to comment #4)
> (From update of attachment 231325 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=231325&action=review
> 
> Looks good to me. Please make sure all the editing tests are still passing.

Doing that now!

> > Source/WebCore/editing/ReplaceSelectionCommand.h:46
> > +        IgnoreMailBlockquote = 1 << 6,
> 
> No comma at the end of the last one

Actually it's preferred (if not yet in the style guidelines) to include a comma on the last value.  That was when a new value is added, the patch consists only of one addition instead of one subtraction and two additions.

Thanks for the review!
Comment 6 Brady Eidson 2014-05-12 15:48:53 PDT
EWS was happy, and no changes locally.
http://trac.webkit.org/changeset/168650
Comment 7 Brady Eidson 2014-05-12 17:08:33 PDT
Followup - http://trac.webkit.org/changeset/168658