[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:08:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 68a7ec741ea5c79e0de041c907bd23fe928766c4
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 1 00:31:43 2003 +0000

            Reviewed by Ken.
    
            - fixed 3469383 -- REGRESSION (100-111): if one line is selected on this page, too much gets copied (plain text)
    
            * khtml/khtml_part.cpp: (KHTMLPart::text): Range check the child node indices before using them
            to get at a child node. We don't want to set startNode or endNode to nil in any case. If the end
            node is set to nil, we end up copying the entire remainder of the page.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5347 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3bb75a9..93e2c68 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2003-10-31  Darin Adler  <darin at apple.com>
+
+        Reviewed by Ken.
+
+        - fixed 3469383 -- REGRESSION (100-111): if one line is selected on this page, too much gets copied (plain text)
+
+        * khtml/khtml_part.cpp: (KHTMLPart::text): Range check the child node indices before using them
+        to get at a child node. We don't want to set startNode or endNode to nil in any case. If the end
+        node is set to nil, we end up copying the entire remainder of the page.
+
 2003-10-31  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3470007, links don't get focus on mouse down.  Fix the focus check on mouse down to actually
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 0c42832..dca83f9 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -2257,13 +2257,17 @@ QString KHTMLPart::text(const DOM::Range &r) const
   DOM::Node endNode = r.endContainer();
   int startOffset = r.startOffset();
   int endOffset = r.endOffset();
-  if (!startNode.isNull() && startNode.nodeType() == DOM::Node::ELEMENT_NODE) {
-      startOffset = -1;
-      startNode = !startNode.childNodes().isNull() ? startNode.childNodes().item(r.startOffset()) : Node();
+  if (!startNode.isNull() && startNode.nodeType() == Node::ELEMENT_NODE) {
+      if (startOffset >= 0 && startOffset < (int)startNode.childNodes().length()) {
+          startNode = startNode.childNodes().item(r.startOffset());
+          startOffset = -1;
+      }
   }
-  if (!endNode.isNull() && endNode.nodeType() == DOM::Node::ELEMENT_NODE) {
-      endOffset = -1;
-      endNode = !endNode.childNodes().isNull() ? endNode.childNodes().item(r.endOffset()-1) : Node();
+  if (!endNode.isNull() && endNode.nodeType() == Node::ELEMENT_NODE) {
+      if (endOffset > 0 && endOffset <= (int)endNode.childNodes().length()) {
+          endNode = endNode.childNodes().item(endOffset - 1);
+          endOffset = -1;
+      }
   }
 
   DOM::Node n = startNode;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list