Closed Bug 1063265 Opened 10 years ago Closed 10 years ago

Stop Blinking the Text Caret when it isn't visible

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox33 wontfix, firefox34 fixed, firefox35 fixed, b2g-v2.1 fixed, b2g-v2.2 fixed)

RESOLVED FIXED
2.1 S4 (12sep)
Tracking Status
firefox33 --- wontfix
firefox34 --- fixed
firefox35 --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: mchang, Assigned: mchang)

References

Details

Attachments

(1 file, 4 obsolete files)

+++ This bug was initially created as a clone of Bug #1062119 +++

The caret is blinking even when the screen is off, causing the refresh driver to tick and paint even though it isn't visible. Change the behavior so that the caret doesn't tick or request a paint unless the caret is visible.
Attached patch caret.patch (obsolete) — Splinter Review
On nsCaret::ResetBlinking, if the caret isn't visible, we return early. We only schedule paints if the caret is visible now. I see most of the time ResetBlinking is followed by SchedulePaint, but we still sometimes SchedulePaint without ResetBlinking. Just a first stab. Thanks!
Attachment #8484670 - Flags: review?(roc)
Attached patch caret.patch (obsolete) — Splinter Review
Fixed a whitespace.
Attachment #8484670 - Attachment is obsolete: true
Attachment #8484670 - Flags: review?(roc)
Attachment #8484674 - Flags: review?(roc)
Comment on attachment 8484674 [details] [diff] [review]
caret.patch

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

diff -U8 please

::: layout/base/nsCaret.cpp
@@ +403,5 @@
>      return;
>    }
> +  if (!IsVisible()) {
> +    return;
> +  }

We shouldn't do this. If the caret changes from visible to not visible we need to schedule a paint.

@@ +553,5 @@
>  
> +  if (!IsVisible()) {
> +    StopBlinking();
> +    return;
> +  }

Let's just check mVisible here. IsVisible might return false because of IsMenuPopupHidingCaret() and in that case we should probably keep running the timer, since we might not get notified when IsMenuPopupHidingCaret() becomes false again.
Attachment #8484674 - Flags: review?(roc) → review-
Updated with feedback from comment 3. Thanks!
Attachment #8484674 - Attachment is obsolete: true
Attachment #8485050 - Flags: review?(roc)
Comment on attachment 8485050 [details] [diff] [review]
Bug 1063265: Don't blick the caret unless it is visible

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

::: layout/base/nsCaret.cpp
@@ +547,5 @@
>  void nsCaret::ResetBlinking()
>  {
>    mIsBlinkOn = true;
>  
> +  if (mReadOnly || mVisible) {

!mVisible !!!
Attachment #8485050 - Flags: review?(roc) → review-
Attached patch caret.patch (obsolete) — Splinter Review
Ahh fail, sorry!
Attachment #8485050 - Attachment is obsolete: true
Attachment #8485194 - Flags: review?(roc)
Comment on attachment 8485194 [details] [diff] [review]
caret.patch

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

:-)
Attachment #8485194 - Flags: review?(roc) → review+
Carrying r+ forward. Updated with proper commit message and author. Successful try: https://tbpl.mozilla.org/?tree=Try&rev=23e1167ca8e5
Attachment #8485194 - Attachment is obsolete: true
Attachment #8485436 - Flags: review+
Keywords: checkin-needed
Comment on attachment 8485436 [details] [diff] [review]
Bug 1063265: Don't blick the caret unless it is visible. r=roc

Approval Request Comment
[Feature/regressing bug #]: Bug 1062119, continuous CPU usage while the display is off.
[User impact if declined]: We will waste CPU usage even while the screen is off, thus burning battery. Battery with the screen currently lasts less than 24 hours without this patch.
[Describe test coverage new/current, TBPL]: Manual testing to see if CPU is still being used while the screen is off. Turned power on / off 10 times and waited 30 seconds to ensure CPU is idle.
[Risks and why]: Low risk - Previously, we were painting the text carat even though it wasn't actually being displayed. This patch stops painting the text carat when it is not displayed to the user.
[String/UUID change made/needed]: None
Attachment #8485436 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/7bd750b8352e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Attachment #8485436 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: