Auto merge of #9811 - paulrouget:forceTouch, r=mbrubeck

forcetouch events

https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html

Not sure how we want to land that yet. Maybe reproduce the webkit events (as in this PR), or as touch/mousemouse events.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9811)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-05 21:07:05 +05:30
commit 0ff8adb097
14 changed files with 246 additions and 8 deletions

View file

@ -0,0 +1,35 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html
/**
* Events: (copy/paste from apple.com)
*
* webkitmouseforcewillbegin: This event occurs immediately before the mousedown event. It allows you to
* prevent the default system behavior, such as displaying a dictionary window when force clicking on a
* word, in order to perform a custom action instead. To prevent the default system behavior, call the
* preventDefault() method on the event.
* webkitmouseforcedown: This event occurs after the mousedown event, once enough force has been applied
* to register as a force click. The user receives haptic feedback representing the force click when this
* event occurs.
* webkitmouseforceup: This event occurs after a webkitmouseforcedown event, once enough force has been
* released to exit the force click operation. The user receives haptic feedback representing the exit
* from force click when this event occurs.
* webkitmouseforcechanged: This event occurs whenever a change in trackpad force is detected between the
* mousedown and mouseup events.
*
*/
[Pref="dom.forcetouch.enabled"]
interface ForceTouchEvent : UIEvent {
// Represents the amount of force required to perform a regular click.
readonly attribute float SERVO_FORCE_AT_MOUSE_DOWN;
// Represents the force required to perform a force click.
readonly attribute float SERVO_FORCE_AT_FORCE_MOUSE_DOWN;
// force level
readonly attribute float servoForce;
};