[FIX]Using background-image CSS style for treechildren::-moz-tree-row causes excessive CPU load

RESOLVED FIXED in mozilla1.9alpha1

Status

()

Core
XUL
P1
normal
RESOLVED FIXED
12 years ago
9 years ago

People

(Reporter: Matthew Gertner, Assigned: bz)

Tracking

(4 keywords)

Trunk
mozilla1.9alpha1
fixed1.8.1, regression, testcase, verified1.8.0.2
Points:
---
Bug Flags:
blocking1.8.1 ?
blocking1.8.0.2 +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [rft-dl])

Attachments

(3 attachments, 6 obsolete attachments)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

We are using PNG images as background for a XUL tree using the background-image style attached to treechildren::-moz-tree-row. When the tree is visible, CPU usage immediately goes to 100%. I don't think that the specific images are the problem since I tried converting them to GIFs, changing the size, etc. and the problem persists.

Reproducible: Always
(Reporter)

Comment 1

12 years ago
I just noticed that the problem only occurs when properties are specified for the tree row using treechildren::-moz-tree-row(X, Y, ...).
(Reporter)

Comment 2

12 years ago
Created attachment 208192 [details]
Example of a stylesheet that causes the problem.
Assignee: dbaron → Jan.Varga
Component: Style System (CSS) → XP Toolkit/Widgets: Trees
QA Contact: ian → xptoolkit.trees
(Reporter)

Comment 3

11 years ago
Created attachment 209374 [details]
XUL file that uses the CSS

This is the XUL file associated with the CSS. The important part is the vbox with id="apPeerTreeBox".
So.. I linked to that CSS file from that XUL, changed the images in the CSS file to https://www.mozilla.org/images/header_logo.gif and there was no CPU usage at all.  I suspect at least part of this is that there are no treerows in that XUL... What's a XUL file that actually _does_ show the problem?  
(Reporter)

Comment 5

11 years ago
Created attachment 209433 [details]
Improved XUL example

Here's a new XUL file that reproduces the bug without the need for additional JavaScript. Obviously the path to the CSS must be tweaked. The problem is definitely linked to the properties of the tree rows. If I set properties for just one row, there is no problem. If I set "checked leaf" for both there is also no problem. It is only when I set one to "checked leaf" and the other to "unchecked leaf" that the process goes to 100%.
(Reporter)

Updated

11 years ago
Attachment #209374 - Attachment is obsolete: true
Created attachment 209449 [details]
Stylesheet pointing at actual image
Attachment #208192 - Attachment is obsolete: true
Created attachment 209450 [details]
XUL pointing to that CSS

Matthew, with this testcase (which points to the CSS, which points to the bugzilla image), I see zero CPU usage in a current trunk seamonkey build.  Do you see the CPU problem with it in a trunk build?
Attachment #209433 - Attachment is obsolete: true
I also see zero CPU usage in Firefox 1.0.7 (release build) and Firefox 1.5.0.1 release candidate (debug build).

All of this on Linux.  Is this a Windows-only issue?
(Reporter)

Comment 9

11 years ago
If you aren't seeing the symptoms under Linux, it's very possible this is a Windows-only issue. I've only tested on Windows with the 1.8 branch.
But you do see the problem when loading from bugzilla the XUL file I attached?
(Reporter)

Comment 11

11 years ago
Yes, but only when I select the first row in the tree. Not sure what's going on since I didn't need to do that in the original example, but I assume it's the same problem and this should enable you to reproduce it.
Hmm.... That worksforme too.  :(

Do you have a build with symbols you could test in a debugger, by chance?  If so, just breaking randomly and seeing where you are in the code would help...
Fwiw, this is worksforme with current trunk build on WindowsXP.
(Reporter)

Comment 14

11 years ago
Created attachment 209585 [details]
New stylesheet referencing original images

I think the problem may be somehow linked to the actual images we are using, so I'm uploading a new stylesheet that references them instead of the images used by Boris.
Attachment #209449 - Attachment is obsolete: true
(Reporter)

Comment 15

11 years ago
Created attachment 209586 [details]
XUL file using new stylesheet
(Reporter)

Updated

11 years ago
Attachment #209450 - Attachment is obsolete: true
(Reporter)

Comment 16

11 years ago
Try the latest XUL file. I get the problem on both my official release and debug version of FF 1.5 on Windows XP (CPU immediately goes to 100%).
With the latest XUL file, I can see the 100% cpu.
I've made a modified testcase here (I can't seem to use data uri inside ::-moz-tree-row selector?):
http://wargers.org/mozilla/bug323028/323028_excessive_cpu.xul
Here I have a backtrace with a breakpoint in nsTreeSelection::InvalidateSelection:
http://wargers.org/mozilla/bug323028/bt_323028.txt
This regressed between 2004-09-20 and 2004-09-21:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2004-09-20+06%3A00%3A00&maxdate=2004-09-21+10%3A00%3A00&cvsroot=%2Fcvsroot
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.9a1?
Flags: blocking1.8.1?
Keywords: regression, testcase
This is a regression from bug 259139
Blocks: 259139
Created attachment 209711 [details] [diff] [review]
Patch to fix
Assignee: Jan.Varga → bzbarsky
Status: NEW → ASSIGNED
Attachment #209711 - Flags: superreview?(dbaron)
Attachment #209711 - Flags: review?(dbaron)
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Summary: Using background-image CSS style for treechildren::-moz-tree-row causes excessive CPU load → [FIX]Using background-image CSS style for treechildren::-moz-tree-row causes excessive CPU load
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 209711 [details] [diff] [review]
Patch to fix

Replace "return" with "return rv" and r+sr=dbaron.
Attachment #209711 - Flags: superreview?(dbaron)
Attachment #209711 - Flags: superreview+
Attachment #209711 - Flags: review?(dbaron)
Attachment #209711 - Flags: review+
Created attachment 209781 [details] [diff] [review]
Updated to comments
Attachment #209711 - Attachment is obsolete: true
Fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

I think this is worth it for the 1.8 branch.
Attachment #209781 - Flags: approval1.8.1?
Flags: blocking1.9a1?
Attachment #209781 - Flags: approval1.8.1? → branch-1.8.1?(dbaron)
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

It's likely worth it to take this on the 1.8.0 branch too.  This is a very safe fix that just reverts to the behavior this code had in 1.7.
Attachment #209781 - Flags: approval1.8.0.2?
Attachment #209781 - Flags: branch-1.8.1?(dbaron) → branch-1.8.1+
Fixed on 1.8.1 branch.
Keywords: fixed1.8.1
Flags: blocking1.8.0.2+
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

approved for 1.8.0 branch, a=dveditz
Attachment #209781 - Flags: approval1.8.0.2? → approval1.8.0.2+
Fixed for 1.8.0.2.
Keywords: fixed1.8.0.2
Marking [rft-dl] (ready for testing in Firefox 1.5.0.2 release candidates)
Whiteboard: [rft-dl]

Comment 29

11 years ago
v.fixed on 1.8.0 branch with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2, cpu usage normal with latest xul testcase.
Keywords: fixed1.8.0.2 → verified1.8.0.2

Updated

9 years ago
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: xptoolkit.trees → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.