Bug 6029 - plainText() returns a partial result when the node contains RTL text
Summary: plainText() returns a partial result when the node contains RTL text
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-10 03:14 PST by mitz
Modified: 2005-12-11 08:24 PST (History)
1 user (show)

See Also:


Attachments
testcase (654 bytes, text/html)
2005-12-10 03:17 PST, mitz
no flags Details
Advance m_sortedTextBoxes only when necessary (6.82 KB, patch)
2005-12-10 04:13 PST, mitz
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-12-10 03:14:41 PST
Summary: Copying a selection to the clipboard or calling innerText on a node results in only part of the 
expected text being copied or returned in certain cases if the node contains RTL text.

To reproduce: open the attached testcase in Safari. Select the words "select and copy this sentence", 
choose Edit > Copy and then examine the clipboard contents.

Result: only "select " is copied to the clipboard.

The testcase also contains an example of how innerText returns only the text up to "select ".

Analysis: plainText() fails due to a bug in TextIterator::handleTextBox(), where the comment says 
"Determine what the next text box will be, but don't advance yet", in the RTL case it does advance. 
Combined with the sequence of newline and space, this causes the iterator to reach the end 
prematurely.
Comment 1 mitz 2005-12-10 03:17:00 PST
Created attachment 5015 [details]
testcase
Comment 2 mitz 2005-12-10 04:13:15 PST
Created attachment 5016 [details]
Advance m_sortedTextBoxes only when necessary
Comment 3 Darin Adler 2005-12-10 07:10:49 PST
Comment on attachment 5016 [details]
Advance m_sortedTextBoxes only when necessary

r=me