Closed Bug 445509 Opened 16 years ago Closed 12 years ago

Make sure CSS text attributes are performant - use nsIFrame instead of computed style

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: aaronlev, Assigned: surkov)

References

(Blocks 3 open bugs)

Details

(Keywords: access, perf)

In patch for bug 34759 Surkov is implementing text attributes. For now he uses GetComputedStyle(), which is fine for testing. However, Roc expressed concerned that GetComputedStyle() is very slow -- much slower than getting info from the frame. We should either just take his word for it or do some testing and possibly change to use the frame.
Summary: Make sure text attributes are performant → Make sure CSS text attributes are performant - use nsIFrame instead of computed style
(In reply to comment #0)
> In patch for bug 34759 Surkov is implementing text attributes. For now he uses
> GetComputedStyle(), which is fine for testing. However, Roc expressed concerned
> that GetComputedStyle() is very slow -- much slower than getting info from the
> frame. We should either just take his word for it or do some testing and
> possibly change to use the frame.
> 

GetComputedStyle() uses nsComputedDOMStyle that calculates styles on response and has complicated logic at the first glance. I don't get why this logic is surplus for us and how nsIFrame can help here.
I would do testing before changing anything, although you might find that getting information from the frame (e.g. via GetStyleText etc) actually gives simpler code.

OTOH I'm not 100% sure the accessibility module can get that data since you don't link to gklayout.
(In reply to comment #2)
> I would do testing before changing anything, although you might find that
> getting information from the frame (e.g. via GetStyleText etc) actually gives
> simpler code.

nsComputedDOMStyle uses GetStyleText(). I just can't understand why the logic of nsComputedDOMStyle is overkill for us? Or is the code nsComputedDOMStyle not optimal? Or does creation of nsComputedDOMStyle takes long time/much memory? Where is a weak place of nsComputedDOMStyle?
It converts everything to an nsIDOMCSSValue XPCOM object, which involves memory allocation, and often converts values to strings which you have to then parse again to use. It's not a huge problem, just extra overhead and more work for you as the user of the API.
Blocks: cleana11y
Status?  Maybe bug 467146 should wait on this?
(In reply to comment #5)
> Status?  Maybe bug 467146 should wait on this?

I think they aren't related. Sure if the current approach doesn't fit to this then you can use approach suggested here like we have for background-color.
(In reply to comment #0)
> In patch for bug 34759

This was actually bug 345759
fixed by bug 728907
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.