[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:43:50 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit e668fafb9ab36f4145887147504815784ca284a6
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jun 4 18:35:45 2004 +0000

            Reviewed by Hyatt
    
            Fix a comical little bug where the style-applying code did not take into
            account deleting content from the start of a block. After the deletion,
            the caret is placed in the node before the deleted content and so
            inserting a styled fragment after the deletion position works great.
            The problem is that if the selectionis at the start of a block, there
            is no "position before the deletion" and the caret is placed in the new
            first child of the block. Inserting the styled content after this
            node is just plain wrong. Now, this case is handled correctly, and the
            styled content is inserted in the proper position.
    
            * khtml/editing/htmlediting_impl.cpp:
            (khtml::ApplyStyleCommandImpl::insertFragment):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6767 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 404ed9e..3ed32cf 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,23 @@
 
         Reviewed by Hyatt
 
+        Fix a comical little bug where the style-applying code did not take into
+        account deleting content from the start of a block. After the deletion, 
+        the caret is placed in the node before the deleted content and so 
+        inserting a styled fragment after the deletion position works great.
+        The problem is that if the selectionis at the start of a block, there
+        is no "position before the deletion" and the caret is placed in the new
+        first child of the block. Inserting the styled content after this 
+        node is just plain wrong. Now, this case is handled correctly, and the
+        styled content is inserted in the proper position.
+
+        * khtml/editing/htmlediting_impl.cpp:
+        (khtml::ApplyStyleCommandImpl::insertFragment):
+
+2004-06-04  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Hyatt
+
         * khtml/rendering/bidi.cpp:
         (khtml::RenderBlock::layoutInlineChildren): Only add additional line height
         in for root editable elements. This helps to keep layout from deviating too
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index 3fd19f3..b6943fb 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -1009,16 +1009,31 @@ void ApplyStyleCommandImpl::insertFragment(DocumentFragmentImpl *fragment, const
     ASSERT(fragment);
     ASSERT(pos.notEmpty());
 
-    NodeImpl *node = fragment->lastChild();
-    while (node) {
-        int exceptionCode = 0;
-        NodeImpl *prev = node->previousSibling();
-        node->ref();
-        fragment->removeChild(node, exceptionCode);
-        ASSERT(exceptionCode == 0);
-        insertNodeAfter(node, pos.node());
-        node->deref();
-        node = prev;
+    if (pos.node()->previousSibling()) {
+        NodeImpl *node = fragment->lastChild();
+        while (node) {
+            int exceptionCode = 0;
+            NodeImpl *prev = node->previousSibling();
+            node->ref();
+            fragment->removeChild(node, exceptionCode);
+            ASSERT(exceptionCode == 0);
+            insertNodeAfter(node, pos.node());
+            node->deref();
+            node = prev;
+        }
+    }
+    else {
+        NodeImpl *node = fragment->firstChild();
+        while (node) {
+            int exceptionCode = 0;
+            NodeImpl *next = node->nextSibling();
+            node->ref();
+            fragment->removeChild(node, exceptionCode);
+            ASSERT(exceptionCode == 0);
+            insertNodeBefore(node, pos.node());
+            node->deref();
+            node = next;
+        }
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list