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

rniwa at webkit.org rniwa at webkit.org
Wed Dec 22 11:25:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b80dbaa85b65a738ef28c776f37031531dd1d66e
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 22 22:55:21 2010 +0000

    [Windows] Home hey doesn't work in first DIV inside a TABLE
    https://bugs.webkit.org/show_bug.cgi?id=42767
    
    Reviewed by Ojan Vafai.
    
    WebCore:
    
    The bug was caused by positionAvoidingFirstPositionInTable moving outside of the editing region.
    Added a check so that it avoids the first position in the table only if the table is editable.
    
    Test: editing/selection/home-inside-noneditable-table.html
    
    * editing/visible_units.cpp:
    (WebCore::positionAvoidingFirstPositionInTable):
    
    LayoutTests:
    
    Added a test to move caret backwards to the line boundary inside a content-editable div
    inside a non-editable table.
    
    * editing/selection/home-inside-noneditable-table-expected.txt: Added.
    * editing/selection/home-inside-noneditable-table.html: Added.
    * resources/dump-as-markup.js: Modified to support multiple calls to dump
    (Markup.dump.get if):
    (Markup.dump):
    (Markup.notifyDone):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dbe5e6a..a281ca8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-22  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Ojan Vafai.
+
+        [Windows] Home hey doesn't work in first DIV inside a TABLE
+        https://bugs.webkit.org/show_bug.cgi?id=42767
+
+        Added a test to move caret backwards to the line boundary inside a content-editable div
+        inside a non-editable table.
+
+        * editing/selection/home-inside-noneditable-table-expected.txt: Added.
+        * editing/selection/home-inside-noneditable-table.html: Added.
+        * resources/dump-as-markup.js: Modified to support multiple calls to dump
+        (Markup.dump.get if):
+        (Markup.dump):
+        (Markup.notifyDone):
+
 2010-07-22  Dumitru Daniliuc  <dumi at chromium.org>
 
         Reviewed by Ojan Vafai.
diff --git a/LayoutTests/editing/selection/home-inside-noneditable-table-expected.txt b/LayoutTests/editing/selection/home-inside-noneditable-table-expected.txt
new file mode 100644
index 0000000..9a0a4f2
--- /dev/null
+++ b/LayoutTests/editing/selection/home-inside-noneditable-table-expected.txt
@@ -0,0 +1,33 @@
+Tests whether home moves the caret to the beginning of line inside a content-editable in an uneditable table.
+
+Dump of markup 1:
+<DIV id="test" contentEditable="true">
+<#text>
+</#text>
+<DIV id="l1">
+<#text>The caret is initially <selection-caret>here but should move to the beginning of the line.</#text>
+</DIV>
+<#text>
+</#text>
+<DIV>
+<#text>dummy text</#text>
+</DIV>
+<#text>
+</#text>
+</DIV>
+
+Dump of markup 2:
+<DIV id="test" contentEditable="true">
+<#text>
+</#text>
+<DIV id="l1">
+<#text><selection-caret>The caret is initially here but should move to the beginning of the line.</#text>
+</DIV>
+<#text>
+</#text>
+<DIV>
+<#text>dummy text</#text>
+</DIV>
+<#text>
+</#text>
+</DIV>
diff --git a/LayoutTests/editing/selection/home-inside-noneditable-table.html b/LayoutTests/editing/selection/home-inside-noneditable-table.html
new file mode 100644
index 0000000..d873938
--- /dev/null
+++ b/LayoutTests/editing/selection/home-inside-noneditable-table.html
@@ -0,0 +1,23 @@
+<script src="../../resources/dump-as-markup.js"></script>
+<table>
+  <tr>
+    <td>
+    <div id="test" contenteditable="true">
+      <div id="l1">The caret is initially here but should move to the beginning of the line.</div>
+      <div>dummy text</div>
+    </div>
+    </td>
+  </tr>
+</table>
+<script>
+
+Markup.description("Tests whether home moves the caret to the beginning of line inside a content-editable in an uneditable table.")
+Markup.setNodeToDump('test');
+
+var s = window.getSelection();
+s.setPosition(document.getElementById('l1').firstChild, 23);
+Markup.dump();
+s.modify("move", "backward", "lineboundary");
+Markup.dump();
+
+</script>
diff --git a/LayoutTests/resources/dump-as-markup.js b/LayoutTests/resources/dump-as-markup.js
index 53a8504..916faa2 100644
--- a/LayoutTests/resources/dump-as-markup.js
+++ b/LayoutTests/resources/dump-as-markup.js
@@ -10,12 +10,10 @@
  *    it dumps the content of the specified element as supposed to the entire DOM tree.
  *
  * 3. Dump the content of a specific element multiple times while the page is loading
- *    Calling Markup.dump would dump the content of the specified element or the entire DOM.
- *    On the page load, it dumps the content of the current node (set by setNodeToDump)
- *    or the entire DOM if the node was never set.
+ *    Calling Markup.dump would dump the content of the element set by setNodeToDump or the entire DOM.
+ *    Optionally specify the node to dump and the description for each call of dump.
  */
 
-
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
     layoutTestController.waitUntilDone();
@@ -27,29 +25,41 @@ var Markup = {};
 // The description of what this test is testing. Gets prepended to the dumped markup.
 Markup.description = function(description)
 {
-    Markup._description = description;
+    Markup._test_description = description;
 }
 
 // Dumps the markup for the given node (HTML element if no node is given).
 // Over-writes the body's content with the markup in layout test mode. Appends
 // a pre element when loaded manually, in order to aid debugging.
-Markup.dump = function(opt_node)
+Markup.dump = function(opt_node, opt_description)
 {
+    if (typeof opt_node == 'string')
+        opt_node = document.getElementById(opt_node);
+
     var node = opt_node || Markup._node || document.body.parentElement
+    var markup = "";
+
+    if (Markup._test_description && !Markup._dumpCalls)
+        markup += Markup._test_description + '\n';
+
+    Markup._dumpCalls++;
+
+    // If dump is not called by notifyDone, then print out optional description
+    // because this test is manually calling dump.
+    if (!Markup._done || opt_description) {
+        if (!opt_description)
+            opt_description = "Dump of markup " + Markup._dumpCalls
+        if (Markup._dumpCalls > 1)
+            markup += '\n';
+        markup += '\n' + opt_description + ':';
+    }
 
-    var markup = Markup._description ? Markup._description + '\n' : "";
     markup += Markup.get(node);
 
-    var container;
-    if (window.layoutTestController)
-        container = document.body;
-    else {
-        // In non-layout test mode, append the results in a pre so that we don't
-        // clobber the test itself. But when in layout test mode, we don't want
-        // side effects from the test to be included in the results.
-        container = document.createElement('pre');
-        container.style.cssText = 'width:100%';
-        document.body.appendChild(container);
+    if (!Markup._container) {
+        Markup._container = document.createElement('pre');
+        Markup._container.style.width = '100%';
+        document.body.appendChild(Markup._container);
     }
 
     // FIXME: Have this respect layoutTestController.dumpChildFramesAsText?
@@ -64,7 +74,7 @@ Markup.dump = function(opt_node)
         }
     }
 
-    container.innerText = markup;
+    Markup._container.innerText += markup;
 }
 
 Markup.waitUntilDone = function()
@@ -74,7 +84,17 @@ Markup.waitUntilDone = function()
 
 Markup.notifyDone = function()
 {
-    Markup.dump();
+    Markup._done = true;
+
+    // If dump has already been called, don't bother to dump again
+    if (!Markup._dumpCalls)
+        Markup.dump();
+
+    // In non-layout test mode, append the results in a pre so that we don't
+    // clobber the test itself. But when in layout test mode, we don't want
+    // side effects from the test to be included in the results.
+    if (window.layoutTestController)
+        document.body.innerText = Markup._container.innerText;
 
     if (window.layoutTestController)
         layoutTestController.notifyDone();
@@ -82,9 +102,9 @@ Markup.notifyDone = function()
 
 Markup.setNodeToDump = function(node)
 {
-  if (typeof node == "string")
-    node = document.getElementById(node);
-  Markup._node = node
+    if (typeof node == "string")
+        node = document.getElementById(node);
+    Markup._node = node
 }
 
 // Returns the markup for the given node. To be used for cases where a test needs
@@ -133,6 +153,8 @@ Markup.get = function(node, opt_depth)
     return markup;
 }
 
+Markup._dumpCalls = 0
+
 Markup._spaces = function(multiplier)
 {
     return new Array(multiplier * 4 + 1).join(' ');
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7714f69..670524f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-22  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Ojan Vafai.
+
+        [Windows] Home hey doesn't work in first DIV inside a TABLE
+        https://bugs.webkit.org/show_bug.cgi?id=42767
+
+        The bug was caused by positionAvoidingFirstPositionInTable moving outside of the editing region.
+        Added a check so that it avoids the first position in the table only if the table is editable.
+
+        Test: editing/selection/home-inside-noneditable-table.html
+
+        * editing/visible_units.cpp:
+        (WebCore::positionAvoidingFirstPositionInTable):
+
 2010-07-22  Antonio Gomes  <tonikitoo at webkit.org>
 
         Reviewed by Laszlo Gombos.
diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp
index c094aac..dd48406 100644
--- a/WebCore/editing/visible_units.cpp
+++ b/WebCore/editing/visible_units.cpp
@@ -377,9 +377,9 @@ static VisiblePosition positionAvoidingFirstPositionInTable(const VisiblePositio
 {
     // return table offset 0 instead of the first VisiblePosition inside the table
     VisiblePosition previous = c.previous();
-    if (isLastPositionBeforeTable(previous))
+    if (isLastPositionBeforeTable(previous) && isEditablePosition(previous.deepEquivalent()))
         return previous;
-    
+
     return c;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list