Title: [98408] trunk
- Revision
- 98408
- Author
- rn...@webkit.org
- Date
- 2011-10-25 16:17:59 -0700 (Tue, 25 Oct 2011)
Log Message
Moving to the start of line should not place the caret outside of the table
https://bugs.webkit.org/show_bug.cgi?id=70757
Reviewed by Chang Shu.
Source/WebCore:
The bug was caused by positionAvoidingFirstPositionInTable. Get rid of the function.
Test: editing/selection/table-lineboundary.html
* editing/visible_units.cpp:
(WebCore::startPositionForLine):
LayoutTests:
Added a test to move the caret to lineboundaries in the first and the last table cell.
The caret should remain inside a table cell.
* editing/selection/table-lineboundary-expected.txt: Added.
* editing/selection/table-lineboundary.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (98407 => 98408)
--- trunk/LayoutTests/ChangeLog 2011-10-25 23:10:43 UTC (rev 98407)
+++ trunk/LayoutTests/ChangeLog 2011-10-25 23:17:59 UTC (rev 98408)
@@ -1,3 +1,16 @@
+2011-10-25 Ryosuke Niwa <rn...@webkit.org>
+
+ Moving to the start of line should not place the caret outside of the table
+ https://bugs.webkit.org/show_bug.cgi?id=70757
+
+ Reviewed by Chang Shu.
+
+ Added a test to move the caret to lineboundaries in the first and the last table cell.
+ The caret should remain inside a table cell.
+
+ * editing/selection/table-lineboundary-expected.txt: Added.
+ * editing/selection/table-lineboundary.html: Added.
+
2011-10-25 Erik Arvidsson <a...@chromium.org>
JS Test Harness: Make successfullyParsed optional
Added: trunk/LayoutTests/editing/selection/table-lineboundary-expected.txt (0 => 98408)
--- trunk/LayoutTests/editing/selection/table-lineboundary-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/table-lineboundary-expected.txt 2011-10-25 23:17:59 UTC (rev 98408)
@@ -0,0 +1,3 @@
+This tests moving to line boundaries in the first or the last table cell, and types "h" and "d" respectively. You should see "hello" and "world" in the first and the second table cell respectively.
+
+PASS
Added: trunk/LayoutTests/editing/selection/table-lineboundary.html (0 => 98408)
--- trunk/LayoutTests/editing/selection/table-lineboundary.html (rev 0)
+++ trunk/LayoutTests/editing/selection/table-lineboundary.html 2011-10-25 23:17:59 UTC (rev 98408)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+table, td { border: solid 2px red; border-collapse: collapse; }
+</style>
+</head>
+<body>
+<p id="description">This tests moving to line boundaries in the first or the last table cell, and types "h" and "d" respectively.
+You should see "hello" and "world" in the first and the second table cell respectively.</p>
+<div id="container" contentEditable="true">a<table><tr><td id="target">ello</td><td>worl</td></tr></table>b</div>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var target = document.getElementById('target');
+getSelection().collapse(target.firstChild, 2);
+getSelection().modify('Move', 'Backward', 'LineBoundary');
+document.execCommand('InsertText', false, 'h');
+
+getSelection().collapse(target.nextSibling.firstChild, 2);
+getSelection().modify('Move', 'Forward', 'LineBoundary');
+document.execCommand('InsertText', false, 'd');
+
+document.writeln(target.parentNode.textContent == 'helloworld' ? 'PASS' : 'FAIL');
+if (window.layoutTestController)
+ document.getElementById('container').style.display = 'none';
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (98407 => 98408)
--- trunk/Source/WebCore/ChangeLog 2011-10-25 23:10:43 UTC (rev 98407)
+++ trunk/Source/WebCore/ChangeLog 2011-10-25 23:17:59 UTC (rev 98408)
@@ -1,3 +1,17 @@
+2011-10-25 Ryosuke Niwa <rn...@webkit.org>
+
+ Moving to the start of line should not place the caret outside of the table
+ https://bugs.webkit.org/show_bug.cgi?id=70757
+
+ Reviewed by Chang Shu.
+
+ The bug was caused by positionAvoidingFirstPositionInTable. Get rid of the function.
+
+ Test: editing/selection/table-lineboundary.html
+
+ * editing/visible_units.cpp:
+ (WebCore::startPositionForLine):
+
2011-10-25 Beth Dakin <bda...@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=70852
Modified: trunk/Source/WebCore/editing/visible_units.cpp (98407 => 98408)
--- trunk/Source/WebCore/editing/visible_units.cpp 2011-10-25 23:10:43 UTC (rev 98407)
+++ trunk/Source/WebCore/editing/visible_units.cpp 2011-10-25 23:17:59 UTC (rev 98408)
@@ -318,17 +318,6 @@
// ---------
-static VisiblePosition positionAvoidingFirstPositionInTable(const VisiblePosition& c)
-{
- // return table offset 0 instead of the first VisiblePosition inside the table
- VisiblePosition previous = c.previous();
- if (isLastPositionBeforeTable(previous) && isEditablePosition(previous.deepEquivalent()))
- return previous;
-
- return c;
-}
-
-
enum LineEndpointComputationMode { UseLogicalOrdering, UseInlineBoxOrdering };
static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpointComputationMode mode)
{
@@ -341,8 +330,8 @@
// RootInlineBoxes, like empty editable blocks and bordered blocks.
Position p = c.deepEquivalent();
if (p.deprecatedNode()->renderer() && p.deprecatedNode()->renderer()->isRenderBlock() && !p.deprecatedEditingOffset())
- return positionAvoidingFirstPositionInTable(c);
-
+ return c;
+
return VisiblePosition();
}
@@ -372,9 +361,8 @@
}
}
- if (startNode->isTextNode())
- return positionAvoidingFirstPositionInTable(Position(static_cast<Text*>(startNode), toInlineTextBox(startBox)->start()));
- return positionAvoidingFirstPositionInTable(positionBeforeNode(startNode));
+ return startNode->isTextNode() ? Position(static_cast<Text*>(startNode), toInlineTextBox(startBox)->start())
+ : positionBeforeNode(startNode);
}
static VisiblePosition startOfLine(const VisiblePosition& c, LineEndpointComputationMode mode)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes