Closed Bug 243588 Opened 21 years ago Closed 21 years ago

Consider optimizing the inline style stuff in nsTextControlFrame

Categories

(Core :: Layout: Form Controls, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

On testcases with lots of inputs, we're spending up to 10% of the time parsing
the inline style on the anonymous div inside the input.... I wonder whether we
can parse that once and then have a CSS rule that we just apply to all such
divs.  It seems like we should be able to have a (static, say) nsICSSStyleRule
about and just use SetInlineStyleRule to set it.

Thoughts?  This should work pretty decently, right?
We could just add two items to nsCSSAnonBoxList.h
Hmm... So we could.  That's definitely the way to go.
So basically, we'd need to create a frame ourselves in
nsTextControlFrame::CreateFrameFor and make sure to init it with the right style
context?

Note that ::-moz-singleline-textcontrol-frame is already in nsCSSAnonBoxList
(though unused in our code).

I was also looking at the overflow stuff, and it seems like the right way to do
overflow is to set it to inherit on the div and to auto on textarea and that way
pages that want to override overflow can...
Although, doing it right (with scrollframe and all that jazz could be hard).  It
may be better to modify anonymous frame construction to allow the callee to pass
out a style context from CreateFrameFor() or another function on
nsIAnonymousContentCreator (to be added).
Another option is to use rules like:

textarea > .anonymous-div {
 /* whatever */
}

In forms.css and not bother with an anon box name.  If we use a class there it
shouldn't affect most style resolution very much at at all.

This approach has the benefit of not requiring changes to the
nsIAnonymousContentCreator interface and the like.
Blocks: 212763
Attached patch Like soSplinter Review
Comment on attachment 148536 [details] [diff] [review]
Like so

David, what do you think?  If you prefer, I'll work on the pseudo-element
approach instead.
Attachment #148536 - Flags: superreview?(dbaron)
Attachment #148536 - Flags: review?(dbaron)
Comment on attachment 148536 [details] [diff] [review]
Like so

sure, but also remove the unneeded pseudo-element from xbl-forms.css
Attachment #148536 - Flags: superreview?(dbaron)
Attachment #148536 - Flags: superreview+
Attachment #148536 - Flags: review?(dbaron)
Attachment #148536 - Flags: review+
Assignee: nobody → bzbarsky
Fixed.  No Tp impact that I can see, saves 600 bytes codesize...
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: