Bug 1553852 - Mark eCompositionChange as composed event; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D33387

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edgar Chen 2019-06-03 09:18:47 +00:00
parent b7d2d86b34
commit 6c45f02a32
3 changed files with 64 additions and 3 deletions

View file

@ -36,6 +36,7 @@ support-files =
[test_event_stopping.html]
[test_template.html]
[test_template_xhtml.html]
[test_shadowdom_ime.html]
[test_shadowroot.html]
[test_shadowroot_clonenode.html]
[test_shadowroot_inert_element.html]

View file

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1553852
-->
<head>
<title>Test for Bug 1429982</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1553852">Mozilla Bug 1553852</a>
<p id="display"></p>
<div id="content">
<div id="host"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1553852 **/
SimpleTest.waitForExplicitFinish()
SimpleTest.waitForFocus(function() {
let div = document.createElement('div');
div.setAttribute('contenteditable', 'true');
let shadow = document.getElementById('host').attachShadow({mode: 'open'});
shadow.appendChild(div);
div.focus();
let testString = '\uD842\uDFB7\u91CE\u5BB6';
synthesizeCompositionChange(
{ "composition":
{ "string": testString,
"clauses":
[
{ "length": testString.length, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
],
},
"caret": { "start": testString.length, "length": 0 },
});
is(div.innerText, testString,
"The value of contenteditable div should be " + testString +
" during composition");
synthesizeComposition({ type: "compositioncommitasis" });
is(div.innerText, testString,
"The value of contenteditable div should be " + testString +
" after compositionend");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

View file

@ -835,9 +835,9 @@ class WidgetEvent : public WidgetEventTime {
void SetDefaultComposed() {
switch (mClass) {
case eCompositionEventClass:
mFlags.mComposed = mMessage == eCompositionStart ||
mMessage == eCompositionUpdate ||
mMessage == eCompositionEnd;
mFlags.mComposed =
mMessage == eCompositionStart || mMessage == eCompositionUpdate ||
mMessage == eCompositionChange || mMessage == eCompositionEnd;
break;
case eDragEventClass:
// All drag & drop events are composed
@ -900,6 +900,7 @@ class WidgetEvent : public WidgetEventTime {
aEventTypeArg.EqualsLiteral("compositionstart") ||
aEventTypeArg.EqualsLiteral("compositionupdate") ||
aEventTypeArg.EqualsLiteral("compositionend") ||
aEventTypeArg.EqualsLiteral("text") ||
// drag and drop events
aEventTypeArg.EqualsLiteral("dragstart") ||
aEventTypeArg.EqualsLiteral("drag") ||