[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Sun Feb 20 23:49:41 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 8043268f8ef356cd80e3d7297b7550f39d14a307
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 25 18:42:43 2011 +0000

    2011-01-25  Benjamin Kalman  <kalman at chromium.org>
    
            Reviewed by Ryosuke Niwa.
    
            Cannot extend or modify forward by word over a non-contenteditable region
            https://bugs.webkit.org/show_bug.cgi?id=53070
    
            Add regression test.
    
            * editing/selection/extend-forward-by-word-over-non-editable-expected.txt: Added.
            * editing/selection/extend-forward-by-word-over-non-editable.html: Added.
    2011-01-25  Benjamin Kalman  <kalman at chromium.org>
    
            Reviewed by Ryosuke Niwa.
    
            Cannot extend or modify forward by word over a non-contenteditable region
            https://bugs.webkit.org/show_bug.cgi?id=53070
    
            Test: editing/selection/extend-forward-by-word-over-non-editable.html
    
            Change all instances of honorEditableBoundaryAtOrAfter to honorEditableBoundaryAtOrBefore and vice versa in the
            functions which determine the end/start of words/lines/sentences in visible_units.cpp.
    
            This fixes the bug where moving forwards by a word over a non-contenteditable region would place the cursor
            inside that region, and then get moved back to the start of the word due to honorEditableBoundaryAtOrBefore.
            The cursor is now moved to the end of the region (which is effectively a noop in this case).
    
            * editing/visible_units.cpp: Change all instances of honorEditableBoundaryAtOrAfter to
            honorEditableBoundaryAtOrBefore and vice versa.
            (WebCore::previousWordPosition):
            (WebCore::nextWordPosition):
            (WebCore::startOfLine):
            (WebCore::endOfLine):
            (WebCore::previousSentencePosition):
            (WebCore::nextSentencePosition):
            (WebCore::logicalStartOfLine):
            (WebCore::logicalEndOfLine):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76610 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ded1d5a..15fd981 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-25  Benjamin Kalman  <kalman at chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Cannot extend or modify forward by word over a non-contenteditable region
+        https://bugs.webkit.org/show_bug.cgi?id=53070
+
+        Add regression test.
+
+        * editing/selection/extend-forward-by-word-over-non-editable-expected.txt: Added.
+        * editing/selection/extend-forward-by-word-over-non-editable.html: Added.
+
 2011-01-25  Ryosuke Niwa  <rniwa at webkit.org>
 
         Unreviewed SVG rebaselines for Chromium.
diff --git a/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable-expected.txt b/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable-expected.txt
new file mode 100644
index 0000000..a9dfa9c
--- /dev/null
+++ b/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable-expected.txt
@@ -0,0 +1,8 @@
+PASS for LTR
+PASS for RTL
+PASS for LTR-multi
+PASS for RTL-multi
+foo bar baz qux quux
+שוּרה שוּרה שוּרה שוּרה שוּרה
+foo bar baz baz baz qux quux
+שוּרה שוּרה שוּרה שוּרה שוּרה שוּרה שוּרה
diff --git a/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable.html b/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable.html
new file mode 100644
index 0000000..5ef0aae
--- /dev/null
+++ b/LayoutTests/editing/selection/extend-forward-by-word-over-non-editable.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<pre id="log"></pre>
+
+<div id="ltrTextContainer" contenteditable>foo bar <span contenteditable=false>baz</span> qux quux</div>
+<div id="rtlTextContainer" contenteditable dir="rtl">&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;
+<span contenteditable=false>&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;</span>
+&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;</div>
+
+<div id="ltrMultiTextContainer" contenteditable>foo bar <span contenteditable=false>baz baz baz</span> qux quux</div>
+<div id="rtlMultiTextContainer" contenteditable dir="rtl">&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;
+<span contenteditable=false>&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;</span>
+&#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4; &#x05E9;&#x05D5;&#x05BC;&#x05E8;&#x05D4;</div>
+
+<script>
+function log(s) {
+  document.getElementById("log").appendChild(document.createTextNode(s + "\n"));
+}
+
+function placeCursorBeforeFirstNoneditableChild(container) {
+  for (var i = 0; i < container.childNodes.length; i++) {
+    var node = container.childNodes[i];
+    if (node.isContentEditable !== undefined && !node.isContentEditable) {
+      var previous = node.previousSibling;
+      getSelection().setPosition(previous, previous.textContent.length);
+      return node;
+    }
+  }
+  throw "Couldn't find noneditable child of " + container.textContent;
+}
+
+function extendForwardByWord(container, bidiName) {
+  noneditableChild = placeCursorBeforeFirstNoneditableChild(container);
+  getSelection().modify("extend", "forward", "word");
+  if (getSelection().toString() === noneditableChild.textContent)
+    log("PASS for " + bidiName);
+  else
+    log("FAIL for " + bidiName + ", selection is \"" + getSelection() + "\" but should be \"" + noneditableChild.textContent + "\"");
+}
+
+extendForwardByWord(document.getElementById("ltrTextContainer"), "LTR");
+extendForwardByWord(document.getElementById("rtlTextContainer"), "RTL");
+extendForwardByWord(document.getElementById("ltrMultiTextContainer"), "LTR-multi");
+extendForwardByWord(document.getElementById("rtlMultiTextContainer"), "RTL-multi");
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f3df520..bb2c9c4 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2011-01-25  Benjamin Kalman  <kalman at chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Cannot extend or modify forward by word over a non-contenteditable region
+        https://bugs.webkit.org/show_bug.cgi?id=53070
+
+        Test: editing/selection/extend-forward-by-word-over-non-editable.html
+
+        Change all instances of honorEditableBoundaryAtOrAfter to honorEditableBoundaryAtOrBefore and vice versa in the
+        functions which determine the end/start of words/lines/sentences in visible_units.cpp.
+
+        This fixes the bug where moving forwards by a word over a non-contenteditable region would place the cursor
+        inside that region, and then get moved back to the start of the word due to honorEditableBoundaryAtOrBefore.
+        The cursor is now moved to the end of the region (which is effectively a noop in this case).
+
+        * editing/visible_units.cpp: Change all instances of honorEditableBoundaryAtOrAfter to
+        honorEditableBoundaryAtOrBefore and vice versa.
+        (WebCore::previousWordPosition):
+        (WebCore::nextWordPosition):
+        (WebCore::startOfLine):
+        (WebCore::endOfLine):
+        (WebCore::previousSentencePosition):
+        (WebCore::nextSentencePosition):
+        (WebCore::logicalStartOfLine):
+        (WebCore::logicalEndOfLine):
+
 2011-01-25  Yael Aharon  <yael.aharon at nokia.com>
 
         Unreviewed build fix.
diff --git a/Source/WebCore/editing/visible_units.cpp b/Source/WebCore/editing/visible_units.cpp
index f59d5c8..33d76ec 100644
--- a/Source/WebCore/editing/visible_units.cpp
+++ b/Source/WebCore/editing/visible_units.cpp
@@ -292,7 +292,7 @@ static unsigned previousWordPositionBoundary(const UChar* characters, unsigned l
 VisiblePosition previousWordPosition(const VisiblePosition &c)
 {
     VisiblePosition prev = previousBoundary(c, previousWordPositionBoundary);
-    return c.honorEditableBoundaryAtOrAfter(prev);
+    return c.honorEditableBoundaryAtOrBefore(prev);
 }
 
 static unsigned nextWordPositionBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool& needMoreContext)
@@ -308,7 +308,7 @@ static unsigned nextWordPositionBoundary(const UChar* characters, unsigned lengt
 VisiblePosition nextWordPosition(const VisiblePosition &c)
 {
     VisiblePosition next = nextBoundary(c, nextWordPositionBoundary);    
-    return c.honorEditableBoundaryAtOrBefore(next);
+    return c.honorEditableBoundaryAtOrAfter(next);
 }
 
 // ---------
@@ -391,7 +391,7 @@ VisiblePosition startOfLine(const VisiblePosition& c)
 {
     VisiblePosition visPos = startPositionForLine(c);
 
-    return c.honorEditableBoundaryAtOrAfter(visPos);
+    return c.honorEditableBoundaryAtOrBefore(visPos);
 }
 
 static VisiblePosition endPositionForLine(const VisiblePosition& c)
@@ -458,7 +458,7 @@ VisiblePosition endOfLine(const VisiblePosition& c)
         visPos = endPositionForLine(visPos);
     }
     
-    return c.honorEditableBoundaryAtOrBefore(visPos);
+    return c.honorEditableBoundaryAtOrAfter(visPos);
 }
 
 bool inSameLine(const VisiblePosition &a, const VisiblePosition &b)
@@ -720,7 +720,7 @@ static unsigned previousSentencePositionBoundary(const UChar* characters, unsign
 VisiblePosition previousSentencePosition(const VisiblePosition &c)
 {
     VisiblePosition prev = previousBoundary(c, previousSentencePositionBoundary);
-    return c.honorEditableBoundaryAtOrAfter(prev);
+    return c.honorEditableBoundaryAtOrBefore(prev);
 }
 
 static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
@@ -734,7 +734,7 @@ static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned l
 VisiblePosition nextSentencePosition(const VisiblePosition &c)
 {
     VisiblePosition next = nextBoundary(c, nextSentencePositionBoundary);    
-    return c.honorEditableBoundaryAtOrBefore(next);
+    return c.honorEditableBoundaryAtOrAfter(next);
 }
 
 VisiblePosition startOfParagraph(const VisiblePosition& c, EditingBoundaryCrossingRule boundaryCrossingRule)
@@ -1133,7 +1133,7 @@ VisiblePosition logicalStartOfLine(const VisiblePosition& c)
     // Please refer to https://bugs.webkit.org/show_bug.cgi?id=49107 for detail.
     VisiblePosition visPos = logicalStartPositionForLine(c);
     
-    return c.honorEditableBoundaryAtOrAfter(visPos);
+    return c.honorEditableBoundaryAtOrBefore(visPos);
 }
 
 static VisiblePosition logicalEndPositionForLine(const VisiblePosition& c)
@@ -1190,7 +1190,7 @@ VisiblePosition logicalEndOfLine(const VisiblePosition& c)
     if (!inSameLogicalLine(c, visPos))
         visPos = visPos.previous();
     
-    return c.honorEditableBoundaryAtOrBefore(visPos);
+    return c.honorEditableBoundaryAtOrAfter(visPos);
 }
 
 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direction)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list