patch that fixes problem with my recent change to KHTMLPart::selectedText()

Darin Adler darin at apple.com
Sun Oct 26 22:30:15 CET 2003


My change to use a shared KHTMLPart::text(DOM::Range) function had one 
problem; the existing code didn't handle the case where the end node 
was not a text node. It was easy to fix, though.

-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2125
diff -p -u -u -p -r1.2125 ChangeLog
--- ChangeLog	2003/10/25 23:53:12	1.2125
+++ ChangeLog	2003/10/27 04:35:32
@@ -1 +1,11 @@
+2003-10-26  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+        - fixed 3457831 -- REGRESSION: copying particular text and pasting (plain) produces lots of extra text
+
+        * khtml/khtml_part.cpp: (KHTMLPart::text): Check for the end node when following a
+        link to the parent node, not just when following a link to the next child node.
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::attributedString): Ditto.
+
 == Rolled over to ChangeLog-2003-10-25 ==
Index: khtml/khtml_part.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.157
diff -p -u -u -p -r1.157 khtml/khtml_part.cpp
--- khtml/khtml_part.cpp	2003/10/14 15:36:09	1.157
+++ khtml/khtml_part.cpp	2003/10/27 04:35:35
@@ -2366,6 +2366,8 @@ QString KHTMLPart::text(const DOM::Range
       if(next.isNull()) next = n.nextSibling();
       while( next.isNull() && !n.parentNode().isNull() ) {
         n = n.parentNode();
+        if (n == endNode)
+            break;
         next = n.nextSibling();
         unsigned short id = n.elementId();
         switch(id) {
Index: kwq/KWQKHTMLPart.mm
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/kwq/KWQKHTMLPart.mm,v
retrieving revision 1.413
diff -p -u -u -p -r1.413 kwq/KWQKHTMLPart.mm
--- kwq/KWQKHTMLPart.mm	2003/10/23 02:03:57	1.413
+++ kwq/KWQKHTMLPart.mm	2003/10/27 04:35:37
@@ -2406,6 +2406,8 @@ NSAttributedString *KWQKHTMLPart::attrib
         while (next.isNull() && !n.parentNode().isNull()) {
             QString text;
             n = n.parentNode();
+            if (n == endNode)
+                break;
             next = n.nextSibling();
 
             unsigned short _id = n.elementId();
-------------- next part --------------


     -- Darin


More information about the Khtml-devel mailing list