зеркало из https://github.com/mozilla/pjs.git
Bug 644428 - Position the caret correctly for empty inline frames; r=roc
This commit is contained in:
Родитель
a669a668ee
Коммит
0a8aca1aca
|
@ -138,6 +138,8 @@ _TEST_FILES = \
|
|||
bug632215-ref.html \
|
||||
bug633044-1.html \
|
||||
bug633044-1-ref.html \
|
||||
bug644428-1.html \
|
||||
bug644428-1-ref.html \
|
||||
test_bug514127.html \
|
||||
test_bug518777.html \
|
||||
test_bug548545.xhtml \
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body onload="setupCaret()">
|
||||
<div contenteditable>a</div>
|
||||
<script>
|
||||
function setupCaret() {
|
||||
var div = document.querySelector("div");
|
||||
div.focus();
|
||||
var sel = window.getSelection();
|
||||
sel.collapse(div, 1);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body onload="setupCaret()" spellcheck="false">
|
||||
<div contenteditable>a<span>b</span>c </div>
|
||||
<script>
|
||||
function setupCaret() {
|
||||
var div = document.querySelector("div");
|
||||
div.focus();
|
||||
var sel = window.getSelection();
|
||||
sel.collapse(div, 3);
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -121,7 +121,8 @@ var tests = [
|
|||
[ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
|
||||
[ 'bug632215-1.html' , 'bug632215-ref.html' ] ,
|
||||
[ 'bug632215-2.html' , 'bug632215-ref.html' ] ,
|
||||
[ 'bug633044-1.html' , 'bug633044-1-ref.html' ]
|
||||
[ 'bug633044-1.html' , 'bug633044-1-ref.html' ] ,
|
||||
[ 'bug644428-1.html' , 'bug644428-1-ref.html' ]
|
||||
];
|
||||
var testIndex = 0;
|
||||
|
||||
|
|
|
@ -922,6 +922,22 @@ nsInlineFrame::GetBaseline() const
|
|||
return ascent + GetUsedBorderAndPadding().top;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsInlineFrame::GetCaretBaseline() const
|
||||
{
|
||||
nscoord baseline;
|
||||
if (mRect.height == 0) {
|
||||
// Empty inline frames will be pushed down in the line, so we need to
|
||||
// account for that here.
|
||||
baseline = 0;
|
||||
} else {
|
||||
baseline = GetBaseline();
|
||||
NS_ASSERTION(baseline <= mRect.height,
|
||||
"We should never hit a case where our height is non-zero but smaller than the caret baseline...");
|
||||
}
|
||||
return baseline;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
already_AddRefed<nsAccessible>
|
||||
nsInlineFrame::CreateAccessible()
|
||||
|
|
|
@ -119,6 +119,7 @@ public:
|
|||
|
||||
virtual void PullOverflowsFromPrevInFlow();
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nscoord GetCaretBaseline() const;
|
||||
|
||||
/**
|
||||
* Return true if the frame is leftmost frame or continuation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче