haikuwebkit/LayoutTests/editing/pasteboard/4944770-1.html

18 lines
668 B
HTML
Raw Permalink Normal View History

LayoutTests: Reviewed by darin <rdar://problem/4944770> editing/pasteboard/4641033 layout test is broken (12328) The fixes not only make this test pass, but also fix a bug that was reflected in the results checked in for this test. The caret was in the wrong position: * editing/pasteboard/4641033-expected.checksum: * editing/pasteboard/4641033-expected.png: * editing/pasteboard/4641033-expected.txt: Added: * editing/pasteboard/4944770-1-expected.checksum: Added. * editing/pasteboard/4944770-1-expected.png: Added. * editing/pasteboard/4944770-1-expected.txt: Added. * editing/pasteboard/4944770-1.html: Added. * editing/pasteboard/4944770-2-expected.checksum: Added. * editing/pasteboard/4944770-2-expected.png: Added. * editing/pasteboard/4944770-2-expected.txt: Added. * editing/pasteboard/4944770-2.html: Added. * editing/pasteboard/4944770-expected.checksum: Added. * editing/pasteboard/4944770-expected.png: Added. * editing/pasteboard/4944770-expected.txt: Added. Equivalent render trees: * editing/execCommand/format-block-from-range-selection-expected.txt: * editing/pasteboard/drag-drop-modifies-page-expected.txt: Fixed: * editing/pasteboard/nested-blocks-with-text-area-expected.checksum: * editing/pasteboard/nested-blocks-with-text-area-expected.png: * editing/pasteboard/nested-blocks-with-text-area-expected.txt: * editing/pasteboard/nested-blocks-with-text-field-expected.checksum: * editing/pasteboard/nested-blocks-with-text-field-expected.png: * editing/pasteboard/nested-blocks-with-text-field-expected.txt: WebCore: Reviewed by darin <rdar://problem/4944770> editing/pasteboard/4641033 layout test is broken (12328) This layout test failure demonstrates three bugs: Smart replace shouldn't be turned on, but is because a word selection granularity from the previous test isn't cleared. Smart replace shouldn't add any spaces because the paste is performed in an empty paragraph. Smart replace spaces are added to the text of options inside the select element instead of before/after the select element. This patch fixes the second two problems. During a ReplaceSelectionCommand, the VisiblePosition for the end of the inserted content is the last position in the last leaf inserted. This is a problem when the last leaf is inside a select element, since VP creation is inconsistent there. Second, smart spaces were inserted inside the last leaf, not at the endOfInsertedContent. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::shouldMergeStart): Renamed m_lastNodeInserted to m_lastLeafInserted. Use the start/endOfInsertedContent getters. (WebCore::ReplaceSelectionCommand::shouldMergeEnd): Ditto. (WebCore::ReplaceSelectionCommand::removeNodePreservingChildren): Ditto. (WebCore::ReplaceSelectionCommand::removeRedundantStyles): Ditto. (WebCore::ReplaceSelectionCommand::positionAtEndOfInsertedContent): Added. Special case for when the last leaf inserted is inside a select element: return the VisiblePosition after the select element. (WebCore::ReplaceSelectionCommand::positionAtStartOfInsertedContent): Added. (WebCore::ReplaceSelectionCommand::doApply): Did renaming. Used the start/endOfInsertedContent getters. Insert smart replace spaces into the right nodes. (WebCore::ReplaceSelectionCommand::shouldRemoveEndBR): Renaming. (WebCore::ReplaceSelectionCommand::completeHTMLReplacement): Ditto. (WebCore::ReplaceSelectionCommand::updateNodesInserted): Ditto. * editing/ReplaceSelectionCommand.h: Canonical link: https://commits.webkit.org/16012@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2007-01-23 01:30:50 +00:00
<p>This tests smart paste of a fragment that ends in a select element. There should be no spaces added because the paste is performed in an empty paragraph.</p>
<div contenteditable="true" id="copy">foo<select><option>1</option><option>2</option><option>3</option></select></div>
<div contenteditable="true" id="paste"></div>
<script>
var copy = document.getElementById("copy");
var paste = document.getElementById("paste");
var sel = window.getSelection();
sel.setPosition(copy, 0);
sel.modify("extend", "forward", "word");
sel.modify("extend", "forward", "word");
document.execCommand("Copy");
sel.setPosition(paste, 0);
document.execCommand("Paste");
</script>