+2006-07-21 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ Test for: <rdar://problem/4643238> REGRESSION: Can't set insertion point at the end of a line of text
+
+ * fast/forms/textarea-scrolled-endline-caret-expected.txt: Added.
+ * fast/forms/textarea-scrolled-endline-caret.html: Added.
+
2006-07-21 Geoffrey Garen <ggaren@apple.com>
RS by Adele.
--- /dev/null
+<head>
+<script>
+function test()
+{
+ var ta = document.getElementById('ta')
+ ta.focus();
+ // click
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ eventSender.mouseMoveTo(90, 20);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ var res = document.getElementById('res');
+ if (ta.selectionEnd == 17)
+ res.innerHTML = "Test Succeeded";
+ else
+ res.innerHTML = "Test Failed: caret is at " + ta.selectionEnd;
+}
+</script>
+</head>
+<body onload="test()">
+<textarea id="ta">
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+</textarea>
+<div id="res"></div>
\ No newline at end of file
+2006-07-21 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ Fix for: <rdar://problem/4643238> REGRESSION: Can't set insertion point at the end of a line of text
+
+ Test: fast/forms/textarea-scrolled-endline-caret.html
+
+ * rendering/RenderBlock.cpp: (WebCore::RenderBlock::positionForCoordinates):
+ When looking for the closest line box, take the scroll offset into account.
+
2006-07-21 Tim Omernick <timo@apple.com>
Reviewed by Geoff & Maciej.
if (!firstRootBox())
return VisiblePosition(n, 0, DOWNSTREAM);
- if (y >= top && y < absy + firstRootBox()->topOverflow())
+ int contentsX = absx;
+ int contentsY = absy;
+ if (hasOverflowClip())
+ layer()->subtractScrollOffset(contentsX, contentsY);
+
+ if (y >= top && y < contentsY + firstRootBox()->topOverflow())
// y coordinate is above first root line box
return VisiblePosition(positionForBox(firstRootBox()->firstLeafChild(), true), DOWNSTREAM);
// look for the closest line box in the root box which is at the passed-in y coordinate
for (RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) {
- top = absy + root->topOverflow();
+ top = contentsY + root->topOverflow();
// set the bottom based on whether there is a next root box
if (root->nextRootBox())
- bottom = absy + root->nextRootBox()->topOverflow();
+ bottom = contentsY + root->nextRootBox()->topOverflow();
else
- bottom = absy + root->bottomOverflow();
+ bottom = contentsY + root->bottomOverflow();
// check if this root line box is located at this y coordinate
if (y >= top && y < bottom && root->firstChild()) {
- InlineBox* closestBox = root->closestLeafChildForXPos(x, absx);
+ InlineBox* closestBox = root->closestLeafChildForXPos(x, contentsX);
if (closestBox)
// pass the box a y position that is inside it
- return closestBox->object()->positionForCoordinates(x, absy + closestBox->m_y);
+ return closestBox->object()->positionForCoordinates(x, contentsY + closestBox->m_y);
}
}