2015-04-21 09:27:10 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1128787
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Test for Bug 1128787</title>
|
2019-04-15 23:56:58 +03:00
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
2015-04-21 09:27:10 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
|
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 1128787 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
window.onload = function (aEvent) {
|
|
|
|
var blurEventFired = false;
|
|
|
|
var input = document.getElementsByTagName("input")[0];
|
2019-06-12 11:29:58 +03:00
|
|
|
input.addEventListener("blur", function (event) {
|
2015-04-21 09:27:10 +03:00
|
|
|
ok(true, "input element gets blur event correctly");
|
|
|
|
|
|
|
|
var utils = SpecialPowers.getDOMWindowUtils(window);
|
|
|
|
is(utils.IMEStatus, utils.IME_STATUS_ENABLED, "IME should be enabled");
|
|
|
|
|
|
|
|
SimpleTest.executeSoon(function () {
|
|
|
|
document.designMode = "off";
|
|
|
|
|
Bug 1807495 - part 1: Make `Document` notify `HTMLEditor` and `IMEStateManager` of pseudo focus change when editing state of focused editing host or document is changed r=smaug,m_kato
`IMEStateManager` basically runs at focus change. However, when `designMode`
is set to `"off"` or focused editing host becomes non-editable (removing
`contenteditable` attribute or `contenteditable` attribute is set to `false`),
IME may be disabled without a focus change. Therefore, `Document` needs to
notify `IMEStateManager` of the timing.
Additionally, `nsFocusManager` does not change focus when focused element
becomes not focusable (bug 1807597). Therefore, `Document` needs to kick
`focus` or `blur` event handler of `HTMLEditor` when active editing host
becomes not editable.
However, if an ancestor of focused element becomes editable, I think that
`HTMLEditor` does not work well without focus move because it computes
editing host with current editing state in a lot of places, but `Selection`
and `nsFocusManager::GetFocusedElement` keeps working with previous focused
element which is now a editable child of editing host. Therefore, this patch
marks them as `todo` in the new tests.
Differential Revision: https://phabricator.services.mozilla.com/D171196
2023-04-12 02:26:03 +03:00
|
|
|
is(utils.IMEStatus, utils.IME_STATUS_DISABLED, "IME should be disabled");
|
2015-04-21 09:27:10 +03:00
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
}, {once: true});
|
|
|
|
document.designMode = "on";
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1128787">Mozilla Bug 1128787</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<input type="button"/>
|
|
|
|
<script>
|
|
|
|
var input = document.getElementsByTagName("input")[0];
|
|
|
|
input.focus();
|
|
|
|
</script>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|