Commit 26d8cc3a authored by mjudge%netscape.com's avatar mjudge%netscape.com
Browse files

fixed memory leaks in nsRangelist.cpp. uninitialized memory in nsTextframe,...

fixed memory leaks in nsRangelist.cpp.  uninitialized memory in nsTextframe, simplified APIs in nsIFrame and the underlying implementations. see layout.checkins
parent 63ec363d
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -35,6 +35,23 @@
{ 0xf46e4171, 0xdeaa, 0x11d1, \
  { 0x97, 0xfc, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }

/** nsSelectionStruct is used to pass structured parameters to the SelectionCalls.
 */
struct nsSelectionStruct
{
  enum {SELON = 1,SELALL = 2,SELTOEND = 4,SELTOBEGIN = 8,CHECKANCHOR=16,CHECKFOCUS=32};//this is not a bit flag
  PRUint32 mType;
  PRUint32 mStartContent;//in content offsets.
  PRUint32 mEndContent;
  PRUint32 mStartFrame;
  PRUint32 mEndFrame;
  PRUint32 mAnchorOffset;
  PRUint32 mFocusOffset;
  nsDirection mDir; //tells you if you have to swap the begin and end points.
  PRBool   mForceRedraw;
};


//----------------------------------------------------------------------

// Selection interface
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include "nsIEventStateManager.h"
#include "nsDOMEvent.h"
#include "nsHTMLParts.h"
#include "nsIFrameSelection.h"
#include "nsIDOMSelection.h"
#include "nsLayoutCID.h"
#include "nsIDOMRange.h"
@@ -62,6 +61,7 @@
#include "nsParserCIID.h"
#include "nsHTMLContentSinkStream.h"
#include "nsXIFDTD.h"
#include "nsIFrameSelection.h"


static PRBool gsNoisyRefs = PR_FALSE;
+16 −0
Original line number Diff line number Diff line
@@ -50,6 +50,22 @@ public:
   *  @param aFrame will be the frame to scroll into view.
   */
  NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame) = 0;

  /**
   * Returns the primary frame associated with the content object.
   *
   * The primary frame is the frame that is most closely associated with the
   * content. A frame is more closely associated with the content that another
   * frame if the one frame contains directly or indirectly the other frame (e.g.,
   * when a frame is scrolled there is a scroll frame that contains the frame
   * being scrolled). The primary frame is always the first-in-flow.
   *
   * In the case of absolutely positioned elements and floated elements,
   * the primary frame is the frame that is out of the flow and not the
   * placeholder frame.
   */
  NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
                                nsIFrame**  aPrimaryFrame) const = 0;
};


+6 −14
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ class nsIFocusTracker;
struct nsPoint;
struct nsRect;
struct nsStyleStruct;
struct nsSelectionStruct;

struct PRLogModuleInfo;

@@ -554,27 +555,18 @@ public:
  /** 
   *  Called to set the selection of the frame based on frame offsets.  you can FORCE the frame
   *  to redraw event if aSelected == the frame selection with the last parameter.
   *  @param aSelected  selected or not.
   *  @param aBeginOffset is the offset from the start of the frame, to make the selection
   *  @param aEndOffset is the end of the offset of the selection.
   *  @param aForceRedraw force the frame to redraw irrespective of the old state.
   *  data in struct may be changed when passed in.
   *  @param nsSelectionStruct will hold the data pertinant to the Selection,  Selected or not ect.
   */
  NS_IMETHOD  SetSelected(PRBool aSelected, PRInt32 aBeginOffset, PRInt32 aEndOffset, PRBool aForceRedraw) = 0;
  NS_IMETHOD  SetSelected(nsSelectionStruct *) = 0;

  /** 
   * Called to start a selection with this frame content.  
   * @param aSelected Selected or not?
   * @param aBeginContentOffset where to begin the selection in content offsets
   * @param aEndContentOffset where to end the selection in content offsets
   * @param aAnchorOffset  if this is set(not -1) it will tell the implementation of nsIFrame where
   *        to put the anchor in content offsets.
   * @param aFocusOffset if this is set(not -1) it will tell the implementation of nsIFrame where
   *        to put the focus in content offsets.
   * @param aSS is the struct that holds the data instead of passing in so many parameters
   * @param aFocusTracker will allow the frame to set the focus to what it needs.
   * @param return value of which frame (maybe not this one, maybe one of its siblings)
   */
  NS_IMETHOD  SetSelectedContentOffsets(PRBool aSelected, PRInt32 aBeginContentOffset, PRInt32 aEndContentOffset,
                                        PRInt32 aAnchorOffset, PRInt32 aFocusOffset, PRBool aForceRedraw,
  NS_IMETHOD  SetSelectedContentOffsets(nsSelectionStruct *aSS,
                                        nsIFocusTracker *aTracker,
                                        nsIFrame **aActualSelected)=0;

+17 −0
Original line number Diff line number Diff line
@@ -35,6 +35,23 @@
{ 0xf46e4171, 0xdeaa, 0x11d1, \
  { 0x97, 0xfc, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }

/** nsSelectionStruct is used to pass structured parameters to the SelectionCalls.
 */
struct nsSelectionStruct
{
  enum {SELON = 1,SELALL = 2,SELTOEND = 4,SELTOBEGIN = 8,CHECKANCHOR=16,CHECKFOCUS=32};//this is not a bit flag
  PRUint32 mType;
  PRUint32 mStartContent;//in content offsets.
  PRUint32 mEndContent;
  PRUint32 mStartFrame;
  PRUint32 mEndFrame;
  PRUint32 mAnchorOffset;
  PRUint32 mFocusOffset;
  nsDirection mDir; //tells you if you have to swap the begin and end points.
  PRBool   mForceRedraw;
};


//----------------------------------------------------------------------

// Selection interface
Loading