Bug 430785: Caret not visible with right-clicking on a text input, patch by Martijn Wargers <martijn.martijn@gmail.com>, r+sr=roc, a=damon
git-svn-id: svn://10.0.0.236/trunk@250988 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5495cd87ca
commit
f584b00aef
@ -1048,7 +1048,7 @@ PRBool nsCaret::IsMenuPopupHidingCaret()
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (popupFrame->PopupType() == ePopupTypeMenu) {
|
||||
if (popupFrame->PopupType() == ePopupTypeMenu && !popupFrame->IsContextMenu()) {
|
||||
// This is an open menu popup. It does not contain the caret (else we'd
|
||||
// have returned above). Even if the caret is in a subsequent popup,
|
||||
// or another document/frame, it should be hidden.
|
||||
|
||||
@ -28,7 +28,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=420499
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
|
||||
<popupset>
|
||||
<popup id="contextmenu">
|
||||
<menuitem label="Cut"/>
|
||||
<menuitem label="Copy"/>
|
||||
<menuitem label="Paste"/>
|
||||
</popup>
|
||||
<tooltip id="tooltip" orient="vertical">
|
||||
<description value="This is a tooltip"/>
|
||||
</tooltip>
|
||||
</popupset>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" bgcolor="white">
|
||||
@ -88,8 +97,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=420499
|
||||
function ensureParagraphFocused() {
|
||||
window.removeEventListener("popuphidden", ensureParagraphFocused, false);
|
||||
ok(isCaretVisible(), "Caret should have returned to previous focus");
|
||||
SimpleTest.finish();
|
||||
window.addEventListener("popupshown", popupMenuShownHandler2, false);
|
||||
$("contextmenu").openPopup($('text-input'), "topleft" , -1 , -1 , true, true);
|
||||
}
|
||||
|
||||
function popupMenuShownHandler2() {
|
||||
window.removeEventListener("popupshown", popupMenuShownHandler2, false);
|
||||
ok(isCaretVisible(), "Caret should be visible when context menu open");
|
||||
window.addEventListener("popuphidden", ensureParagraphFocused2, false);
|
||||
document.getElementById("contextmenu").hidePopup();
|
||||
}
|
||||
|
||||
function ensureParagraphFocused2() {
|
||||
window.removeEventListener("popuphidden", ensureParagraphFocused2, false);
|
||||
ok(isCaretVisible(), "Caret should still be visible");
|
||||
window.addEventListener("popupshown", tooltipShownHandler, false);
|
||||
$("tooltip").openPopup($('text-input'), "topleft" , -1 , -1 , false, true);
|
||||
}
|
||||
|
||||
function tooltipShownHandler() {
|
||||
window.removeEventListener("popupshown", tooltipShownHandler, false);
|
||||
ok(isCaretVisible(), "Caret should be visible when tooltip is visible");
|
||||
window.addEventListener("popuphidden", ensureParagraphFocused3, false);
|
||||
document.getElementById("tooltip").hidePopup();
|
||||
}
|
||||
|
||||
function ensureParagraphFocused3() {
|
||||
window.removeEventListener("popuphidden", ensureParagraphFocused2, false);
|
||||
ok(isCaretVisible(), "Caret should still be visible");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
]]></script>
|
||||
</window>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user