[Webkit-unassigned] [Bug 58800] Delete removes two characters at a time in a container that has :first-letter applied to it

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 28 00:01:48 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=58800





--- Comment #7 from Antaryami Pandia (apandia) <antaryami.pandia at motorola.com>  2012-05-28 00:01:47 PST ---
Created an attachment (id=144283)
 --> (https://bugs.webkit.org/attachment.cgi?id=144283&action=review)
Reference Patch.

The string contains 25 characters. With current webkit design when there is a first letter preset it uses RenderTextFragment. For this string it creates 2 RenderTextFragment as follows:-
1. RenderTextFragments with first letter, start offset:0 and endoffset/length:1
2. RenderTextFragments with remaining letter, start offset: 1 and endoffset/length:24

Now when we place the cursor at the end , the offsets are as follows:-
-  offset 25 in original string and offset 24 in RenderTextFragment for remaining text. 

Now when we delete the text, it uses the RenderTextFragmnets offsets to calclulate the new offset. Since the current offset for it is 24 it calculates the new offsets as 23.

Now while deleting the characters it uses the original string (with 25 characters), and the new offsets calculated using RenderTextFragment (which is 23). 

The code that is used to delete is "DeleteSelectionCommand::handleGeneralDelete".
In this method it uses the offset to determine the length as follows:-
deleteTextFromNode(text, startOffset, m_downstreamEnd.deprecatedEditingOffset() - startOffset);

So since the new offset (calculated using the RenderTextFragment) is 23 and the value of m_downstreamEnd.deprecatedEditingOffset (which is same as the length of original string) is 25, the number of elements to be removed is calculated as 2. Hence it deletes 2 characters.

So there is a mismatch in calculation of offsets when first letter is involved.So if we add the start offset value of RenderTextFragment to the offset that is calculated in deletes one character. A reference patch is attached.

Please provide your feedback.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list