Closed Bug 863702 Opened 11 years ago Closed 11 years ago

[B2G] :active state is sometime not rendered if you tap quickly

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: rik, Assigned: vingtetun)

References

Details

Attachments

(1 file, 2 obsolete files)

When taping an item that has an :active state, if you do it really fast, the :active rules will not be rendered. Because of that, users can think that a tap was not registered and tap a second time or think the app is not reactive.

I think we should let :active be "active" for a certain amount of time (to be determined). If the user taps another element, we should switch the :active state immediately to that new element.
So the way I could imagine this working is that we'd extend :active applying after the mouseup until either:
 (a) a pref-controlled number of milliseconds since mouse*down* have elapsed, or
 (b) there's another mousedown
Component: Layout: View Rendering → CSS Parsing and Computation
The patch at https://bug921824.bugzilla.mozilla.org/attachment.cgi?id=811675 will fix it. I don't really like it tbh because it spin the event loop and delay the mouse events sequence. And because there are delayed the :active class last longer.

Now, even if I don't like it it may worth it since it won't delayed touch events and will improve a lot the feeling of the device, both in terms of reliability and responsiveness.
Attachment #813852 - Flags: review?(fabrice) → review+
Not until it hits m-c :)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: ryanvm → 21
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #6)
> Not until it hits m-c :)

Oups! sorry about that. And followed by a backout!
Attached patch bug863702.patch (obsolete) — Splinter Review
Let's not break clicks...
Attachment #813852 - Attachment is obsolete: true
Attachment #816655 - Flags: review?(fabrice)
Comment on attachment 816655 [details] [diff] [review]
bug863702.patch

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

Can you send this one to try? Meanwhile I'll try to thing about a less ugly solution.

::: dom/browser-element/BrowserElementPanning.js
@@ +78,5 @@
>        return;
>      }
>  
> +    var start = Date.now();
> +    var thread = Services.tm.currentThread;

s/var/let

@@ +82,5 @@
> +    var thread = Services.tm.currentThread;
> +    while (this._block && (Date.now() - start) < this._activeDurationMs) {
> +      thread.processNextEvent(true);
> +    }
> +    this._block = false;

'_block' is a bit too generic. And oh, the evil of spinning the event loop :(

@@ +240,5 @@
> +      this.notify(this._activationTimer);
> +
> +      this._block = true;
> +      var start = Date.now();
> +      var thread = Services.tm.currentThread;

here too
Attachment #816655 - Flags: review?(fabrice) → feedback+
(In reply to Fabrice Desré [:fabrice] from comment #10)
> Comment on attachment 816655 [details] [diff] [review]
> bug863702.patch
> 
> Review of attachment 816655 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Can you send this one to try? 

Sure I don't want to break events again :)

> Meanwhile I'll try to thing about a less ugly
> solution.
>

If you can I will be more than happy. But tbh I think this kind of code is why people have learned to use touch events to be fast on mobile devices. I bet that other vendors are doing something similar in the background.
Attached patch bug863702.patchSplinter Review
Attachment #816655 - Attachment is obsolete: true
Attachment #817878 - Flags: review?(fabrice)
Attachment #817878 - Flags: review?(fabrice) → review+
https://hg.mozilla.org/mozilla-central/rev/afb6450f58cd
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: