-
justin.garcia@apple.com authored
2008-06-25 Justin Garcia <justin.garcia@apple.com> Reviewed by John. <rdar://problem/5994480> Line break lost on some pastes Merging the the first paragraph of inserted content with the content that came before the selection that was pasted into would also move content after the selection that was pasted into if: 1) Only one paragraph was being pasted, and it was not wrapped in a block 2) The selection that was pasted into ended at the end of a block 3) The next paragraph didn't start at the start of a block. Insert a line break just after the inserted content to separate it from what comes after and prevent that from happening. Doing this exposed a bug in deletion where it would insert an unnecessary placeholder when deleting a paragraph that started or ended with an input element. This was because its m_startBlock and m_endBlock were still computed with the old deprecated enclosingBlockFlowOrTableElement(). * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::initializePositionData): Use the new method for getting an enclosing block. (WebCore::DeleteSelectionCommand::doApply): The new method for getting an enclosing block will return 0 if it reaches the root editable element before finding a block, so if we're deleting inside an inline editable root, m_start/endBlock will be 0. Removed an early return for this case (we already have test coverage for it). * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): Insert a line break just after the inserted content to separate it from what comes after. * dom/Node.h: Removed enclosingBlockFlowOrTableElement(). * dom/Node.cpp: Ditto. LayoutTests: 2008-06-25 Justin Garcia <justin.garcia@apple.com> Reviewed by John. <rdar://problem/5994480> Line break lost on some pastes These demonstrate fixes: * editing/inserting/5994480.html: Added. * editing/inserting/5994480-expected.txt: Added. * editing/inserting/5994480-2.html: Added. * editing/inserting/5994480-2-expected.txt: Added. The changes made in this fix caused more of the unrendered text from the original file to be preserved and show up in the test results. We insert a line break after inserted content to separate it from content that comes after and prevent it from being merged. In these what came after was unrendered whitespace that was previously clobbered by the merge: * platform/mac/editing/pasteboard/paste-match-style-001-expected.txt: * platform/mac/editing/pasteboard/paste-text-010-expected.txt: * platform/mac/editing/pasteboard/smart-paste-001-expected.txt: * platform/mac/editing/style/style-boundary-005-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
e1da273c