Closed Bug 484935 Opened 16 years ago Closed 16 years ago

videocontrols should use display:none on hidden items to minimize CPU usage

Categories

(Toolkit :: Video/Audio Controls, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: Dolske, Assigned: Dolske)

References

Details

(Keywords: verified1.9.1)

Attachments

(1 file, 1 obsolete file)

Attached patch Patch v.1 (obsolete) — Splinter Review
Spun off from bug 483841, since the patch there partially fixed the problem but in a different, more generic way. On my MBP, a video that's finished buffering and not doing anything causes ~2-3% CPU usage according to Activity Monitor. With this patch, CPU usage drops to 0.5-1%.
Attachment #369039 - Flags: review?(enndeakin)
Comment on attachment 369039 [details] [diff] [review] Patch v.1 >-.controlBar { >- visibility: hidden; >- opacity: 0.0; >+.controlBar[hidden] { >+ display: none; Why would the default hidden (from xul.css) not apply? >- // Use .visibility to ignore mouse clicks when hidden. >+ // Trigger CSS suppression of mouse clicks and throbber CPU usage. > if (fader.isVisible) >- fader.element.style.visibility = "visible"; >+ fader.element.removeAttribute("hidden"); > else >- fader.element.style.visibility = "hidden"; >+ fader.element.setAttribute("hidden", "true"); The hidden property is implemented in C++ so doesn't have the xbl and security issues that other properties sometimes have. Thus, the whole block above can be replaced with: fader.element.hidden = !fader.isVisible; >- fader.element.style.visibility = "visible"; >- fader.element.style.opacity = 1.0; >+ fader.element.removeAttribute("hidden"); Similar here
(In reply to comment #1) > >+.controlBar[hidden] { > >+ display: none; > > Why would the default hidden (from xul.css) not apply? Oh, hrm, I wasn't even thinking about XUL having .hidden. Duh.
Attached patch Patch v.2Splinter Review
Turns out I can't set .hidden without triggering the security checks, so I'm still using it as an attribute.
Attachment #369039 - Attachment is obsolete: true
Attachment #369155 - Flags: review?(enndeakin)
Attachment #369039 - Flags: review?(enndeakin)
Comment on attachment 369155 [details] [diff] [review] Patch v.2 Bah, ok. I guess this will have to do.
Attachment #369155 - Flags: review?(enndeakin) → review+
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Attachment #369155 - Flags: approval1.9.1?
Comment on attachment 369155 [details] [diff] [review] Patch v.2 a191=beltzner
Attachment #369155 - Flags: approval1.9.1? → approval1.9.1+
Blocks: 482035
Verified fix on Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b5pre) Gecko/20090507 Shiretoko/3.5b5pre and Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090507 Minefield/3.6a1pre
Status: RESOLVED → VERIFIED
Component: Video/Audio → Video/Audio Controls
Product: Core → Toolkit
QA Contact: video.audio → video.audio
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: