[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

tony at chromium.org tony at chromium.org
Thu Apr 8 02:16:03 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d3821d5892072878d40fa3a81f1b8bb6ffd09f23
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 9 04:32:08 2010 +0000

    2010-03-08  Tony Chang  <tony at chromium.org>
    
            Reviewed by Adam Barth.
    
            https://bugs.webkit.org/show_bug.cgi?id=32131
            Work around a crash when inserting an ordered list.  This was caused
            by incorrect logic when trying to restore a range from a location.
            We compute the offset using TextIterator, but were sometimes using
            VisiblePosition::next() to iterate instead.
    
            * editing/execCommand/insert-ordered-list-expected.txt: Added.
            * editing/execCommand/insert-ordered-list.html: Added.
    2010-03-08  Tony Chang  <tony at chromium.org>
    
            Reviewed by Adam Barth.
    
            https://bugs.webkit.org/show_bug.cgi?id=32131
            Crash when inserting an ordered list.
    
            Test: editing/execCommand/insert-ordered-list.html
    
            * editing/CompositeEditCommand.cpp:
            (WebCore::CompositeEditCommand::moveParagraphs):
            * editing/TextIterator.cpp:
            (WebCore::TextIterator::rangeFromLocationAndLength):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index aefef2c..67f71a7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-08  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32131
+        Work around a crash when inserting an ordered list.  This was caused
+        by incorrect logic when trying to restore a range from a location.
+        We compute the offset using TextIterator, but were sometimes using
+        VisiblePosition::next() to iterate instead.
+
+        * editing/execCommand/insert-ordered-list-expected.txt: Added.
+        * editing/execCommand/insert-ordered-list.html: Added.
+
 2010-03-08  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/LayoutTests/editing/execCommand/insert-ordered-list-expected.txt b/LayoutTests/editing/execCommand/insert-ordered-list-expected.txt
new file mode 100644
index 0000000..7997d03
--- /dev/null
+++ b/LayoutTests/editing/execCommand/insert-ordered-list-expected.txt
@@ -0,0 +1,3 @@
+SUCCESS
+text
+
diff --git a/LayoutTests/editing/execCommand/insert-ordered-list.html b/LayoutTests/editing/execCommand/insert-ordered-list.html
new file mode 100644
index 0000000..5755b5f
--- /dev/null
+++ b/LayoutTests/editing/execCommand/insert-ordered-list.html
@@ -0,0 +1,23 @@
+<BODY contentEditable="true">
+<u>
+  <img><br>
+  <div>
+  <ul>
+    <li>
+      <span><u>
+        <div style="text-align:right; display: inline;">
+          <span><u>text</u></span>
+        </div>
+      </u></span>
+    </li>
+  </ul>
+  </div>
+</u>
+</BODY>
+<SCRIPT>
+  if (window.layoutTestController)
+      layoutTestController.dumpAsText();
+  document.execCommand("selectall");
+  document.execCommand("insertorderedlist");
+  document.getElementsByTagName('u')[0].innerHTML = 'SUCCESS';
+</SCRIPT>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4effbb6..d4c8f84 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-03-08  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32131
+        Crash when inserting an ordered list.
+
+        Test: editing/execCommand/insert-ordered-list.html
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::moveParagraphs):
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::rangeFromLocationAndLength):
+
 2010-03-08  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp
index e9b6971..fff76a6 100644
--- a/WebCore/editing/CompositeEditCommand.cpp
+++ b/WebCore/editing/CompositeEditCommand.cpp
@@ -950,6 +950,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
     ASSERT(destination.deepEquivalent().node()->inDocument());
 
     cleanupAfterDeletion();
+    ASSERT(destination.deepEquivalent().node()->inDocument());
 
     // Add a br if pruning an empty block level element caused a collapse. For example:
     // foo^
@@ -971,6 +972,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
     destinationIndex = TextIterator::rangeLength(startToDestinationRange.get(), true);
     
     setEndingSelection(destination);
+    ASSERT(endingSelection().isCaretOrRange());
     applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, true, false, !preserveStyle, false, true));
     
     // If the selection is in an empty paragraph, restore styles from the old empty paragraph to the new empty paragraph.
diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp
index 923f537..a386c6e 100644
--- a/WebCore/editing/TextIterator.cpp
+++ b/WebCore/editing/TextIterator.cpp
@@ -2037,16 +2037,25 @@ PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(Element* scope, int r
         
         // Fix textRunRange->endPosition(), but only if foundStart || foundEnd, because it is only
         // in those cases that textRunRange is used.
-        if (foundStart || foundEnd) {
+        if (foundEnd) {
             // FIXME: This is a workaround for the fact that the end of a run is often at the wrong
             // position for emitted '\n's.
             if (len == 1 && it.characters()[0] == '\n') {
-                Position runStart = textRunRange->startPosition();
-                Position runEnd = VisiblePosition(runStart).next().deepEquivalent();
-                if (runEnd.isNotNull()) {
+                scope->document()->updateLayoutIgnorePendingStylesheets();
+                it.advance();
+                if (!it.atEnd()) {
+                    RefPtr<Range> range = it.range();
                     ExceptionCode ec = 0;
-                    textRunRange->setEnd(runEnd.node(), runEnd.deprecatedEditingOffset(), ec);
+                    textRunRange->setEnd(range->startContainer(), range->startOffset(), ec);
                     ASSERT(!ec);
+                } else {
+                    Position runStart = textRunRange->startPosition();
+                    Position runEnd = VisiblePosition(runStart).next().deepEquivalent();
+                    if (runEnd.isNotNull()) {
+                        ExceptionCode ec = 0;
+                        textRunRange->setEnd(runEnd.node(), runEnd.deprecatedEditingOffset(), ec);
+                        ASSERT(!ec);
+                    }
                 }
             }
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list