Open Bug 69143 Opened 20 years ago Updated 9 years ago

nsStyleUtil::FindNonTransparentBackground 7% of window paint time


(Core :: CSS Parsing and Computation, defect, P5)





(Reporter: mikepinkerton, Unassigned)



(Keywords: perf)

In profiles of updating the damaged area of a window and painting, 
nsStyleUtil::FindNonTransparntBackground shows up as 7%.

That's a pretty big chunk.
Blocks: 48274
Here are the places where FindNonTransparentBackground() is called:
  nsCSSRendering::PaintBorder()        always
  nsCSSRendering::PaintOutline()       always
  nsCSSRendering::PaintBorderEdges()   always
  nsCSSRendering::RenderSide()         NS_STYLE_BORDER_STYLE_OUTSET
                                       INSET, RIDGE, and GROOVE

Note that RenderSide() is called up to 4 times in PaintRoundedBorder() which is 
called 4 times in PaintBorder().

It could be a good idea to add the following code at the very beginning of 
PaintBorder() and PaintOutline():

  // look for a quick way out
  PRBool noBorder = PR_TRUE;
  for (PRIntn i = 0; i < 4; i ++) {
    PRUint8 borderStyle = aBorderStyle.GetBorderStyle(i);
    if (borderStyle != NS_STYLE_BORDER_STYLE_NONE
     && borderStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
      noBorder = PR_FALSE;
  if (noBorder) {

I'm keeping this bug for now because or its relation to bug 43457.  
FindNonTransparentBackground() is probably the reason why we fetch 
eStyleStruct_Color so often in GetStyleData().  It's one of the 4 structs that 
are fetched the most often, with Display, Text and Position.

I'll do some tests by implementing FindNonTransparentBackground() inside the 
StyleContext itself and see if we have any noticeable results.
Summary: nsStyleUtil::FindNonTransparntBackground 7% of window paint time → nsStyleUtil::FindNonTransparentBackground 7% of window paint time
Target Milestone: --- → mozilla0.9.1
The fix in bug 70831 required to implement FindNonTransparentBackground() in the 
style context.  We could make it a public interface and call it from nsStyleUtil.  
It would be more efficient.

It would be nice to implement in the style context some other utility functions 
that fetch only the most used properties instead of the entire structure they 
belong to.  For instance, we could fetch just the display type instead of the 
nsStyleDisplay structure.
Moving to m0.9.3
Target Milestone: mozilla0.9.1 → mozilla0.9.3
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Target Milestone: mozilla0.9.4 → mozilla1.0
Keywords: mozilla1.0
Moving to mozilla1.1. Engineers are overloaded!
Target Milestone: mozilla1.0 → mozilla1.1
Bulk moving from Moz1.1 to future-P1. I will pull from this list when scheduling
work post Mozilla1.0.
Priority: -- → P1
Target Milestone: mozilla1.1 → Future
cc'ing myself
Assigning pierre's remaining Style System-related bugs to myself.
Assignee: pierre → dbaron
Priority: P1 → P3
Isn't this cross-platform?
This bug is targeted at a Mac classic platform/OS, which is no longer supported
by Please re-target it to another platform/OS if this bug applies
there as well or resolve this bug.

I will resolve this bug as WONTFIX in four weeks if no action has been taken.
To filter this and similar messages out, please filter for "mac_cla_reorg".
OS: Mac System 9.x → MacOS X
Assignee: dbaron → nobody
QA Contact: ian → style-system
This bug hasen't been touched for years and is clearly unowned. Moving back to default assignee/QA so that people, who are watching those can accurately triage this bug.

Also resetting Priority, Target Milestone, Status Whiteboard and Status.
Priority: P3 → --
Target Milestone: Future → ---
You need to log in before you can comment on or make changes to this bug.