Reviewed by Dave Hyatt.
- fix http://bugs.webkit.org/show_bug.cgi?id=14972
Moving cursor down in contentEditable section fails if styled line-height:1em
Test: editing/selection/move-by-line-003.html
* rendering/RenderText.cpp:
(WebCore::RenderText::positionForCoordinates): Changed hit testing so that each
line is tested for hits between its overflow top and the next line's overflow top.
This matches RenderBlock::positionForCoordinates.
2007-08-25 Mitz Pettel <mitz@webkit.org>
Reviewed by Dave Hyatt.
- test for http://bugs.webkit.org/show_bug.cgi?id=14972
Moving cursor down in contentEditable section fails if styled line-height:1em
* editing/selection/move-by-line-003-expected.txt: Added.
* editing/selection/move-by-line-003.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25235
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-08-25 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ - test for http://bugs.webkit.org/show_bug.cgi?id=14972
+ Moving cursor down in contentEditable section fails if styled line-height:1em
+
+ * editing/selection/move-by-line-003-expected.txt: Added.
+ * editing/selection/move-by-line-003.html: Added.
+
2007-08-25 Mitz Pettel <mitz@webkit.org>
Reviewed by Justin.
--- /dev/null
+Test for http://bugs.webkit.org/show_bug.cgi?id=14972 Moving cursor down in contentEditable section fails if styled line-height:1em.
+
+PASS
+
+Pressing the down arrow when the caret is on this line should move it to this line.
--- /dev/null
+<html>
+<head>
+ <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+ <script>
+ function test()
+ {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var target = document.getElementById("target");
+ getSelection().setBaseAndExtent(target.firstChild, 0, target.frstChild, 0);
+ moveSelectionForwardByLineCommand();
+
+ document.getElementById("result").innerText = getSelection().baseOffset == 63 ? "PASS" : "FAIL";
+ }
+ </script>
+</head>
+<body onload="test()">
+ <p>
+ Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14972">http://bugs.webkit.org/show_bug.cgi?id=14972</a>
+ Moving cursor down in contentEditable section fails if styled line-height:1em</i>.
+ </p>
+ <p id="result">
+ Test did not run
+ </p>
+ <p contenteditable="true" id="target" style="white-space: pre-line; line-height: 1em;">Pressing the down arrow when the caret is on this line
+ should move it to this line.
+ </p>
+</body>
+</html>
+2007-08-25 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=14972
+ Moving cursor down in contentEditable section fails if styled line-height:1em
+
+ Test: editing/selection/move-by-line-003.html
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::positionForCoordinates): Changed hit testing so that each
+ line is tested for hits between its overflow top and the next line's overflow top.
+ This matches RenderBlock::positionForCoordinates.
+
2007-08-25 Mitz Pettel <mitz@webkit.org>
Reviewed by Justin.
InlineTextBox* lastBoxAbove = 0;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
if (y >= box->root()->topOverflow()) {
- if (y < box->root()->bottomOverflow()) {
+ int bottom = box->root()->nextRootBox() ? box->root()->nextRootBox()->topOverflow() : box->root()->bottomOverflow();
+ if (y < bottom) {
offset = box->offsetForPosition(x);
if (x == box->m_x)