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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:51:37 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit dfcbd2965b0dbf04c8a3f20389ee040f49376b8d
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 20 18:06:24 2004 +0000

            Reviewed by Darin
    
            Fix for this bug:
    
            <rdar://problem/3695240> pasting plain text with newlines in it turns them into spaces
    
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge documentFragmentWithText:]): Refine this function to be smart about converting
            line endings into BR elements.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7062 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 00b1e5a..75edb49 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,17 @@
 2004-07-20  Ken Kocienda  <kocienda at apple.com>
 
+        Reviewed by Darin
+
+        Fix for this bug:
+        
+        <rdar://problem/3695240> pasting plain text with newlines in it turns them into spaces
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge documentFragmentWithText:]): Refine this function to be smart about converting
+        line endings into BR elements.
+
+2004-07-20  Ken Kocienda  <kocienda at apple.com>
+
         Reviewed by Hyatt
 
         Fix for this bug:
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 2c9ddd0..321c496 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1437,7 +1437,17 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
 {
     DOMDocument *document = [self DOMDocument];
     DOMDocumentFragment *fragment = [document createDocumentFragment];
-    [fragment appendChild:[document createTextNode:text]];
+    NSMutableString *string = [text mutableCopy];
+    [string replaceOccurrencesOfString:@"\r\n" withString:@"\n" options:0 range:NSMakeRange(0, [string length])];
+    [string replaceOccurrencesOfString:@"\r" withString:@"\n" options:0 range:NSMakeRange(0, [string length])];
+    NSArray *array = [string componentsSeparatedByString:@"\n"];
+    int count = [array count];
+    int i;
+    for (i = 0; i < count; i++) {
+        if (i != 0)
+            [fragment appendChild:[document createElement:@"BR"]];
+        [fragment appendChild:[document createTextNode:[array objectAtIndex:i]]];
+    }
     return fragment;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list