Bug 810359 - Introduce haptic feedback. r=davidb

This commit is contained in:
Eitan Isaacson 2012-11-12 15:46:09 -08:00
Родитель b4c077a812
Коммит 9acb3c3b1d
3 изменённых файлов: 27 добавлений и 3 удалений

Просмотреть файл

@ -301,6 +301,10 @@ var Output = {
} }
}, },
Haptic: function Haptic(aDetails, aBrowser) {
this.chromeWin.navigator.vibrate(aDetails.pattern);
},
_adjustBounds: function(aJsonBounds, aBrowser) { _adjustBounds: function(aJsonBounds, aBrowser) {
let bounds = new Rect(aJsonBounds.left, aJsonBounds.top, let bounds = new Rect(aJsonBounds.left, aJsonBounds.top,
aJsonBounds.right - aJsonBounds.left, aJsonBounds.right - aJsonBounds.left,

Просмотреть файл

@ -26,6 +26,7 @@ this.EventManager = {
if (Utils.MozBuildApp == 'b2g') { if (Utils.MozBuildApp == 'b2g') {
this.presenters.push(new SpeechPresenter()); this.presenters.push(new SpeechPresenter());
this.presenters.push(new HapticPresenter());
} else if (Utils.MozBuildApp == 'mobile/android') { } else if (Utils.MozBuildApp == 'mobile/android') {
this.presenters.push(new AndroidPresenter()); this.presenters.push(new AndroidPresenter());
} }

Просмотреть файл

@ -17,6 +17,7 @@ this.EXPORTED_SYMBOLS = ['VisualPresenter',
'AndroidPresenter', 'AndroidPresenter',
'DummyAndroidPresenter', 'DummyAndroidPresenter',
'SpeechPresenter', 'SpeechPresenter',
'HapticPresenter',
'PresenterContext']; 'PresenterContext'];
/** /**
@ -111,7 +112,7 @@ Presenter.prototype = {
* Visual presenter. Draws a box around the virtual cursor's position. * Visual presenter. Draws a box around the virtual cursor's position.
*/ */
this.VisualPresenter = function VisualPresenter() {} this.VisualPresenter = function VisualPresenter() {};
VisualPresenter.prototype = { VisualPresenter.prototype = {
__proto__: Presenter.prototype, __proto__: Presenter.prototype,
@ -179,7 +180,7 @@ VisualPresenter.prototype = {
* Android presenter. Fires Android a11y events. * Android presenter. Fires Android a11y events.
*/ */
this.AndroidPresenter = function AndroidPresenter() {} this.AndroidPresenter = function AndroidPresenter() {};
AndroidPresenter.prototype = { AndroidPresenter.prototype = {
__proto__: Presenter.prototype, __proto__: Presenter.prototype,
@ -332,7 +333,7 @@ AndroidPresenter.prototype = {
* A speech presenter for direct TTS output * A speech presenter for direct TTS output
*/ */
this.SpeechPresenter = function SpeechPresenter() {} this.SpeechPresenter = function SpeechPresenter() {};
SpeechPresenter.prototype = { SpeechPresenter.prototype = {
__proto__: Presenter.prototype, __proto__: Presenter.prototype,
@ -372,6 +373,24 @@ SpeechPresenter.prototype = {
} }
}; };
/**
* A haptic presenter
*/
this.HapticPresenter = function HapticPresenter() {};
HapticPresenter.prototype = {
__proto__: Presenter.prototype,
type: 'Haptic',
PIVOT_CHANGE_PATTHERN: [20],
pivotChanged: function HapticPresenter_pivotChanged(aContext, aReason) {
return { type: this.type, details: { pattern: this.PIVOT_CHANGE_PATTHERN } };
}
};
/** /**
* PresenterContext: An object that generates and caches context information * PresenterContext: An object that generates and caches context information
* for a given accessible and its relationship with another accessible. * for a given accessible and its relationship with another accessible.