Open Bug 379089 Opened 17 years ago Updated 2 years ago

reduce #include dependencies on style system headers

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=c++])

Attachments

(2 files)

I have a patch (maybe more later) to reduce #include dependencies on style system headers.
Attachment #263088 - Flags: superreview?(bzbarsky)
Attachment #263088 - Flags: review?(bzbarsky)
Comment on attachment 263088 [details] [diff] [review]
reduce what nsRuleData.h pulls in

r+sr=bzbarsky
Attachment #263088 - Flags: superreview?(bzbarsky)
Attachment #263088 - Flags: superreview+
Attachment #263088 - Flags: review?(bzbarsky)
Attachment #263088 - Flags: review+
Above patch checked in to trunk.
The other big thing I could do here is make nsStyleStructFwd.h forward-declare all the structs, and then make nsRuleNode.h include nsStyleStructFwd.h instead of nsStyleStruct.h.  This would mean that nsIFrame.h, nsStyleContext.h, or nsRuleNode.h would no longer bring in all the style structs.
Flags: in-testsuite-
Whiteboard: [mentor=dbaron]
Whiteboard: [mentor=dbaron] → [mentor=dbaron][lang=c++]
Mentor: dbaron
Whiteboard: [mentor=dbaron][lang=c++] → [lang=c++]
I'm having a look at this bug.
I changed nsRuleNode.h to no longer include nsStyleStruct.h, but nsStyleStructFwd.h.
Most of the changes needed were moving function definitions into the souce files (and adding the nsStyleStruct.h include there).
I didn't change any function signatures, which is why I had to add nsStyleStruct.h as include in nsComputedDOMStyle.h.

I'm not sure if any additional changes are needed, so comments are certainly welcome.
Attachment #8485547 - Flags: feedback?(dbaron)
Comment on attachment 8485547 [details] [diff] [review]
nsRuleNode.h no longer includes nsStyleStruct.h


So this patch does a bunch of moving of things from .h files to .cpp files.  This is bad for performance:  methods defined within the class definition are implicitly inline, which is what we wanted here; we don't want to change that.

If this is hard to avoid, then it might be worth just giving up; it's more important that the browser be fast than that compiling the browser be fast.


Also, in nsStyleStructFwd.h, instead of writing out all the names of the style structs, you should #include "nsStyleStructList.h" to do that.  (See other uses of nsStyleStructList.h for
Attachment #8485547 - Flags: feedback?(dbaron) → feedback-
Thanks for the feedback! I had another look at the 3 headers (nsIFrame.h, nsStyleContext.h and nsRuleNode.h), but I see no way to use nsStyleStructFwd.h without moving at least some methods into the .cpp files. I'll leave this bug alone then, since I don't see any way to really progress further.
Assignee: dbaron → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: