<rdar://problem/
4083333> When deleting link at end of sentence, entire sentence gets deleted
* khtml/editing/htmlediting.cpp:
(khtml::DeleteSelectionCommand::initializePositionData):
Work around bug #
4103339 (whose real fix is somewhat risky), so this fix can get into a software update.
(khtml::DeleteSelectionCommand::handleGeneralDelete):
Add isAncestor check when comparing m_downstreamEnd.node() and m_startNode.
* layout-tests/editing/deleting/delete-
4083333-fix-expected.txt: Added.
* layout-tests/editing/deleting/delete-
4083333-fix.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9083
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
+ RenderInline {SPAN} at (0,0) size 106x28
+ RenderText {TEXT} at (14,14) size 80x28
+ text run at (14,14) width 80: "this is a "
+ RenderInline {A} at (0,0) size 26x28 [color=#0000EE]
+ RenderText {TEXT} at (94,14) size 26x28
+ text run at (94,14) width 26: "lin"
+ RenderText {TEXT} at (0,0) size 0x0
+caret: position 3 of child 0 {TEXT} of child 1 {A} of child 1 {SPAN} of child 0 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ moveSelectionForwardByLineCommand();
+ deleteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+<div contenteditable id="root" class="editing">
+<span id="test">this is a <A href="www.apple.com">link</A></span>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
+2005-04-29 David Harrison <harrison@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4083333> When deleting link at end of sentence, entire sentence gets deleted
+
+ * khtml/editing/htmlediting.cpp:
+ (khtml::DeleteSelectionCommand::initializePositionData):
+ Work around bug #4103339 (whose real fix is somewhat risky), so this fix can get into a software update.
+
+ (khtml::DeleteSelectionCommand::handleGeneralDelete):
+ Add isAncestor check when comparing m_downstreamEnd.node() and m_startNode.
+
+ * layout-tests/editing/deleting/delete-4083333-fix-expected.txt: Added.
+ * layout-tests/editing/deleting/delete-4083333-fix.html: Added.
+
2005-04-29 Darin Adler <darin@apple.com>
Reviewed by Dave Harrison.
// Handle leading and trailing whitespace, as well as smart delete adjustments to the selection
//
m_leadingWhitespace = m_upstreamStart.leadingWhitespacePosition(m_selectionToDelete.startAffinity());
- m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition(VP_DEFAULT_AFFINITY);
+ // NOTE: Workaround for bug <rdar://problem/4103339> is to avoid calculating trailingWhitespacePosition
+ // if the m_downstreamEnd is at the end of a paragraph.
+ if (!isEndOfParagraph(VisiblePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY)))
+ m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition(VP_DEFAULT_AFFINITY);
if (m_smartDelete) {
startOffset = 0;
}
+ // Done adjusting the start. See if we're all done.
if (!m_startNode)
return;
}
}
- if (m_downstreamEnd.node() != m_startNode && m_downstreamEnd.node()->inDocument() && m_downstreamEnd.offset() >= m_downstreamEnd.node()->caretMinOffset()) {
+
+ if (m_downstreamEnd.node() != m_startNode && !m_upstreamStart.node()->isAncestor(m_downstreamEnd.node()) && m_downstreamEnd.node()->inDocument() && m_downstreamEnd.offset() >= m_downstreamEnd.node()->caretMinOffset()) {
if (m_downstreamEnd.offset() >= maxDeepOffset(m_downstreamEnd.node())) {
// need to delete whole node
// we can get here if this is the last node in the block