Commit 87099ef1 authored by justin.garcia@apple.com's avatar justin.garcia@apple.com
Browse files

WebCore:

2008-06-24  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by John.

        <rdar://problem/6026335> REGRESSION: Caret disappears after deleting a particular selection involving a ToDo
        
        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::moveParagraphs): If asked to preserveStyle, we
        apply styles from the moved paragraph to the destination with applyStyle, which
        does selection preservation when it needs to apply block styles.  Selection preservation 
        uses relatively untested code in TextIterator to count VisiblePositions which fails in 
        this particular test case because it doesn't handle changes in editability properly.  
        We can avoid this bug by not applying block styles from moved paragraphs.  This is 
        something that should be done anyway, since the moved paragraph should assume the 
        block styles of the destination.
        * editing/EditCommand.cpp:
        (WebCore::EditCommand::styleAtPosition): Added a FIXME about how it is misleading for
        this function to also include the typing style.
        * editing/TextIterator.h: Added a FIXME about how the code path used for selection preservation
        is buggy and should be phased out when we rewrite moveParagraphs.

LayoutTests:

2008-06-24  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by John.

        <rdar://problem/6026335> REGRESSION: Caret disappears after deleting a particular selection involving a ToDo

        * editing/deleting/6026335-expected.txt: Added.
        * editing/deleting/6026335.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cafdc2b8
2008-06-24 Justin Garcia <justin.garcia@apple.com>
Reviewed by John.
<rdar://problem/6026335> REGRESSION: Caret disappears after deleting a particular selection involving a ToDo
* editing/deleting/6026335-expected.txt: Added.
* editing/deleting/6026335.html: Added.
2008-06-24 Sam Weinig and Beth Dakin <bdakin@apple.com and sam@webkit.org>
 
Reviewed by Darin.
This tests deleting a selection that starts at the beginning of an editable pocket inside a non-editable table. The caret should not disappear during the delete and should be placed inside the editable span. When text is then inserted, it should be placed inside that span.
<div contenteditable="false"><span>&nbsp;</span><span contenteditable="true" id="start">Text<br></span></div>
<div id="description">This tests deleting a selection that starts at the beginning of an editable pocket inside a non-editable table. The caret should not disappear during the delete and should be placed inside the editable span. When text is then inserted, it should be placed inside that span.</div>
<div id="edit" contentEditable="true">
<div contentEditable="false"><span>&nbsp;</span><span contentEditable="true" id="start">Hello</span></div>
<div id="end"><br></div>
</div>
<script>
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
start = document.getElementById("start");
end = document.getElementById("end");
s = window.getSelection();
s.setBaseAndExtent(start, 0, end, 0);
document.execCommand("Delete");
document.execCommand("InsertText", false, "Text");
if (window.layoutTestController)
document.body.innerText = document.getElementById("description").innerText + "\n" + document.getElementById("edit").innerHTML;
</script>
2008-06-24 Justin Garcia <justin.garcia@apple.com>
Reviewed by John.
<rdar://problem/6026335> REGRESSION: Caret disappears after deleting a particular selection involving a ToDo
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs): If asked to preserveStyle, we
apply styles from the moved paragraph to the destination with applyStyle, which
does selection preservation when it needs to apply block styles. Selection preservation
uses relatively untested code in TextIterator to count VisiblePositions which fails in
this particular test case because it doesn't handle changes in editability properly.
We can avoid this bug by not applying block styles from moved paragraphs. This is
something that should be done anyway, since the moved paragraph should assume the
block styles of the destination.
* editing/EditCommand.cpp:
(WebCore::EditCommand::styleAtPosition): Added a FIXME about how it is misleading for
this function to also include the typing style.
* editing/TextIterator.h: Added a FIXME about how the code path used for selection preservation
is buggy and should be phased out when we rewrite moveParagraphs.
2008-06-24 Kevin McCullough <kmccullough@apple.com>
 
-Added a manual test for the profiler.
......@@ -762,8 +762,11 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
// anything if we're given an empty paragraph, but an empty paragraph can have style
// too, <div><b><br></b></div> for example. Save it so that we can preserve it later.
RefPtr<CSSMutableStyleDeclaration> styleInEmptyParagraph;
if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle)
if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) {
styleInEmptyParagraph = styleAtPosition(startOfParagraphToMove.deepEquivalent());
// The moved paragraph should assume the block style of the destination.
styleInEmptyParagraph->removeBlockProperties();
}
// FIXME (5098931): We should add a new insert action "WebViewInsertActionMoved" and call shouldInsertFragment here.
......
......@@ -206,6 +206,8 @@ PassRefPtr<CSSMutableStyleDeclaration> EditCommand::styleAtPosition(const Positi
{
RefPtr<CSSMutableStyleDeclaration> style = positionBeforeTabSpan(pos).computedStyle()->copyInheritableProperties();
// FIXME: It seems misleading to also include the typing style when returning the style at some arbitrary
// position in the document.
CSSMutableStyleDeclaration* typingStyle = document()->frame()->typingStyle();
if (typingStyle)
style->merge(typingStyle);
......
......@@ -126,6 +126,8 @@ private:
// Used by selection preservation code. There should be one character emitted between every VisiblePosition
// in the Range used to create the TextIterator.
// FIXME <rdar://problem/6028818>: This functionality should eventually be phased out when we rewrite
// moveParagraphs to not clone/destroy moved content.
bool m_emitCharactersBetweenAllVisiblePositions;
};
......
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