зеркало из https://github.com/mozilla/gecko-dev.git
Bug 539323. Position the caret at the content-edge of its container frame, not the border-edge. r=mats
This commit is contained in:
Родитель
66d7a231ec
Коммит
aeff873bb5
|
@ -363,7 +363,7 @@ nsresult nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType,
|
|||
viewOffset += framePos;
|
||||
outCoordinates->x = viewOffset.x;
|
||||
outCoordinates->y = viewOffset.y;
|
||||
outCoordinates->height = theFrame->GetSize().height;
|
||||
outCoordinates->height = theFrame->GetContentRect().height;
|
||||
outCoordinates->width = ComputeMetrics(theFrame, theFrameOffset, outCoordinates->height).mCaretWidth;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -405,7 +405,7 @@ nsIFrame* nsCaret::GetGeometry(nsISelection* aSelection, nsRect* aRect)
|
|||
return nsnull;
|
||||
|
||||
// now add the frame offset to the view offset, and we're done
|
||||
nscoord height = theFrame->GetSize().height;
|
||||
nscoord height = theFrame->GetContentRect().height;
|
||||
nscoord width = ComputeMetrics(theFrame, theFrameOffset, height).mCaretWidth;
|
||||
*aRect = nsRect(framePos.x, 0, width, height);
|
||||
return theFrame;
|
||||
|
@ -1204,7 +1204,7 @@ nsresult nsCaret::UpdateCaretRects(nsIFrame* aFrame, PRInt32 aFrameOffset)
|
|||
{
|
||||
NS_ASSERTION(aFrame, "Should have a frame here");
|
||||
|
||||
nsRect frameRect = aFrame->GetRect();
|
||||
nsRect frameRect = aFrame->GetContentRect();
|
||||
frameRect.x = 0;
|
||||
frameRect.y = 0;
|
||||
|
||||
|
|
|
@ -4500,7 +4500,8 @@ NS_IMETHODIMP
|
|||
nsFrame::GetPointFromOffset(PRInt32 inOffset, nsPoint* outPoint)
|
||||
{
|
||||
NS_PRECONDITION(outPoint != nsnull, "Null parameter");
|
||||
nsPoint bottomLeft(0, 0);
|
||||
nsRect contentRect = GetContentRect() - GetPosition();
|
||||
nsPoint pt = contentRect.TopLeft();
|
||||
if (mContent)
|
||||
{
|
||||
nsIContent* newContent = mContent->GetParent();
|
||||
|
@ -4509,11 +4510,12 @@ nsFrame::GetPointFromOffset(PRInt32 inOffset, nsPoint* outPoint)
|
|||
|
||||
PRBool isRTL = (NS_GET_EMBEDDING_LEVEL(this) & 1) == 1;
|
||||
if ((!isRTL && inOffset > newOffset) ||
|
||||
(isRTL && inOffset <= newOffset))
|
||||
bottomLeft.x = GetRect().width;
|
||||
(isRTL && inOffset <= newOffset)) {
|
||||
pt = contentRect.TopRight();
|
||||
}
|
||||
}
|
||||
}
|
||||
*outPoint = bottomLeft;
|
||||
*outPoint = pt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div style="width:250px; height:200px; border:10px solid red; padding:5px">
|
||||
<div id="input" contenteditable="true" style="height:200px; outline:none"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div id="input" style="width:250px; height:200px; border:10px solid red; padding:5px; outline:none" contentEditable="true"></div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div style="width:0; height:200px; border:10px solid red; padding:5px">
|
||||
<div id="input" contenteditable="true" style="height:200px; outline:none"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div id="input" style="width:0; height:200px; border:10px solid red; padding:5px; outline:none" contentEditable="true"></div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div style="width:0; height:200px;">
|
||||
<div id="input" contenteditable="true" style="height:200px; outline:none"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div id="input" style="width:0; height:200px; outline:none" contentEditable="true"></div>
|
||||
<script>
|
||||
window.focus();
|
||||
document.getElementById("input").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1386,6 +1386,9 @@ fails HTTP(..) == 518172-2b.html 518172-b-ref.html # bug 518172
|
|||
== 537471-1.html 537471-1-ref.html
|
||||
== 538935-1.html 538935-1-ref.html
|
||||
== 539226-1.html about:blank
|
||||
== 539323-1.html 539323-1-ref.html
|
||||
== 539323-2.html 539323-2-ref.html
|
||||
== 539323-3.html 539323-3-ref.html
|
||||
== 542620-1.html 542620-1-ref.html
|
||||
== 541382-1.html 541382-1-ref.html
|
||||
== 541406-1.html 541406-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче