Commit 180df329 authored by adele@apple.com's avatar adele@apple.com

WebCore:

2009-04-28  Adele Peterson  <adele@apple.com>

        Reviewed by Darin Adler.

        Fix for <rdar://problem/6617298> Typing delete on an unquoted blank line unquotes the preceding, quoted blank line

        Test: editing/deleting/type-delete-after-quote.html

        When a selection is deleted that contains a whole number paragraphs plus a line break, we refrain from merging paragraphs after the delete,
        since it is unclear to most users that such a selection actually ends at the start of the next paragraph.  However, when a user hits delete 
        with a caret selection, they actually do expect the start of that paragraph to be merged into the paragraph before it.  We can tell that 
        we're in this state because the TypingCommand creates the selection to delete but it doesn't change the endingSelection.  So we can tell
        that if we started with a caret selection, then we're not in this special case where we have to protect the user from unexpected behavior 
        from deleting a range they selected.

        * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::initializePositionData):

LayoutTests:

2009-04-28  Adele Peterson  <adele@apple.com>

        Reviewed by Darin Adler.

        Test for <rdar://problem/6617298> Typing delete on an unquoted blank line unquotes the preceding, quoted blank line

        * editing/deleting/type-delete-after-quote.html: Added.
        * platform/mac/editing/deleting/delete-4038408-fix-expected.txt: This expected result change reflects a change in how the editing is done, 
          but the document structure remains the same, and there are no visible changes to the result.
        * platform/mac/editing/deleting/type-delete-after-quote-expected.checksum: Added.
        * platform/mac/editing/deleting/type-delete-after-quote-expected.png: Added.
        * platform/mac/editing/deleting/type-delete-after-quote-expected.txt: Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@42968 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7f0b9a10
2009-04-28 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler.
Test for <rdar://problem/6617298> Typing delete on an unquoted blank line unquotes the preceding, quoted blank line
* editing/deleting/type-delete-after-quote.html: Added.
* platform/mac/editing/deleting/delete-4038408-fix-expected.txt: This expected result change reflects a change in how the editing is done,
but the document structure remains the same, and there are no visible changes to the result.
* platform/mac/editing/deleting/type-delete-after-quote-expected.checksum: Added.
* platform/mac/editing/deleting/type-delete-after-quote-expected.png: Added.
* platform/mac/editing/deleting/type-delete-after-quote-expected.txt: Added.
2009-04-28 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser.
<html>
<head>
<style>
blockquote {
color: blue;
border-left: 2px solid blue;
margin-left: 0px;
padding-left: 10px;
}
</style>
</head>
<body>
<div id="description">When your cursor is after an empty blockquote, hitting delete should bring the cursor (and the content following the cursor) back into the blockquote, instead of deleting the empty blockquote.</div>
<div id="edit" contenteditable="true"><blockquote type="cite"><br></blockquote>This should be quoted</div>
<script>
edit = document.getElementById("edit");
var s = window.getSelection();
s.setPosition(edit, 1);
document.execCommand("Delete");
</script>
</body>
</html>
......@@ -6,14 +6,20 @@ EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotificatio
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 35 of #text > DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: shouldDeleteDOMRange:range from 35 of #text > DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 0 of DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 35 of #text > DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document to 35 of #text > DIV > BLOCKQUOTE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
......
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {DIV} at (0,0) size 784x36
RenderText {#text} at (0,0) size 775x36
text run at (0,0) width 775: "When your cursor is after an empty blockquote, hitting delete should bring the cursor (and the content following the cursor)"
text run at (0,18) width 422: "back into the blockquote, instead of deleting the empty blockquote."
RenderBlock {DIV} at (0,52) size 784x18
RenderBlock {BLOCKQUOTE} at (0,0) size 744x18 [color=#0000FF] [border: (2px solid #0000FF)]
RenderText {#text} at (12,0) size 140x18
text run at (12,0) width 140: "This should be quoted"
RenderBlock (anonymous) at (0,34) size 784x0
caret: position 0 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
2009-04-28 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler.
Fix for <rdar://problem/6617298> Typing delete on an unquoted blank line unquotes the preceding, quoted blank line
Test: editing/deleting/type-delete-after-quote.html
When a selection is deleted that contains a whole number paragraphs plus a line break, we refrain from merging paragraphs after the delete,
since it is unclear to most users that such a selection actually ends at the start of the next paragraph. However, when a user hits delete
with a caret selection, they actually do expect the start of that paragraph to be merged into the paragraph before it. We can tell that
we're in this state because the TypingCommand creates the selection to delete but it doesn't change the endingSelection. So we can tell
that if we started with a caret selection, then we're not in this special case where we have to protect the user from unexpected behavior
from deleting a range they selected.
* editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::initializePositionData):
2009-04-28 Xan Lopez <xlopez@igalia.com>
Unreviewed: fix distcheck build, add missing header to file list.
......@@ -195,7 +195,11 @@ void DeleteSelectionCommand::initializePositionData()
// selections that contain a whole number paragraphs plus a line break, since it is unclear to most users
// that such a selection actually ends at the start of the next paragraph. This matches TextEdit behavior
// for indented paragraphs.
if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end) && isStartOfParagraph(visibleEnd) && isStartOfParagraph(VisiblePosition(start))) {
// Only apply this rule if the endingSelection is a range selection. If it is a caret, then other operations have created
// the selection we're deleting (like the process of creating a selection to delete during a backspace), and the user isn't in the situation described above.
if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end)
&& isStartOfParagraph(visibleEnd) && isStartOfParagraph(VisiblePosition(start))
&& endingSelection().isRange()) {
m_mergeBlocksAfterDelete = false;
m_pruneStartBlockIfNecessary = true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment