Closed Bug 1159263 Opened 5 years ago Closed 5 years ago

Add support to nsCaret to stop blinking after a set of cycles

Categories

(Firefox for Android :: Text Selection, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 40
Tracking Status
firefox40 --- fixed

People

(Reporter: mfinkle, Assigned: mfinkle)

Details

Attachments

(1 file)

We have feedback from partners that blinking cursors can increase power usage. We already have "ui.caretBlinkTime" to control the duration of a blink cycle, but we could add code to stop blinking after a few seconds.
After bug 1048752, roc seems to own nsCaret. I added snorp for the specific change to use a countdown value of 10 for mobile, but feedback on the C++ welcome too.

This patch adds a cycle countdown feature. Each time we ResetBlinking, we grab the "ui.caretBlinkCount" and use it in the timer callback. If the value is -1, we skip the countdown logic. Otherwise, we decrement and check for the value to hit 0. When it does, we simply StopBlinking and wait for the next ResetBlinking to start the process over again.

I tested the mobile value of 10 in a few situations, and it seems to work fine. The -1 (or no pref defined) situation works well too.

Try push here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=854d79dead4d
Assignee: nobody → mark.finkle
Attachment #8598670 - Flags: review?(snorp)
Attachment #8598670 - Flags: review?(roc)
Comment on attachment 8598670 [details] [diff] [review]
turn-off-your-blinker v0.1

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

::: mobile/android/app/mobile.js
@@ +47,5 @@
>  /* allow scrollbars to float above chrome ui */
>  pref("ui.scrollbarsCanOverlapContent", 1);
>  
> +/* turn off the caret blink after 10 cycles */
> +pref("ui.caretBlinkCount", 10);

I wonder if 10 is too many?
Attachment #8598670 - Flags: review?(snorp) → review+
https://hg.mozilla.org/mozilla-central/rev/bd3b4ef4eedd
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 40
You need to log in before you can comment on or make changes to this bug.