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

eric at webkit.org eric at webkit.org
Thu Apr 8 02:12:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6e886cd36c3033171ddec40b715015c51c24b719
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Mar 6 07:28:29 2010 +0000

    2010-03-05  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=33247
            Backwards cursor movement incorrect when previous block ends with <br>.
    
            If the cursor is trying to move into a node that has a height of 0,
            skip over it.
    
            * editing/execCommand/move-selection-back-line-expected.txt: Added.
            * editing/execCommand/move-selection-back-line.html: Added.
    2010-03-05  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=33247
            Backwards cursor movement incorrect when previous block ends with <br>.
    
            If the cursor is trying to move into a node that has a height of 0,
            skip over it.
    
            Test: editing/execCommand/move-selection-back-line.html
    
            * editing/visible_units.cpp:
            (WebCore::previousLinePosition):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55613 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 370781b..334aa30 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-05  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=33247
+        Backwards cursor movement incorrect when previous block ends with <br>.
+
+        If the cursor is trying to move into a node that has a height of 0,
+        skip over it.
+
+        * editing/execCommand/move-selection-back-line-expected.txt: Added.
+        * editing/execCommand/move-selection-back-line.html: Added.
+
 2010-03-05  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/editing/execCommand/move-selection-back-line-expected.txt b/LayoutTests/editing/execCommand/move-selection-back-line-expected.txt
new file mode 100644
index 0000000..3588108
--- /dev/null
+++ b/LayoutTests/editing/execCommand/move-selection-back-line-expected.txt
@@ -0,0 +1,6 @@
+first line.. test test test test -[ ] test test test
+
+second line. Put your cursor here [ ] and press the up arrow. The cursor should appear in the green box on the first line
+
+PASS
+
diff --git a/LayoutTests/editing/execCommand/move-selection-back-line.html b/LayoutTests/editing/execCommand/move-selection-back-line.html
new file mode 100644
index 0000000..a8d5c10
--- /dev/null
+++ b/LayoutTests/editing/execCommand/move-selection-back-line.html
@@ -0,0 +1,17 @@
+<div contentEditable="true" style="font-family: monospace;">
+<p>first line.. test test test test -<span id="target" style="background-color:green">[ ]</span> test test test<br/></p>
+<p>second line. Put your cursor here [<span id="test"> </span>] and press the up arrow. The cursor should appear in the green box on the first line</p>
+</div>
+<div id="results">FAILED</div>
+<script src="../editing.js"></script>
+<script>
+function editingTest()
+{
+    execMoveSelectionBackwardByLineCommand();
+
+    // Verify that we ended up in "target".
+    if (window.getSelection().anchorNode.parentNode == document.getElementById("target"))
+        document.getElementById("results").innerText = "PASS";
+}
+runDumpAsTextEditingTest(false);
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f18fdef..8fdbd39 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-05  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=33247
+        Backwards cursor movement incorrect when previous block ends with <br>.
+
+        If the cursor is trying to move into a node that has a height of 0,
+        skip over it.
+
+        Test: editing/execCommand/move-selection-back-line.html
+
+        * editing/visible_units.cpp:
+        (WebCore::previousLinePosition):
+
 2010-03-05  Andrey Kosyakov  <caseq at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp
index 7040229..3d85ad1 100644
--- a/WebCore/editing/visible_units.cpp
+++ b/WebCore/editing/visible_units.cpp
@@ -31,6 +31,7 @@
 #include "HTMLNames.h"
 #include "RenderBlock.h"
 #include "RenderLayer.h"
+#include "RenderObject.h"
 #include "TextBoundaries.h"
 #include "TextBreakIterator.h"
 #include "TextIterator.h"
@@ -253,6 +254,12 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
     return VisiblePosition(pos, VP_UPSTREAM_IF_POSSIBLE);
 }
 
+static bool canHaveCursor(RenderObject* o)
+{
+    return (o->isText() && toRenderText(o)->linesBoundingBox().height())
+        || (o->isBox() && toRenderBox(o)->borderBoundingBox().height());
+}
+
 // ---------
 
 static unsigned startWordBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool& needMoreContext)
@@ -590,17 +597,20 @@ VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int
                 break;
             Position pos(n, caretMinOffset(n));
             if (pos.isCandidate()) {
-                ASSERT(n->renderer());
-                Position maxPos(n, caretMaxOffset(n));
-                maxPos.getInlineBoxAndOffset(DOWNSTREAM, box, ignoredCaretOffset);
-                if (box) {
-                    // previous root line box found
-                    root = box->root();
-                    containingBlock = n->renderer()->containingBlock();
-                    break;
+                RenderObject* o = n->renderer();
+                ASSERT(o);
+                if (canHaveCursor(o)) {
+                    Position maxPos(n, caretMaxOffset(n));
+                    maxPos.getInlineBoxAndOffset(DOWNSTREAM, box, ignoredCaretOffset);
+                    if (box) {
+                        // previous root line box found
+                        root = box->root();
+                        containingBlock = n->renderer()->containingBlock();
+                        break;
+                    }
+
+                    return VisiblePosition(pos, DOWNSTREAM);
                 }
-
-                return VisiblePosition(pos, DOWNSTREAM);
             }
             n = previousLeafWithSameEditability(n);
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list