Closed Bug 323028 Opened 19 years ago Closed 19 years ago

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

Categories

(Core :: XUL, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: matthew.gertner, Assigned: bzbarsky)

References

Details

(4 keywords, Whiteboard: [rft-dl])

Attachments

(3 files, 6 obsolete files)

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
I just noticed that the problem only occurs when properties are specified for the tree row using treechildren::-moz-tree-row(X, Y, ...).
Assignee: dbaron → Jan.Varga
Component: Style System (CSS) → XP Toolkit/Widgets: Trees
QA Contact: ian → xptoolkit.trees
Attached file XUL file that uses the CSS (obsolete) —
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?  
Attached file Improved XUL example (obsolete) —
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%.
Attachment #209374 - Attachment is obsolete: true
Attached file Stylesheet pointing at actual image (obsolete) —
Attachment #208192 - Attachment is obsolete: true
Attached file XUL pointing to that CSS (obsolete) —
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?
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?
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.
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
Attachment #209450 - Attachment is obsolete: true
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
Attached patch Patch to fix (obsolete) — Splinter Review
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+
Attachment #209711 - Attachment is obsolete: true
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 19 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]
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.
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.

Attachment

General

Created:
Updated:
Size: