Gecko:DeCOMtamination: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 18: Line 18:
Here are some places known to need deCOMtamination or general interface cleanup:
Here are some places known to need deCOMtamination or general interface cleanup:


* NS_New*Frame functions. E.g. currently we have
nsresult
NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
{
  NS_PRECONDITION(aNewFrame, "null OUT ptr");
  if (nsnull == aNewFrame) {
    return NS_ERROR_NULL_POINTER;
  }
  ViewportFrame* it = new (aPresShell) ViewportFrame;
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  *aNewFrame = it;
  return NS_OK;
}
This should change to
nsIFrame* NS_NewViewportFrame(nsIPresShell* aPresShell)
{
  return new (aPresShell) ViewportFrame;
}
* 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.
* 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.
* 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 https://bugzilla.mozilla.org/show_bug.cgi?id=301313)
* 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.
4

edits