summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/bug613807-1.html
blob: 145ea5603ca12564f7111591b97f6be331cf8744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE HTML>
<html>
<head>
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<textarea id="t" rows="4" style="-moz-appearance: none"></textarea>
<script>
  if (typeof(addLoadEvent) == 'undefined') {
    _newCallStack = function(path) {
      var rval = function () {
        var callStack = arguments.callee.callStack;
        for (var i = 0; i < callStack.length; i++) {
          if (callStack[i].apply(this, arguments) === false) {
            break;
          }
        }
        try {
          this[path] = null;
        } catch (e) {
          // pass
        }
      };
      rval.callStack = [];
      return rval;
    };
    function addLoadEvent(func) {
      var existing = window["onload"];
      var regfunc = existing;
      if (!(typeof(existing) == 'function'
            && typeof(existing.callStack) == "object"
            && existing.callStack !== null)) {
        regfunc = _newCallStack("onload");
        if (typeof(existing) == 'function') {
          regfunc.callStack.push(existing);
        }
        window["onload"] = regfunc;
      }
      regfunc.callStack.push(func);
    };
  }

  addLoadEvent(function() {
    var area = document.getElementById('t');
    area.focus();

    var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);

    // input raw characters
    synthesizeCompositionChange(
      { composition:
        { string: "\u306D",
          clauses: [
            { length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }
          ]
        },
        caret: { start: 1, length: 0 }
      });
    synthesizeCompositionChange(
      { composition:
        { string: "\u306D\u3053",
          clauses: [
            { length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }
          ]
        },
        caret: { start: 2, length: 0 }
      });

    // convert
    synthesizeCompositionChange(
      { composition:
        { string: "\u732B",
          clauses: [
            { length: 1, attr: COMPOSITION_ATTR_SELECTED_CLAUSE }
          ]
        },
        caret: { start: 1, length: 0 }
      });

    // commit
    synthesizeComposition({ type: "compositioncommitasis" });

    document.body.clientWidth;

    // undo
    synthesizeKey("Z", {accelKey: true});
  });
</script>
</body>
</html>