dom/browser-element/BrowserElementPanning.js kinetic panning does not work with hand made touch events

RESOLVED FIXED

Status

Firefox OS
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: vingtetun, Assigned: vingtetun)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Created attachment 740939 [details] [diff] [review]
Patch

Let's normalize them.
Assignee: nobody → 21
Attachment #740939 - Flags: review?(fabrice)
Comment on attachment 740939 [details] [diff] [review]
Patch

Review of attachment 740939 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/browser-element/BrowserElementPanning.js
@@ +681,5 @@
>  
> +  _getTime: function kp_getTime(time) {
> +    // Touch events generated by the platform or hand-made have different
> +    // timestamps values. Let's normalize them.
> +    if (time > 2 * Date.now()) {

that's quite... ugly no? time > Date.now() is not enough?

@@ +685,5 @@
> +    if (time > 2 * Date.now()) {
> +      return Math.floor(time / 1000);                                          
> +    } else {                                                                   
> +      return time;
> +    }     

Nit: You have a bunch of trailing whitespace at almost every line.
Attachment #740939 - Flags: review?(fabrice)
The right fix for this would be bug 77992. In the meantime I will address your comments and land that.
Comment on attachment 747940 [details] [diff] [review]
Patch

Review of attachment 747940 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/browser-element/BrowserElementPanning.js
@@ +681,5 @@
>  
>    momentums: [],
>    record: function kp_record(delta, timestamp) {
> +    this.momentums.push({ 'time': this._getTime(timestamp),
> +                        'dx' : delta.x, 'dy' : delta.y });

nit: align 'dx' with 'time'

@@ +686,5 @@
>      this.distance.add(delta.x, delta.y);
>    },
>  
> +  _getTime: function kp_getTime(time) {
> +    // Touch events generated by the platform or hand-made have are defined in

nit: s/have//
Attachment #747940 - Flags: review?(fabrice) → review+
Depends on: 77992
https://hg.mozilla.org/projects/birch/rev/1702ed606df7
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: x86_64 → All

Comment 7

5 years ago
https://hg.mozilla.org/mozilla-central/rev/1702ed606df7
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.