Gecko:DeCOMtamination: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 4: Line 4:


If you want to get started, follow these steps. If you get stuck, don't give up, mail roc for help!
If you want to get started, follow these steps. If you get stuck, don't give up, mail roc for help!
# Make sure you have successfully built a Mozilla product from source (preferably Mozilla Suite or Firefox). Instructions for Windows here: http://texturizer.net/firefox/build.html  Linux here: http://daihard.home.comcast.net/firefox/build.html You will want to change your configure options to include "ac_add_options --enable-debug" and "ac_add_options --disable-optimize".
# Make sure you have successfully built a Mozilla product from source (preferably Mozilla Suite or Firefox). Official instructions can be found [[mdc:Build_Documentation|on MDC]]. You will want to change your configure options to include "ac_add_options --enable-debug" and "ac_add_options --disable-optimize".
# Choose one of the deCOMtamination problems below, or email roc for suggestions.
# Choose one of the deCOMtamination problems below, or email roc for suggestions.
# Note in this wiki page that you are working on the task.
# Note in this wiki page that you are working on the task.
Line 15: Line 15:
Here are some places known to need deCOMtamination or general interface cleanup:
Here are some places known to need deCOMtamination or general interface cleanup:


* <em>We are not going to do this one until dbaron's reflow branch has landed</em> Box methods in nsIFrame: http://bugzilla.mozilla.org/show_bug.cgi?id=243370 See the section under "// BOX LAYOUT METHODS" in nsIFrame.h. GetPrefSize, GetMinSize, GetMaxSize, GetFlex, GetOrdinal, GetAscent, IsCollapsed, IsDirty, HasDirtyChildren, GetChildBox, GetNextBox, GetParentBox, GetBorderAndPadding, GetBorder, GetPadding, GetInset, GetMargin, GetLayoutManager, GetContentRect, GetClientRect, GetVAlign, GetHAlign, GetOverflow, GetIndexOf, and ChildrenMustHaveWidgets probably can all return their results directly instead of via an out parameter. GetOrientation and GetDirection can be removed and all callers redirected to IsHorizontal and IsNormalDirection. GetContentRect should be removed since it's trivial, and GetClientRect should be renamed to GetContentRect and return the rect directly. Some of these methods may only have one implementation in which case we can make them non-virtual or even inline.
* <em>We are not going to do this one until dbaron's reflow branch has landed</em> Box methods in nsIFrame: {{bug|243370}} See the section under "// BOX LAYOUT METHODS" in nsIFrame.h. GetPrefSize, GetMinSize, GetMaxSize, GetFlex, GetOrdinal, GetAscent, IsCollapsed, IsDirty, HasDirtyChildren, GetChildBox, GetNextBox, GetParentBox, GetBorderAndPadding, GetBorder, GetPadding, GetInset, GetMargin, GetLayoutManager, GetContentRect, GetClientRect, GetVAlign, GetHAlign, GetOverflow, GetIndexOf, and ChildrenMustHaveWidgets probably can all return their results directly instead of via an out parameter. GetOrientation and GetDirection can be removed and all callers redirected to IsHorizontal and IsNormalDirection. GetContentRect should be removed since it's trivial, and GetClientRect should be renamed to GetContentRect and return the rect directly. Some of these methods may only have one implementation in which case we can make them non-virtual or even inline.
* Not really deCOMtamination, but anyway: many frames have an mPresContext field. This should be removed, and uses of that field can just call GetPresContext on the frame. (Some work on this in https://bugzilla.mozilla.org/show_bug.cgi?id=301313)
* Not really deCOMtamination, but anyway: many frames have an mPresContext field. This should be removed, and uses of that field can just call GetPresContext on the frame. (Some work on this in <strike>{{bug|301313}}</strike>)
* Lots of the non-Box methods of nsIFrame could be cleaned up too. We can remove the nsPresContext parameter from almost all of them. Many of them return their result in an 'out' parameter and should just return the result directly. Understanding the best way to do this for various methods will require some more creativity and understanding of the existing code.
* Lots of the non-Box methods of nsIFrame could be cleaned up too. We can remove the nsPresContext parameter from almost all of them. Many of them return their result in an 'out' parameter and should just return the result directly. Understanding the best way to do this for various methods will require some more creativity and understanding of the existing code.
* in many cases we have a singleton interface like nsIComboboxControlFrame that is only implemented by one class, is not defined in IDL (and is therefore not scriptable), and is not visible outside Gecko. In these cases we can save code and data size by eliminating the interface, moving its methods to the concrete class and devirtualizing them, and casting to the class directly, like we just did with nsGfxButtonControlFrame. We can even assign the class an IID so you can get to it with QueryInterface. For example you can QI to nsBlockFrame this way.(https://bugzilla.mozilla.org/show_bug.cgi?id=326944)
* in many cases we have a singleton interface like nsIComboboxControlFrame that is only implemented by one class, is not defined in IDL (and is therefore not scriptable), and is not visible outside Gecko. In these cases we can save code and data size by eliminating the interface, moving its methods to the concrete class and devirtualizing them, and casting to the class directly, like we just did with nsGfxButtonControlFrame. We can even assign the class an IID so you can get to it with QueryInterface. For example you can QI to nsBlockFrame this way.({{bug|326944}})
* Not really deCOMtamination, but we have new methods nsIContent::AttrValueIs and nsIContent::FindAttrValueIn that can be used in many many places where nsIContent::GetAttr is currently used. The new methods reduce code size and are faster. We need to convert GetAttr calls to use the new methods.(https://bugzilla.mozilla.org/show_bug.cgi?id=333896)
* Not really deCOMtamination, but we have new methods nsIContent::AttrValueIs and nsIContent::FindAttrValueIn that can be used in many many places where nsIContent::GetAttr is currently used. The new methods reduce code size and are faster. We need to convert GetAttr calls to use the new methods.(<strike>{{bug|333896}}</strike>)
Confirmed users
161

edits