[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mitz at apple.com mitz at apple.com
Wed Dec 22 13:37:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f7808963786d5ed6b69812b8e462769d76903923
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 00:13:37 2010 +0000

    <rdar://problem/7729077> Extending the selection to sentence boundary after a line break may select extra character
    https://bugs.webkit.org/show_bug.cgi?id=46232
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    Test: editing/selection/extend-by-sentence-002.html
    
    * editing/visible_units.cpp:
    (WebCore::nextBoundary): The text iterator’s range end can be the position after
    the line break, in which case the next visible is actually after the first character
    of the next sentence. Instead, advance the text iterator past the newline character
    and return the beginning of its range, which is guaranteed to still be before the
    next sentence.
    
    LayoutTests:
    
    * editing/selection/extend-by-sentence-002-expected.txt: Added.
    * editing/selection/extend-by-sentence-002.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67994 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 758f731..6695424 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-21  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7729077> Extending the selection to sentence boundary after a line break may select extra character
+        https://bugs.webkit.org/show_bug.cgi?id=46232
+
+        * editing/selection/extend-by-sentence-002-expected.txt: Added.
+        * editing/selection/extend-by-sentence-002.html: Added.
+
 2010-09-21  Chris Guillory   <chris.guillory at google.com>
 
         Reviewed by Chris Fleizach.
diff --git a/LayoutTests/editing/selection/extend-by-sentence-002-expected.txt b/LayoutTests/editing/selection/extend-by-sentence-002-expected.txt
new file mode 100644
index 0000000..1ba316c
--- /dev/null
+++ b/LayoutTests/editing/selection/extend-by-sentence-002-expected.txt
@@ -0,0 +1,3 @@
+All of this should be selected
+None of this should be selected.
+PASS
diff --git a/LayoutTests/editing/selection/extend-by-sentence-002.html b/LayoutTests/editing/selection/extend-by-sentence-002.html
new file mode 100644
index 0000000..206f927
--- /dev/null
+++ b/LayoutTests/editing/selection/extend-by-sentence-002.html
@@ -0,0 +1,20 @@
+<div id="target">All of this should be selected</div><div>None of this should be selected.</div>
+<p id="result"></p>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var target = document.getElementById("target");
+    var result = document.getElementById("result");
+    var sel = getSelection();
+    sel.setBaseAndExtent(target, 0, target, 1);
+    sel.modify("extend", "forward", "sentence");
+    var selectedRange = sel.getRangeAt(0);
+
+    if (selectedRange.startContainer === target.firstChild && selectedRange.startOffset === 0
+        && selectedRange.endContainer === target.nextSibling && selectedRange.endOffset === 0) {
+        result.innerText = "PASS";
+    } else {
+        result.innerText = "FAIL: Selected range is '" + selectedRange + "'";
+    }
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 421d09c..6595a15 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-21  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7729077> Extending the selection to sentence boundary after a line break may select extra character
+        https://bugs.webkit.org/show_bug.cgi?id=46232
+
+        Test: editing/selection/extend-by-sentence-002.html
+
+        * editing/visible_units.cpp:
+        (WebCore::nextBoundary): The text iterator’s range end can be the position after
+        the line break, in which case the next visible is actually after the first character
+        of the next sentence. Instead, advance the text iterator past the newline character
+        and return the beginning of its range, which is guaranteed to still be before the
+        next sentence.
+
 2010-09-21  Robert Hogan  <robert at webkit.org>
 
         Rubber-stamped by Ariya Hidayat.
diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp
index f84fec0..975caf2 100644
--- a/WebCore/editing/visible_units.cpp
+++ b/WebCore/editing/visible_units.cpp
@@ -222,13 +222,16 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
         // Use the character iterator to translate the next value into a DOM position.
         CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
         charIt.advance(next - prefixLength - 1);
-        pos = charIt.range()->endPosition();
+        RefPtr<Range> characterRange = charIt.range();
+        pos = characterRange->endPosition();
         
         if (*charIt.characters() == '\n') {
             // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines (see rdar://5192593)
             VisiblePosition visPos = VisiblePosition(pos);
-            if (visPos == VisiblePosition(charIt.range()->startPosition()))
-                pos = visPos.next(true).deepEquivalent();
+            if (visPos == VisiblePosition(characterRange->startPosition())) {
+                charIt.advance(1);
+                pos = charIt.range()->startPosition();
+            }
         }
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list