--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 5 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+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 784x584
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 774x18
+ text run at (0,0) width 774: "These tests to see if bidi text with a base writing direction of right to left is put onto the paste board in logical (DOM) order."
+ RenderBlock {DIV} at (0,34) size 784x18
+ RenderText {#text} at (712,0) size 72x18
+ text run at (712,0) width 40 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}:"
+ text run at (752,0) width 32: "1234"
+ RenderBlock {DIV} at (0,52) size 784x36
+ RenderBlock {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 72x18
+ text run at (0,0) width 32: "1234"
+ text run at (32,0) width 36 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}"
+ text run at (68,0) width 4: ":"
+ RenderBlock {DIV} at (0,18) size 784x18
+ RenderText {#text} at (712,0) size 72x18
+ text run at (712,0) width 40 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}:"
+ text run at (752,0) width 32: "1234"
+caret: position 9 of child 0 {#text} of child 2 {DIV} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document
#include "Range.h"
#include "htmlediting.h"
#include "visible_units.h"
+#include "TextIterator.h"
using namespace std;
static DeprecatedString renderedText(const Node *node, const Range *range)
{
- RenderObject *r = node->renderer();
- if (!r)
- return DeprecatedString();
-
if (!node->isTextNode())
return DeprecatedString();
- DeprecatedString result = "";
-
ExceptionCode ec;
- const Text *textNode = static_cast<const Text*>(node);
+ const Text* textNode = static_cast<const Text*>(node);
unsigned startOffset = 0;
unsigned endOffset = textNode->length();
if (range && node == range->endContainer(ec))
endOffset = range->endOffset(ec);
- RenderText *textRenderer = static_cast<RenderText*>(r);
- DeprecatedString str = node->nodeValue().deprecatedString();
- for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
- unsigned start = box->m_start;
- unsigned end = box->m_start + box->m_len;
- if (endOffset < start)
- break;
- if (startOffset <= end) {
- unsigned s = max(start, startOffset);
- unsigned e = min(end, endOffset);
- result.append(str.mid(s, e-s));
- if (e == end) {
- // now add in collapsed-away spaces if at the end of the line
- InlineTextBox *nextBox = box->nextTextBox();
- if (nextBox && box->root() != nextBox->root()) {
- const char nonBreakingSpace = '\xa0';
- // count the number of characters between the end of the
- // current box and the start of the next box.
- int collapsedStart = e;
- int collapsedPastEnd = min((unsigned)nextBox->m_start, endOffset + 1);
- bool addNextNonNBSP = true;
- for (int i = collapsedStart; i < collapsedPastEnd; i++) {
- if (str[i] == nonBreakingSpace) {
- result.append(str[i]);
- addNextNonNBSP = true;
- }
- else if (addNextNonNBSP) {
- result.append(str[i]);
- addNextNonNBSP = false;
- }
- }
- }
- }
- }
-
- }
-
- return result;
+ Position start(const_cast<Node*>(node), startOffset);
+ Position end(const_cast<Node*>(node), endOffset);
+ Range r(node->document(), start, end);
+ return plainText(&r);
}
static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnotateForInterchange annotate, CSSMutableStyleDeclaration *defaultStyle)