Initial checkin for Touch Events version 1 v1
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 11 Aug 2011 15:27:48 -0700
branchv1
changeset 1012d830a098494
parent 100 4bbe000815dd
child 104 01190a01b4cf
Initial checkin for Touch Events version 1

This version is limited to those parts of the specification that already have
interoperable implementations. The following events and attributes will not
be included in v1, but will appear in Touch Events v2:

* touchenter, touchleave, relatedTarget
* radiusX, radiusY, rotationAngle
* force
test/touchevents/single-touch.html
touchevents.html
     1.1 --- a/test/touchevents/single-touch.html	Wed Aug 03 19:15:56 2011 +0900
     1.2 +++ b/test/touchevents/single-touch.html	Thu Aug 11 15:27:48 2011 -0700
     1.3 @@ -35,7 +35,6 @@
     1.4  
     1.5          test(function() {
     1.6            assert_true(ev.target instanceof Element, "target must be an Element.");
     1.7 -          assert_equals(ev.relatedTarget, null, "relatedTarget must be null for touchstart event.");
     1.8          }, "touchstart TouchEvent target attributes are correct.");
     1.9  
    1.10          test(function() {
    1.11 @@ -72,17 +71,6 @@
    1.12          }, "identifiedTouch");
    1.13  
    1.14          test(function() {
    1.15 -          assert_true(t.rotationAngle >= 0, "rotationAngle must be >= 0.");
    1.16 -          assert_true(t.rotationAngle < 90, "rotationAngle must be > 90.");
    1.17 -
    1.18 -          assert_true(t.radiusX > 0, "radiusX is positive.");
    1.19 -          assert_true(t.radiusY > 0, "radiusY is positive.");
    1.20 -
    1.21 -          assert_true(t.force >= 0, "force >= 0.");
    1.22 -          assert_true(t.force <= 1, "force <= 1.");
    1.23 -        }, "Touch attribute values are valid");
    1.24 -
    1.25 -        test(function() {
    1.26            var attrs = ["screenX", "screenY", "clientX", "clientY",
    1.27                         "pageX", "pageY"];
    1.28            for (var i = 0; i < attrs.length; i++) {
    1.29 @@ -153,17 +141,6 @@
    1.30          }, "touchend identifier matches.");
    1.31  
    1.32          test(function() {
    1.33 -          assert_true(t.rotationAngle >= 0, "rotationAngle must be >= 0.");
    1.34 -          assert_true(t.rotationAngle < 90, "rotationAngle must be > 90.");
    1.35 -
    1.36 -          assert_true(t.radiusX > 0, "radiusX is positive.");
    1.37 -          assert_true(t.radiusY > 0, "radiusY is positive.");
    1.38 -
    1.39 -          assert_true(t.force >= 0, "force >= 0.");
    1.40 -          assert_true(t.force <= 1, "force <= 1.");
    1.41 -        }, "Touch attribute values are valid");
    1.42 -
    1.43 -        test(function() {
    1.44            var attrs = ["screenX", "screenY", "clientX", "clientY",
    1.45                         "pageX", "pageY"];
    1.46            for (var i = 0; i < attrs.length; i++) {
     2.1 --- a/touchevents.html	Wed Aug 03 19:15:56 2011 +0900
     2.2 +++ b/touchevents.html	Thu Aug 11 15:27:48 2011 -0700
     2.3 @@ -1,7 +1,7 @@
     2.4  <!DOCTYPE html>
     2.5  <html lang="en">
     2.6    <head>
     2.7 -    <title>Touch Events Specification</title>
     2.8 +    <title>Touch Events version 1</title>
     2.9      <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
    2.10      <meta name="viewport" content="width=device-width">
    2.11      <!--
    2.12 @@ -23,7 +23,7 @@
    2.13            // subtitle   :  "an excellent document",
    2.14  
    2.15            // if you wish the publication date to be other than today, set this
    2.16 -          publishDate:  "2011-07-19",
    2.17 +          publishDate:  "2011-08-11",
    2.18  
    2.19            // if the specification's copyright date is a range of years, specify
    2.20            // the start date here:
    2.21 @@ -198,60 +198,6 @@
    2.22            y-coordinate of point relative to the viewport, including any scroll
    2.23            offset
    2.24          </dd>
    2.25 -
    2.26 -        <dt>readonly attribute long radiusX</dt>
    2.27 -        <dd>
    2.28 -          the radius of the ellipse which most closely circumscribes the
    2.29 -          touching area (e.g. finger, stylus) along the x-axis, in pixels of
    2.30 -          the same scale as <a>screenX</a>; <code>1</code> if no value is
    2.31 -          known.  The value must be positive.
    2.32 -          <p class="issue" id="issue-units"><strong>Issue:</strong> What are
    2.33 -          units of radiusX/radiusY?  CSS Pixels?</p>
    2.34 -        </dd>
    2.35 -        <dt>readonly attribute long radiusY</dt>
    2.36 -        <dd>
    2.37 -          the radius of the ellipse which most closely circumscribes the
    2.38 -          touching area (e.g. finger, stylus) along the y-axis, in pixels of
    2.39 -          the same scale as <a>screenY</a>; <code>1</code> if no value is
    2.40 -          known.  The value must be positive.
    2.41 -        </dd>
    2.42 -
    2.43 -        <dt>readonly attribute float rotationAngle</dt>
    2.44 -        <dd>
    2.45 -          <p>
    2.46 -            the angle (in degrees) that the ellipse described by <a>radiusX</a>
    2.47 -            and <a>radiusY</a> is rotated clockwise about its center;
    2.48 -            <code>0</code> if no value is known.  The value must be greater
    2.49 -            than or equal to <code>0</code> and less than <code>90</code>.
    2.50 -          </p>
    2.51 -          <p>
    2.52 -            If the ellipse described by <a>radiusX</a> and <a>radiusY</a> is
    2.53 -            circular, then <a>rotationAngle</a> has no effect.  The user agent
    2.54 -            may use <code>0</code> as the value in this case, or it may use any
    2.55 -            other value in the allowed range.  (For example, the user agent may
    2.56 -            use the <a>rotationAngle</a> value from the previous touch event,
    2.57 -            to avoid sudden changes.)
    2.58 -          </p>
    2.59 -        </dd>
    2.60 -
    2.61 -        <dt>readonly attribute float force</dt>
    2.62 -        <dd>
    2.63 -          a relative value of pressure applied, in the range <code>0</code> to
    2.64 -          <code>1</code>, where <code>0</code> is no pressure, and
    2.65 -          <code>1</code> is the highest level of pressure the touch device is
    2.66 -          capable of sensing; <code>0</code> if no value is known.  In
    2.67 -          environments where <a>force</a> is known, the absolute pressure
    2.68 -          represented by the <a>force</a> attribute, and the sensitivity in
    2.69 -          levels of pressure, may vary.
    2.70 -
    2.71 -          <p class="issue" id="issue-inkml">
    2.72 -            <strong>Issue:</strong>
    2.73 -            Consider aligning with other "channels" and values from
    2.74 -            <a href="http://www.w3.org/TR/InkML/#channelContents">Ink Markup
    2.75 -            Language (InkML)</a>, in addition to <a>force</a>, e.g. adding
    2.76 -            <a>angle</a>, <a>clientZ</a>, <a>rotation</a>, etc.
    2.77 -          </p>
    2.78 -        </dd>
    2.79        </dl>
    2.80      </section>
    2.81  
    2.82 @@ -284,8 +230,7 @@
    2.83        <h2><a>TouchEvent</a> Interface</h2>
    2.84        <p>
    2.85          This interface defines the <a>touchstart</a>, <a>touchend</a>,
    2.86 -        <a>touchmove</a>, <a>touchenter</a>, <a>touchleave</a>, and
    2.87 -        <a>touchcancel</a> event types.
    2.88 +        <a>touchmove</a>, and <a>touchcancel</a> event types.
    2.89        </p>
    2.90  
    2.91        <dl title='interface TouchEvent : UIEvent' class='idl'>
    2.92 @@ -312,9 +257,7 @@
    2.93              <a>touchmove</a> event this must be a list of the touch points that
    2.94              have moved since the last event.  For the <a>touchend</a> event
    2.95              this must be a list of the touch points that have just been removed
    2.96 -            from the surface.  For the <a>touchenter</a> and <a>touchleave</a>
    2.97 -            events, this must be a list of the touch points that have just
    2.98 -            entered or left the target element.
    2.99 +            from the surface.
   2.100            </p>
   2.101          </dd>
   2.102  
   2.103 @@ -339,15 +282,6 @@
   2.104            <code>true</code> if the shift (Shift) key modifier is activated;
   2.105            otherwise <code>false</code>
   2.106          </dd>
   2.107 -        <dt>readonly attribute EventTarget relatedTarget</dt>
   2.108 -        <dd>
   2.109 -          identifies a secondary EventTarget related to a touch event.  This
   2.110 -          attribute is used with the <a>touchenter</a> event to indicate the
   2.111 -          <a>EventTarget</a> the touch point exited, and with the
   2.112 -          <a>touchleave</a> event to indicate the <a>EventTarget</a> the touch
   2.113 -          point entered.  For other event types, this attribute must be
   2.114 -          <code>null</code>.
   2.115 -        </dd>
   2.116  
   2.117          <!-- Methods -->
   2.118          <dt>void initTouchEvent()</dt>
   2.119 @@ -532,13 +466,6 @@
   2.120          </p>
   2.121  
   2.122          <p>
   2.123 -          If the values of <a>radiusX</a>, <a>radiusY</a>,
   2.124 -          <a>rotationAngle</a>, or <a>force</a> are known, then the user agent
   2.125 -          also must dispatch this event type to indicate when any of these
   2.126 -          attributes of a <a>touch point</a> have changed.
   2.127 -        </p>
   2.128 -
   2.129 -        <p>
   2.130            Note that the rate at which the user agent sends <a>touchmove</a>
   2.131            events is implementation-defined, and may depend on hardware
   2.132            capabilities and other implementation details.
   2.133 @@ -553,24 +480,6 @@
   2.134        </section>
   2.135  
   2.136        <section>
   2.137 -        <h3 id="event-touchenter">The <dfn class="event">touchenter</dfn> event</h3>
   2.138 -        <p>
   2.139 -          A user agent must dispatch this event type to indicate when a
   2.140 -          <a>touch point</a> moves onto the interactive area defined by a DOM
   2.141 -          element.  Events of this type must not bubble.
   2.142 -        </p>
   2.143 -      </section>
   2.144 -
   2.145 -      <section>
   2.146 -        <h3 id="event-touchleave">The <dfn class="event">touchleave</dfn> event</h3>
   2.147 -        <p>
   2.148 -          A user agent must dispatch this event type to indicate when a
   2.149 -          <a>touch point</a> moves off the interactive area defined by a DOM
   2.150 -          element.  Events of this type must not bubble.
   2.151 -        </p>
   2.152 -      </section>
   2.153 -
   2.154 -      <section>
   2.155          <h3 id="event-touchcancel">The <dfn class="event">touchcancel</dfn> event</h3>
   2.156          <p>
   2.157            A user agent must dispatch this event type to indicate when a touch
   2.158 @@ -608,10 +517,6 @@
   2.159              <dt>long pageY</dt> <dd></dd>
   2.160              <dt>long screenX</dt> <dd></dd>
   2.161              <dt>long screenY</dt> <dd></dd>
   2.162 -            <dt>optional long radiusX</dt> <dd></dd>
   2.163 -            <dt>optional long radiusY</dt> <dd></dd>
   2.164 -            <dt>optional float rotationAngle</dt> <dd></dd>
   2.165 -            <dt>optional float force</dt> <dd></dd>
   2.166            </dl>
   2.167          </dd>
   2.168