mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 240933 - Part 7: Collapse the selection in textarea's to the trailing BR if needed after every edit operation; r,a=roc
--HG-- extra : rebase_source : a13c6c277ddb545614eb8c93131112bc793c1348
This commit is contained in:
parent
b41230b0ae
commit
ddbe740048
@ -267,6 +267,9 @@ nsTextEditRules::AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)
|
||||
// insure trailing br node
|
||||
res = CreateTrailingBRIfNeeded();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// collapse the selection to the trailing BR if it's at the end of our text node
|
||||
CollapseSelectionToTrailingBRIfNeeded(selection);
|
||||
|
||||
/* After inserting text the cursor Bidi level must be set to the level of the inserted text.
|
||||
* This is difficult, because we cannot know what the level is until after the Bidi algorithm
|
||||
@ -455,6 +458,12 @@ nsTextEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
|
||||
|
||||
nsresult
|
||||
nsTextEditRules::DidInsertBreak(nsISelection *aSelection, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTextEditRules::CollapseSelectionToTrailingBRIfNeeded(nsISelection* aSelection)
|
||||
{
|
||||
// we only need to execute the stuff below if we are a plaintext editor.
|
||||
// html editors have a different mechanism for putting in mozBR's
|
||||
|
@ -233,6 +233,8 @@ protected:
|
||||
|
||||
nsresult HideLastPWInput();
|
||||
|
||||
nsresult CollapseSelectionToTrailingBRIfNeeded(nsISelection *aSelection);
|
||||
|
||||
PRBool IsPasswordEditor() const
|
||||
{
|
||||
return mEditor ? mEditor->IsPasswordEditor() : PR_FALSE;
|
||||
|
@ -92,6 +92,9 @@ _TEST_FILES = \
|
||||
bug106855-1.html \
|
||||
bug106855-2.html \
|
||||
bug106855-1-ref.html \
|
||||
bug240933-1.html \
|
||||
bug240933-2.html \
|
||||
bug240933-1-ref.html \
|
||||
bug482484.html \
|
||||
bug482484-ref.html \
|
||||
bug512295-1.html \
|
||||
|
10
layout/base/tests/bug240933-1-ref.html
Normal file
10
layout/base/tests/bug240933-1-ref.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML><html>
|
||||
<body>
|
||||
<textarea id="t" rows="4">
|
||||
|
||||
</textarea>
|
||||
<script>
|
||||
document.getElementById("t").focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
14
layout/base/tests/bug240933-1.html
Normal file
14
layout/base/tests/bug240933-1.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!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>
|
||||
<textarea id="t" rows="4"></textarea>
|
||||
<script>
|
||||
var area = document.getElementById('t');
|
||||
area.focus();
|
||||
|
||||
sendKey('VK_ENTER'); // press Enter once
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
16
layout/base/tests/bug240933-2.html
Normal file
16
layout/base/tests/bug240933-2.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!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>
|
||||
<textarea id="t" rows="4"></textarea>
|
||||
<script>
|
||||
var area = document.getElementById('t');
|
||||
area.focus();
|
||||
|
||||
sendKey('VK_ENTER'); // press Enter twice
|
||||
sendKey('VK_ENTER');
|
||||
sendKey('VK_BACK_SPACE'); // press Backspace once
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -88,6 +88,8 @@ function endTest() {
|
||||
var tests = [
|
||||
[ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
|
||||
[ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
|
||||
[ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
||||
[ 'bug512295-1.html' , 'bug512295-1-ref.html' ] ,
|
||||
[ 'bug512295-2.html' , 'bug512295-2-ref.html' ] ,
|
||||
|
Loading…
Reference in New Issue
Block a user