layout/base/tests/bug613807-1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/bug613807-1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     1.8 +</head>
     1.9 +<body>
    1.10 +<textarea id="t" rows="4" style="-moz-appearance: none"></textarea>
    1.11 +<script>
    1.12 +  if (typeof(addLoadEvent) == 'undefined') {
    1.13 +    _newCallStack = function(path) {
    1.14 +      var rval = function () {
    1.15 +        var callStack = arguments.callee.callStack;
    1.16 +        for (var i = 0; i < callStack.length; i++) {
    1.17 +          if (callStack[i].apply(this, arguments) === false) {
    1.18 +            break;
    1.19 +          }
    1.20 +        }
    1.21 +        try {
    1.22 +          this[path] = null;
    1.23 +        } catch (e) {
    1.24 +          // pass
    1.25 +        }
    1.26 +      };
    1.27 +      rval.callStack = [];
    1.28 +      return rval;
    1.29 +    };
    1.30 +    function addLoadEvent(func) {
    1.31 +      var existing = window["onload"];
    1.32 +      var regfunc = existing;
    1.33 +      if (!(typeof(existing) == 'function'
    1.34 +            && typeof(existing.callStack) == "object"
    1.35 +            && existing.callStack !== null)) {
    1.36 +        regfunc = _newCallStack("onload");
    1.37 +        if (typeof(existing) == 'function') {
    1.38 +          regfunc.callStack.push(existing);
    1.39 +        }
    1.40 +        window["onload"] = regfunc;
    1.41 +      }
    1.42 +      regfunc.callStack.push(func);
    1.43 +    };
    1.44 +  }
    1.45 +
    1.46 +  addLoadEvent(function() {
    1.47 +    var area = document.getElementById('t');
    1.48 +    area.focus();
    1.49 +
    1.50 +    var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
    1.51 +
    1.52 +    // start composition
    1.53 +    synthesizeComposition({ type: "compositionstart" });
    1.54 +
    1.55 +    // input raw characters
    1.56 +    synthesizeComposition({ type: "compositionupdate", data: "\u306D" });
    1.57 +    synthesizeText(
    1.58 +      { composition:
    1.59 +        { string: "\u306D",
    1.60 +          clauses: [
    1.61 +            { length: 1, attr: domWindowUtils.COMPOSITION_ATTR_RAWINPUT }
    1.62 +          ]
    1.63 +        },
    1.64 +        caret: { start: 1, length: 0 }
    1.65 +      });
    1.66 +    synthesizeComposition({ type: "compositionupdate", data: "\u306D\u3053" });
    1.67 +    synthesizeText(
    1.68 +      { composition:
    1.69 +        { string: "\u306D\u3053",
    1.70 +          clauses: [
    1.71 +            { length: 2, attr: domWindowUtils.COMPOSITION_ATTR_RAWINPUT }
    1.72 +          ]
    1.73 +        },
    1.74 +        caret: { start: 2, length: 0 }
    1.75 +      });
    1.76 +
    1.77 +    // convert
    1.78 +    synthesizeComposition({ type: "compositionupdate", data: "\u732B" });
    1.79 +    synthesizeText(
    1.80 +      { composition:
    1.81 +        { string: "\u732B",
    1.82 +          clauses: [
    1.83 +            { length: 1, attr: domWindowUtils.COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT }
    1.84 +          ]
    1.85 +        },
    1.86 +        caret: { start: 1, length: 0 }
    1.87 +      });
    1.88 +
    1.89 +    // commit
    1.90 +    synthesizeText(
    1.91 +      { composition:
    1.92 +        { string: "\u732B",
    1.93 +          clauses: [
    1.94 +            { length: 0, attr: 0 }
    1.95 +          ]
    1.96 +        },
    1.97 +        caret: { start: 1, length: 0 }
    1.98 +      });
    1.99 +
   1.100 +    // end composition
   1.101 +    synthesizeComposition({ type: "compositionend", data: "\u732B" });
   1.102 +
   1.103 +    document.body.clientWidth;
   1.104 +
   1.105 +    // undo
   1.106 +    synthesizeKey("Z", {accelKey: true});
   1.107 +  });
   1.108 +</script>
   1.109 +</body>
   1.110 +</html>

mercurial