Bug 24981 - Crazy backspace/delete behavior
Summary: Crazy backspace/delete behavior
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://jparent.googlepages.com/broken...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-31 22:07 PDT by Julie Parent
Modified: 2009-07-14 17:37 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julie Parent 2009-03-31 22:07:36 PDT
1. Go to http://jparent.googlepages.com/brokenBackspace.html or paste the following HTML into your favorite contentEditable region: <h3>heading</h3>  other text
2. Put your cursor before the "o" in other
3. Hit backspace

Result: The "o" stays where it is, the "t" moves onto the next line, and "her text" merges up onto the line with "heading".  Html is: <h3>heading<span class="Apple-style-span" style="font-size: 16px; font-weight: normal; ">her text</span></h3>o<br>t
Expected result: "other text" merges onto the line wiht "heading"

Notes:
* This also happens if you put the cursor after the "g" in heading and hit delete.
* The problem is clearly with the whitespace before "other text".  With only one whitespace, only the "o" gets left behind, with two whitespaces, the "ot" get left behind, with three whitespaces, "oth" get left behind, etc.
Comment 1 Julie Parent 2009-04-10 13:18:38 PDT
I think this happens for all blocks.  If you replace the <H3> in my example with a <DIV>, <OL><LI>, <BLOCKQUOTE> it also repros.
Comment 2 swethanagaraj 2009-05-19 00:10:33 PDT
Hi,
I have been analysing the code for this bug, these are the observation made
In Webkit\WebCore\editing\deleteselectioncommand.cpp
-CompositeEditCommand::deleteTextFromNode(node, offset, count) method will
remove the white-space from the string="   other text" and gives us string="other text", without space.

but still the offSet value will be '3', which should be made to '0' before the call to 
VisiblePosition startOfParagraphToMove(m_downstreamEnd) method in 
mergeParagraphs()

else from the 3rd postion of "other text" which is from 'h' it will merge with heading.
so to reset the offset to zero , call m_upstreamStart = m_selectionToDelete.start() and 
    m_downstreamEnd = m_selectionToDelete.end() method before making a call to
VisiblePosition startOfParagraphToMove(m_downstreamEnd) in mergeParagraphs()


this would eliminate the problem due to white-space. 
Comment 3 Ryosuke Niwa 2009-07-14 16:28:27 PDT
I can't reproduce this bug.  Maybe it has been fixed?
Comment 4 Julie Parent 2009-07-14 17:37:14 PDT
I can't repro anymore either.  I'll mark as fixed.