layout/base/tests/bug613807-1.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:de5124ce9ea6
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
5 </head>
6 <body>
7 <textarea id="t" rows="4" style="-moz-appearance: none"></textarea>
8 <script>
9 if (typeof(addLoadEvent) == 'undefined') {
10 _newCallStack = function(path) {
11 var rval = function () {
12 var callStack = arguments.callee.callStack;
13 for (var i = 0; i < callStack.length; i++) {
14 if (callStack[i].apply(this, arguments) === false) {
15 break;
16 }
17 }
18 try {
19 this[path] = null;
20 } catch (e) {
21 // pass
22 }
23 };
24 rval.callStack = [];
25 return rval;
26 };
27 function addLoadEvent(func) {
28 var existing = window["onload"];
29 var regfunc = existing;
30 if (!(typeof(existing) == 'function'
31 && typeof(existing.callStack) == "object"
32 && existing.callStack !== null)) {
33 regfunc = _newCallStack("onload");
34 if (typeof(existing) == 'function') {
35 regfunc.callStack.push(existing);
36 }
37 window["onload"] = regfunc;
38 }
39 regfunc.callStack.push(func);
40 };
41 }
42
43 addLoadEvent(function() {
44 var area = document.getElementById('t');
45 area.focus();
46
47 var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
48
49 // start composition
50 synthesizeComposition({ type: "compositionstart" });
51
52 // input raw characters
53 synthesizeComposition({ type: "compositionupdate", data: "\u306D" });
54 synthesizeText(
55 { composition:
56 { string: "\u306D",
57 clauses: [
58 { length: 1, attr: domWindowUtils.COMPOSITION_ATTR_RAWINPUT }
59 ]
60 },
61 caret: { start: 1, length: 0 }
62 });
63 synthesizeComposition({ type: "compositionupdate", data: "\u306D\u3053" });
64 synthesizeText(
65 { composition:
66 { string: "\u306D\u3053",
67 clauses: [
68 { length: 2, attr: domWindowUtils.COMPOSITION_ATTR_RAWINPUT }
69 ]
70 },
71 caret: { start: 2, length: 0 }
72 });
73
74 // convert
75 synthesizeComposition({ type: "compositionupdate", data: "\u732B" });
76 synthesizeText(
77 { composition:
78 { string: "\u732B",
79 clauses: [
80 { length: 1, attr: domWindowUtils.COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT }
81 ]
82 },
83 caret: { start: 1, length: 0 }
84 });
85
86 // commit
87 synthesizeText(
88 { composition:
89 { string: "\u732B",
90 clauses: [
91 { length: 0, attr: 0 }
92 ]
93 },
94 caret: { start: 1, length: 0 }
95 });
96
97 // end composition
98 synthesizeComposition({ type: "compositionend", data: "\u732B" });
99
100 document.body.clientWidth;
101
102 // undo
103 synthesizeKey("Z", {accelKey: true});
104 });
105 </script>
106 </body>
107 </html>

mercurial