added GetLayoutObjectFor for getting a layout object as an nsISupports

while not exposing nsIFrame.
This commit is contained in:
buster%netscape.com 1999-02-10 23:21:22 +00:00
parent 690df4f8f0
commit 83125f838e
4 changed files with 62 additions and 0 deletions

View File

@ -134,6 +134,15 @@ public:
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
nsIFrame*& aPrimaryFrame) const = 0;
/**
* Returns a layout object associated with the primary frame for the content object.
*
* @param aContent the content object for which we seek a layout object
* @param aResult the resulting layout object as an nsISupports, if found. Refcounted.
*/
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const = 0;
/**
* Get/Set the placeholder frame associated with the specified frame.
*

View File

@ -254,6 +254,8 @@ public:
NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const;
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const;
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const;
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const;
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame*& aPlaceholderFrame) const;
NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame,
@ -1423,6 +1425,26 @@ PresShell::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) co
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const
{
nsresult result = NS_ERROR_NULL_POINTER;
if ((nsnull!=aResult) && (nsnull!=aContent))
{
*aResult = nsnull;
nsIFrame *primaryFrame=nsnull;
result = GetPrimaryFrameFor(aContent, primaryFrame);
if ((NS_SUCCEEDED(result)) && (nsnull!=primaryFrame))
{
result = primaryFrame->QueryInterface(kISupportsIID, (void**)aResult);
}
}
return result;
}
NS_IMETHODIMP
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame*& aPlaceholderFrame) const

View File

@ -134,6 +134,15 @@ public:
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
nsIFrame*& aPrimaryFrame) const = 0;
/**
* Returns a layout object associated with the primary frame for the content object.
*
* @param aContent the content object for which we seek a layout object
* @param aResult the resulting layout object as an nsISupports, if found. Refcounted.
*/
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const = 0;
/**
* Get/Set the placeholder frame associated with the specified frame.
*

View File

@ -254,6 +254,8 @@ public:
NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const;
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const;
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const;
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const;
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame*& aPlaceholderFrame) const;
NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame,
@ -1423,6 +1425,26 @@ PresShell::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) co
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetLayoutObjectFor(nsIContent* aContent,
nsISupports** aResult) const
{
nsresult result = NS_ERROR_NULL_POINTER;
if ((nsnull!=aResult) && (nsnull!=aContent))
{
*aResult = nsnull;
nsIFrame *primaryFrame=nsnull;
result = GetPrimaryFrameFor(aContent, primaryFrame);
if ((NS_SUCCEEDED(result)) && (nsnull!=primaryFrame))
{
result = primaryFrame->QueryInterface(kISupportsIID, (void**)aResult);
}
}
return result;
}
NS_IMETHODIMP
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame*& aPlaceholderFrame) const