mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-20 01:51:39 +00:00
Removed content delegates
This commit is contained in:
parent
bf18ac6970
commit
28c7cf540c
@ -118,9 +118,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aResult) const = 0;
|
||||
|
||||
// XXX deprecated
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX) = 0;
|
||||
|
||||
/**
|
||||
* List the content (and anything it contains) out to the given
|
||||
* file stream. Use aIndent as the base indent during formatting.
|
||||
|
@ -764,12 +764,8 @@ NS_IMETHODIMP StyleSetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
#if 0
|
||||
return mFrameConstructor->ContentInserted(aPresContext, aDocument, aContainer,
|
||||
aChild, aIndexInContainer);
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext,
|
||||
|
@ -85,26 +85,6 @@ static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kICSSStyleRuleIID, NS_ICSS_STYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
|
||||
static nsIContentDelegate* gContentDelegate;
|
||||
|
||||
/**
|
||||
* THE html content delegate. There is exactly one instance of this
|
||||
* class and it's used for all html content. It just turns around
|
||||
* and asks the content object to create the frame.
|
||||
*/
|
||||
class ZContentDelegate : public nsIContentDelegate {
|
||||
public:
|
||||
ZContentDelegate();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult);
|
||||
protected:
|
||||
~ZContentDelegate();
|
||||
};
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
// object that implements nsIDOMAttribute and nsIDOMNode and
|
||||
// nsIScriptObjectOwner
|
||||
@ -218,50 +198,6 @@ private:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ZContentDelegate::ZContentDelegate()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ZContentDelegate, kIContentDelegateIID);
|
||||
|
||||
ZContentDelegate::~ZContentDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ZContentDelegate::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContent, "null ptr");
|
||||
|
||||
// Make sure the content is html content
|
||||
nsIHTMLContent* hc;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
||||
if (NS_OK != rv) {
|
||||
// This means that *somehow* somebody which is not an html
|
||||
// content object got ahold of this delegate and tried to
|
||||
// create a frame with it. Give them back an nsFrame.
|
||||
rv = nsFrame::NewFrame(&frame, aContent, aParentFrame);
|
||||
if (NS_OK == rv) {
|
||||
frame->SetStyleContext(aPresContext, aStyleContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Ask the content object to create the frame
|
||||
rv = hc->CreateFrame(aPresContext, aParentFrame, aStyleContext, frame);
|
||||
NS_RELEASE(hc);
|
||||
}
|
||||
aResult = frame;
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
DOMAttribute::DOMAttribute(const nsString& aName, const nsString& aValue)
|
||||
: mName(aName), mValue(aValue)
|
||||
{
|
||||
@ -708,13 +644,6 @@ nsGenericHTMLElement::nsGenericHTMLElement()
|
||||
mContent = nsnull;
|
||||
mScriptObject = nsnull;
|
||||
mListenerManager = nsnull;
|
||||
|
||||
// Create shared content delegate if this is the first html content
|
||||
// object being created.
|
||||
if (nsnull == gContentDelegate) {
|
||||
NS_NEWXPCOM(gContentDelegate, ZContentDelegate);
|
||||
NS_ADDREF(gContentDelegate);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
@ -725,22 +654,6 @@ nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
NS_IF_RELEASE(mTag);
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
// XXX what about mScriptObject? it's now safe to GC it...
|
||||
|
||||
#if 0
|
||||
// This code didn't work; and since content delegates are going
|
||||
// away, I'm not going to fix it. So for now, we will leak a content
|
||||
// delegate per address space. whoope doopie. -- kipp
|
||||
NS_PRECONDITION(nsnull != gContentDelegate, "null content delegate");
|
||||
if (nsnull != gContentDelegate) {
|
||||
// Remove our reference to the shared content delegate object. If
|
||||
// the last reference just went away, null out gContentDelegate.
|
||||
nsrefcnt rc;
|
||||
NS_RELEASE2(gContentDelegate, rc);
|
||||
if (0 == rc) {
|
||||
gContentDelegate = nsnull;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1533,13 +1446,6 @@ nsGenericHTMLElement::GetStyleRule(nsIStyleRule*& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentDelegate*
|
||||
nsGenericHTMLElement::GetDelegate(nsIPresContext* aCX)
|
||||
{
|
||||
NS_ADDREF(gContentDelegate);
|
||||
return gContentDelegate;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::ListAttributes(FILE* out) const
|
||||
{
|
||||
|
@ -121,7 +121,6 @@ public:
|
||||
nsresult SetAttribute(const nsString& aName, const nsString& aValue,
|
||||
PRBool aNotify);
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aResult) const;
|
||||
nsIContentDelegate* GetDelegate(nsIPresContext* aCX);
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
@ -667,9 +666,6 @@ public:
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aName, aResult); \
|
||||
} \
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX) { \
|
||||
return _g.GetDelegate(aCX); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
|
@ -246,6 +246,12 @@ public:
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
// XXX style rule enumerations
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
@ -1311,10 +1317,11 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -1354,10 +1361,11 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsIFrame* parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
@ -1423,6 +1431,73 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the frame that precedes the insertion point.
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
|
||||
// Note: not all content objects are associated with a frame so
|
||||
// keep looking until we find a previous frame
|
||||
for (PRInt32 index = aIndexInContainer; index > 0; index--) {
|
||||
nsIContent* precedingContent;
|
||||
aContainer->ChildAt(index - 1, precedingContent);
|
||||
prevSibling = shell->FindFrameWithContent(precedingContent);
|
||||
NS_RELEASE(precedingContent);
|
||||
|
||||
if (nsnull != prevSibling) {
|
||||
// The frame may have a next-in-flow. Get the last-in-flow
|
||||
nsIFrame* nextInFlow;
|
||||
do {
|
||||
prevSibling->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
prevSibling = nextInFlow;
|
||||
}
|
||||
} while (nsnull != nextInFlow);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the geometric parent.
|
||||
// XXX Deal with frame moved out of the flow, e.g., floated and absolutely
|
||||
// positioned frames...
|
||||
nsIFrame* parentFrame;
|
||||
if (nsnull == prevSibling) {
|
||||
parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
} else {
|
||||
prevSibling->GetGeometricParent(parentFrame);
|
||||
}
|
||||
|
||||
// Construct a new frame
|
||||
if (nsnull != parentFrame) {
|
||||
nsIFrame* newFrame;
|
||||
rv = ConstructFrame(aPresContext, aChild, parentFrame, newFrame);
|
||||
|
||||
// Notify the parent frame with a reflow command, passing it the
|
||||
// new child frame
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||
nsIReflowCommand* reflowCmd;
|
||||
|
||||
rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, newFrame, prevSibling);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
NS_RELEASE(reflowCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(shell);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void HTMLStyleSheetImpl::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
nsAutoString buffer;
|
||||
|
@ -118,9 +118,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aResult) const = 0;
|
||||
|
||||
// XXX deprecated
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX) = 0;
|
||||
|
||||
/**
|
||||
* List the content (and anything it contains) out to the given
|
||||
* file stream. Use aIndent as the base indent during formatting.
|
||||
|
@ -496,6 +496,8 @@ public:
|
||||
nsIContent* aContainer) = 0;
|
||||
#endif
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
/**
|
||||
* This call is invoked when content is inserted in the content
|
||||
* tree.
|
||||
@ -516,6 +518,7 @@ public:
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This call is invoked when content is replaced in the content
|
||||
|
@ -116,6 +116,12 @@ public:
|
||||
* Get the child frame associated with the reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Get the previous sibling frame associated with the reflow command.
|
||||
* This is used for FrameInserted reflow commands.
|
||||
*/
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIReflowCommand_h___ */
|
||||
|
@ -42,6 +42,12 @@ public:
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleFrameConstruction_h___ */
|
||||
|
@ -1190,7 +1190,6 @@ NS_METHOD nsFrame::ContentAppended(nsIPresShell* aShell,
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD nsFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
@ -1200,6 +1199,7 @@ NS_METHOD nsFrame::ContentInserted(nsIPresShell* aShell,
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD nsFrame::ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -158,12 +158,12 @@ public:
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
#endif
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -723,29 +723,10 @@ PresShell::ContentInserted(nsIDocument* aDocument,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
#ifdef FRAME_CONSTRUCTION
|
||||
EnterReflowLock();
|
||||
nsresult rv = mPresContext->ContentInserted(aDocument, aContainer, aChild, aIndexInContainer);
|
||||
ExitReflowLock();
|
||||
return rv;
|
||||
#else
|
||||
NS_PRECONDITION(nsnull != mRootFrame, "null root frame");
|
||||
|
||||
EnterReflowLock();
|
||||
|
||||
nsIFrame* frame = FindFrameWithContent(aContainer);
|
||||
NS_PRECONDITION(nsnull != frame, "null frame");
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("PresShell::ContentInserted: container=%p[%s] child=%p[%s][%d] frame=%p",
|
||||
aContainer, ContentTag(aContainer, 0),
|
||||
aChild, ContentTag(aChild, 1), aIndexInContainer,
|
||||
frame));
|
||||
frame->ContentInserted(this, mPresContext, aContainer, aChild,
|
||||
aIndexInContainer);
|
||||
|
||||
ExitReflowLock();
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -764,12 +764,8 @@ NS_IMETHODIMP StyleSetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
#if 0
|
||||
return mFrameConstructor->ContentInserted(aPresContext, aDocument, aContainer,
|
||||
aChild, aIndexInContainer);
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext,
|
||||
|
@ -118,9 +118,6 @@ public:
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aRet) const {
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
nsIContentDelegate* GetDelegate(nsIPresContext* aCX) {
|
||||
return nsnull;
|
||||
}
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -140,26 +140,8 @@ NS_METHOD nsHTMLContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresConte
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsHTMLContainerFrame::ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer)
|
||||
{
|
||||
// Get the last-in-flow
|
||||
nsHTMLContainerFrame* lastInFlow = (nsHTMLContainerFrame*)GetLastInFlow();
|
||||
|
||||
// Generate a reflow command for the frame
|
||||
nsIReflowCommand* cmd;
|
||||
nsresult result;
|
||||
|
||||
result = NS_NewHTMLReflowCommand(&cmd, lastInFlow, nsIReflowCommand::FrameAppended);
|
||||
if (NS_OK == result) {
|
||||
aShell->AppendReflowCommand(cmd);
|
||||
NS_RELEASE(cmd);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
@ -239,6 +221,7 @@ nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell,
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -40,14 +40,14 @@ public:
|
||||
nsIFrame** aFrame,
|
||||
nsIContent** aContent,
|
||||
PRInt32& aCursor);
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -429,4 +429,11 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIReflowCommand::ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame = nsnull);
|
||||
|
||||
/** Create a new HTML 'FrameInserted' reflow command */
|
||||
extern nsresult
|
||||
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame);
|
||||
|
||||
#endif /* nsHTMLParts_h___ */
|
||||
|
@ -45,13 +45,42 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
return cmd->QueryInterface(kIReflowCommandIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aChildFrame,
|
||||
aPrevSiblingFrame);
|
||||
if (nsnull == cmd) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return cmd->QueryInterface(kIReflowCommandIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
// Construct a reflow command given a target frame, reflow command type,
|
||||
// and optional child frame
|
||||
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame)
|
||||
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame)
|
||||
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
|
||||
mPrevSiblingFrame(nsnull)
|
||||
{
|
||||
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame)
|
||||
: mType(FrameInserted), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
|
||||
mPrevSiblingFrame(aPrevSiblingFrame)
|
||||
{
|
||||
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
|
||||
NS_INIT_REFCNT();
|
||||
@ -169,3 +198,9 @@ NS_IMETHODIMP nsHTMLReflowCommand::GetChildFrame(nsIFrame*& aChildFrame) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLReflowCommand::GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const
|
||||
{
|
||||
aSiblingFrame = mPrevSiblingFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,15 @@ public:
|
||||
ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame = nsnull);
|
||||
|
||||
/**
|
||||
* Construct an HTML reflow command of type FrameInserted, with target
|
||||
* frame aTargetFrame, and with the specified child and previous sibling
|
||||
* frames.
|
||||
*/
|
||||
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame);
|
||||
|
||||
virtual ~nsHTMLReflowCommand();
|
||||
|
||||
// nsISupports
|
||||
@ -49,6 +58,7 @@ public:
|
||||
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame);
|
||||
NS_IMETHOD GetType(ReflowType& aReflowType) const;
|
||||
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const;
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
|
||||
|
||||
protected:
|
||||
void BuildPath();
|
||||
@ -58,6 +68,7 @@ private:
|
||||
ReflowType mType;
|
||||
nsIFrame* mTargetFrame;
|
||||
nsIFrame* mChildFrame;
|
||||
nsIFrame* mPrevSiblingFrame;
|
||||
nsVoidArray mPath;
|
||||
};
|
||||
|
||||
|
@ -496,6 +496,8 @@ public:
|
||||
nsIContent* aContainer) = 0;
|
||||
#endif
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
/**
|
||||
* This call is invoked when content is inserted in the content
|
||||
* tree.
|
||||
@ -516,6 +518,7 @@ public:
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This call is invoked when content is replaced in the content
|
||||
|
@ -44,6 +44,8 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||
child->GetTag(tag);
|
||||
// XXX added frameset check, is it necessary, what is a page frame anyway
|
||||
if ((nsHTMLAtoms::body == tag) || (nsHTMLAtoms::frameset == tag)) {
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// Create a frame
|
||||
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
||||
if (nsnull != cd) {
|
||||
@ -59,6 +61,7 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||
}
|
||||
NS_RELEASE(cd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
NS_IF_RELEASE(tag);
|
||||
NS_RELEASE(child);
|
||||
|
@ -140,6 +140,8 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHODIMP nsPlaceholderFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -156,6 +158,7 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsPlaceholderFrame::ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -50,11 +50,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -66,6 +66,8 @@ NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext,
|
||||
mFrame->SetStyleContext(&aPresContext, mStyleContext);
|
||||
|
||||
} else {
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// Ask the content delegate to create the frame
|
||||
nsIContentDelegate* delegate = mContent->GetDelegate(&aPresContext);
|
||||
|
||||
@ -75,6 +77,7 @@ NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext,
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get the containing block
|
||||
@ -97,21 +100,6 @@ NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext,
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHODIMP nsAbsoluteFrame::ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer)
|
||||
{
|
||||
NS_ASSERTION(mContent == aContainer, "bad content-appended target");
|
||||
|
||||
// Forward the notification to the absolutely positioned frame
|
||||
if (nsnull != mFrame) {
|
||||
return mFrame->ContentAppended(aShell, aPresContext, aContainer);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsAbsoluteFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -128,6 +116,7 @@ NS_IMETHODIMP nsAbsoluteFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsAbsoluteFrame::ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -48,12 +48,12 @@ public:
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
#endif
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -131,11 +131,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -1956,6 +1959,17 @@ nsBlockFrame::FindTextRuns(nsBlockReflowState& aState)
|
||||
nsresult
|
||||
nsBlockFrame::FrameInsertedReflow(nsBlockReflowState& aState)
|
||||
{
|
||||
// Get the inserted frame
|
||||
nsIFrame* newFrame;
|
||||
aState.reflowCommand->GetChildFrame(newFrame);
|
||||
|
||||
// Get the previous sibling frame
|
||||
nsIFrame* prevSibling;
|
||||
aState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
|
||||
// Insert the frame. This marks the line dirty...
|
||||
InsertNewFrame(this, newFrame, prevSibling);
|
||||
|
||||
LineData* line = mLines;
|
||||
while (nsnull != line->mNext) {
|
||||
if (line->IsDirty()) {
|
||||
@ -3210,6 +3224,8 @@ nsBlockFrame::InsertNewFrame(nsBlockFrame* aParentFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// XXX we assume that the insertion is really an assertion and never an append
|
||||
// XXX what about zero lines case
|
||||
NS_IMETHODIMP
|
||||
@ -3293,6 +3309,7 @@ nsBlockFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -335,6 +335,8 @@ NS_METHOD nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_METHOD nsBodyFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -347,6 +349,7 @@ NS_METHOD nsBodyFrame::ContentInserted(nsIPresShell* aShell,
|
||||
return mFirstChild->ContentInserted(aShell, aPresContext, aContainer,
|
||||
aChild, aIndexInParent);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD nsBodyFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -50,13 +50,13 @@ public:
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -125,6 +125,8 @@ nsHTMLBase::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
nsresult
|
||||
nsHTMLBase::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -206,3 +208,4 @@ nsHTMLBase::CreateFrame(nsIPresContext* aPresContext,
|
||||
NS_RELEASE(kidSC);
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
@ -38,11 +38,14 @@ public:
|
||||
* Create a frame for a given piece of content using the style
|
||||
* as a guide for determining which frame to create.
|
||||
*/
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
static nsresult CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aKid,
|
||||
nsIFrame* aKidPrevInFlow,
|
||||
nsIFrame*& aResult);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsHTMLBase_h___ */
|
||||
|
@ -140,26 +140,8 @@ NS_METHOD nsHTMLContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresConte
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsHTMLContainerFrame::ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer)
|
||||
{
|
||||
// Get the last-in-flow
|
||||
nsHTMLContainerFrame* lastInFlow = (nsHTMLContainerFrame*)GetLastInFlow();
|
||||
|
||||
// Generate a reflow command for the frame
|
||||
nsIReflowCommand* cmd;
|
||||
nsresult result;
|
||||
|
||||
result = NS_NewHTMLReflowCommand(&cmd, lastInFlow, nsIReflowCommand::FrameAppended);
|
||||
if (NS_OK == result) {
|
||||
aShell->AppendReflowCommand(cmd);
|
||||
NS_RELEASE(cmd);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
@ -239,6 +221,7 @@ nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell,
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
|
@ -40,14 +40,14 @@ public:
|
||||
nsIFrame** aFrame,
|
||||
nsIContent** aContent,
|
||||
PRInt32& aCursor);
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -41,68 +41,6 @@ static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
|
||||
static nsIContentDelegate* gContentDelegate;
|
||||
|
||||
/**
|
||||
* THE html content delegate. There is exactly one instance of this
|
||||
* class and it's used for all html content. It just turns around
|
||||
* and asks the content object to create the frame.
|
||||
*/
|
||||
class ContentDelegate : public nsIContentDelegate {
|
||||
public:
|
||||
ContentDelegate();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult);
|
||||
protected:
|
||||
~ContentDelegate();
|
||||
};
|
||||
|
||||
ContentDelegate::ContentDelegate()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ContentDelegate, kIContentDelegateIID);
|
||||
|
||||
ContentDelegate::~ContentDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ContentDelegate::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContent, "null ptr");
|
||||
|
||||
// Make sure the content is html content
|
||||
nsIHTMLContent* hc;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
||||
if (NS_OK != rv) {
|
||||
// This means that *somehow* somebody which is not an html
|
||||
// content object got ahold of this delegate and tried to
|
||||
// create a frame with it. Give them back an nsFrame.
|
||||
rv = nsFrame::NewFrame(&frame, aContent, aParentFrame);
|
||||
if (NS_OK == rv) {
|
||||
frame->SetStyleContext(aPresContext, aStyleContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Ask the content object to create the frame
|
||||
rv = hc->CreateFrame(aPresContext, aParentFrame, aStyleContext, frame);
|
||||
NS_RELEASE(hc);
|
||||
}
|
||||
aResult = frame;
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void* nsHTMLContent::operator new(size_t size)
|
||||
@ -133,30 +71,11 @@ void nsHTMLContent::operator delete(void* ptr)
|
||||
|
||||
nsHTMLContent::nsHTMLContent()
|
||||
{
|
||||
// Create shared content delegate if this is the first html content
|
||||
// object being created.
|
||||
if (nsnull == gContentDelegate) {
|
||||
gContentDelegate = new ContentDelegate();
|
||||
}
|
||||
|
||||
mListenerManager = nsnull;
|
||||
|
||||
// Add a reference to the shared content delegate object
|
||||
NS_ADDREF(gContentDelegate);
|
||||
}
|
||||
|
||||
nsHTMLContent::~nsHTMLContent()
|
||||
{
|
||||
NS_PRECONDITION(nsnull != gContentDelegate, "null content delegate");
|
||||
if (nsnull != gContentDelegate) {
|
||||
// Remove our reference to the shared content delegate object. If
|
||||
// the last reference just went away, null out gContentDelegate.
|
||||
nsrefcnt rc = gContentDelegate->Release();
|
||||
if (0 == rc) {
|
||||
gContentDelegate = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
}
|
||||
|
||||
@ -499,12 +418,6 @@ nsHTMLContent::ToHTML(FILE* out) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentDelegate* nsHTMLContent::GetDelegate(nsIPresContext* aCX)
|
||||
{
|
||||
gContentDelegate->AddRef();
|
||||
return gContentDelegate;
|
||||
}
|
||||
|
||||
nsresult nsHTMLContent::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
|
@ -139,8 +139,6 @@ public:
|
||||
|
||||
NS_IMETHOD ToHTML(FILE* out) const;
|
||||
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX);
|
||||
|
||||
static void QuoteForHTML(const nsString& aValue, nsString& aResult);
|
||||
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
@ -429,4 +429,11 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIReflowCommand::ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame = nsnull);
|
||||
|
||||
/** Create a new HTML 'FrameInserted' reflow command */
|
||||
extern nsresult
|
||||
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame);
|
||||
|
||||
#endif /* nsHTMLParts_h___ */
|
||||
|
@ -45,13 +45,42 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
return cmd->QueryInterface(kIReflowCommandIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aChildFrame,
|
||||
aPrevSiblingFrame);
|
||||
if (nsnull == cmd) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return cmd->QueryInterface(kIReflowCommandIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
// Construct a reflow command given a target frame, reflow command type,
|
||||
// and optional child frame
|
||||
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame)
|
||||
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame)
|
||||
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
|
||||
mPrevSiblingFrame(nsnull)
|
||||
{
|
||||
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame)
|
||||
: mType(FrameInserted), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
|
||||
mPrevSiblingFrame(aPrevSiblingFrame)
|
||||
{
|
||||
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
|
||||
NS_INIT_REFCNT();
|
||||
@ -169,3 +198,9 @@ NS_IMETHODIMP nsHTMLReflowCommand::GetChildFrame(nsIFrame*& aChildFrame) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLReflowCommand::GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const
|
||||
{
|
||||
aSiblingFrame = mPrevSiblingFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,15 @@ public:
|
||||
ReflowType aReflowType,
|
||||
nsIFrame* aChildFrame = nsnull);
|
||||
|
||||
/**
|
||||
* Construct an HTML reflow command of type FrameInserted, with target
|
||||
* frame aTargetFrame, and with the specified child and previous sibling
|
||||
* frames.
|
||||
*/
|
||||
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIFrame* aPrevSiblingFrame);
|
||||
|
||||
virtual ~nsHTMLReflowCommand();
|
||||
|
||||
// nsISupports
|
||||
@ -49,6 +58,7 @@ public:
|
||||
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame);
|
||||
NS_IMETHOD GetType(ReflowType& aReflowType) const;
|
||||
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const;
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
|
||||
|
||||
protected:
|
||||
void BuildPath();
|
||||
@ -58,6 +68,7 @@ private:
|
||||
ReflowType mType;
|
||||
nsIFrame* mTargetFrame;
|
||||
nsIFrame* mChildFrame;
|
||||
nsIFrame* mPrevSiblingFrame;
|
||||
nsVoidArray mPath;
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,8 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||
child->GetTag(tag);
|
||||
// XXX added frameset check, is it necessary, what is a page frame anyway
|
||||
if ((nsHTMLAtoms::body == tag) || (nsHTMLAtoms::frameset == tag)) {
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
// Create a frame
|
||||
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
||||
if (nsnull != cd) {
|
||||
@ -59,6 +61,7 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||
}
|
||||
NS_RELEASE(cd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
NS_IF_RELEASE(tag);
|
||||
NS_RELEASE(child);
|
||||
|
@ -140,6 +140,8 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHODIMP nsPlaceholderFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -156,6 +158,7 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentInserted(nsIPresShell* aShell,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsPlaceholderFrame::ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
|
@ -50,11 +50,14 @@ public:
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
NS_IMETHOD ContentReplaced(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -37,83 +37,6 @@ extern void NS_QuoteForHTML(const nsString& aValue, nsString& aResult);
|
||||
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
|
||||
// XXX temporary code until troy gets done whacking things
|
||||
|
||||
#include "nsIContentDelegate.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
static nsIContentDelegate* gContentDelegate;
|
||||
static NS_DEFINE_IID(kIContentDelegateIID, NS_ICONTENTDELEGATE_IID);
|
||||
|
||||
/**
|
||||
* THE html content delegate. There is exactly one instance of this
|
||||
* class and it's used for all html content. It just turns around
|
||||
* and asks the content object to create the frame.
|
||||
*/
|
||||
class ZZContentDelegate : public nsIContentDelegate {
|
||||
public:
|
||||
ZZContentDelegate();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult);
|
||||
protected:
|
||||
~ZZContentDelegate();
|
||||
};
|
||||
|
||||
ZZContentDelegate::ZZContentDelegate()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ZZContentDelegate, kIContentDelegateIID);
|
||||
|
||||
ZZContentDelegate::~ZZContentDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ZZContentDelegate::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContent, "null ptr");
|
||||
|
||||
// Make sure the content is html content
|
||||
nsIDOMNode* dn;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aContent->QueryInterface(kIDOMNodeIID, (void**) &dn);
|
||||
if (NS_OK != rv) {
|
||||
// This means that *somehow* somebody which is not an dom
|
||||
// node object got ahold of this delegate and tried to
|
||||
// create a frame with it. Give them back an nsFrame.
|
||||
rv = nsFrame::NewFrame(&frame, aContent, aParentFrame);
|
||||
}
|
||||
else {
|
||||
PRInt32 nodeType;
|
||||
dn->GetNodeType(&nodeType);
|
||||
switch (nodeType) {
|
||||
case nsIDOMNode::TEXT:
|
||||
rv = NS_NewTextFrame(aContent, aParentFrame, frame);
|
||||
break;
|
||||
|
||||
case nsIDOMNode::COMMENT:
|
||||
rv = NS_NewCommentFrame(aContent, aParentFrame, frame);
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(dn);
|
||||
}
|
||||
if (nsnull != frame) {
|
||||
frame->SetStyleContext(aPresContext, aStyleContext);
|
||||
}
|
||||
aResult = frame;
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsGenericDOMDataNode::nsGenericDOMDataNode()
|
||||
@ -125,15 +48,6 @@ nsGenericDOMDataNode::nsGenericDOMDataNode()
|
||||
mListenerManager = nsnull;
|
||||
mText = nsnull;
|
||||
mTextLength = 0;
|
||||
|
||||
// Create shared content delegate if this is the first html content
|
||||
// object being created.
|
||||
if (nsnull == gContentDelegate) {
|
||||
gContentDelegate = new ZZContentDelegate();
|
||||
}
|
||||
|
||||
// Add a reference to the shared content delegate object
|
||||
NS_ADDREF(gContentDelegate);
|
||||
}
|
||||
|
||||
nsGenericDOMDataNode::~nsGenericDOMDataNode()
|
||||
@ -143,16 +57,6 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
|
||||
}
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
// XXX what about mScriptObject? its now safe to GC it...
|
||||
|
||||
NS_PRECONDITION(nsnull != gContentDelegate, "null content delegate");
|
||||
if (nsnull != gContentDelegate) {
|
||||
// Remove our reference to the shared content delegate object. If
|
||||
// the last reference just went away, null out gContentDelegate.
|
||||
nsrefcnt rc = gContentDelegate->Release();
|
||||
if (0 == rc) {
|
||||
gContentDelegate = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -673,9 +577,3 @@ nsGenericDOMDataNode::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentDelegate*
|
||||
nsGenericDOMDataNode::GetDelegate(nsIPresContext* aCX)
|
||||
{
|
||||
NS_ADDREF(gContentDelegate);
|
||||
return gContentDelegate;
|
||||
}
|
||||
|
@ -137,7 +137,6 @@ struct nsGenericDOMDataNode {
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aResult) const {
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
nsIContentDelegate* GetDelegate(nsIPresContext* aCX);
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
@ -430,9 +429,6 @@ struct nsGenericDOMDataNode {
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aName, aResult); \
|
||||
} \
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX) { \
|
||||
return _g.GetDelegate(aCX); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
|
@ -85,26 +85,6 @@ static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kICSSStyleRuleIID, NS_ICSS_STYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
|
||||
static nsIContentDelegate* gContentDelegate;
|
||||
|
||||
/**
|
||||
* THE html content delegate. There is exactly one instance of this
|
||||
* class and it's used for all html content. It just turns around
|
||||
* and asks the content object to create the frame.
|
||||
*/
|
||||
class ZContentDelegate : public nsIContentDelegate {
|
||||
public:
|
||||
ZContentDelegate();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult);
|
||||
protected:
|
||||
~ZContentDelegate();
|
||||
};
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
// object that implements nsIDOMAttribute and nsIDOMNode and
|
||||
// nsIScriptObjectOwner
|
||||
@ -218,50 +198,6 @@ private:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ZContentDelegate::ZContentDelegate()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ZContentDelegate, kIContentDelegateIID);
|
||||
|
||||
ZContentDelegate::~ZContentDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ZContentDelegate::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContent, "null ptr");
|
||||
|
||||
// Make sure the content is html content
|
||||
nsIHTMLContent* hc;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
||||
if (NS_OK != rv) {
|
||||
// This means that *somehow* somebody which is not an html
|
||||
// content object got ahold of this delegate and tried to
|
||||
// create a frame with it. Give them back an nsFrame.
|
||||
rv = nsFrame::NewFrame(&frame, aContent, aParentFrame);
|
||||
if (NS_OK == rv) {
|
||||
frame->SetStyleContext(aPresContext, aStyleContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Ask the content object to create the frame
|
||||
rv = hc->CreateFrame(aPresContext, aParentFrame, aStyleContext, frame);
|
||||
NS_RELEASE(hc);
|
||||
}
|
||||
aResult = frame;
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
DOMAttribute::DOMAttribute(const nsString& aName, const nsString& aValue)
|
||||
: mName(aName), mValue(aValue)
|
||||
{
|
||||
@ -708,13 +644,6 @@ nsGenericHTMLElement::nsGenericHTMLElement()
|
||||
mContent = nsnull;
|
||||
mScriptObject = nsnull;
|
||||
mListenerManager = nsnull;
|
||||
|
||||
// Create shared content delegate if this is the first html content
|
||||
// object being created.
|
||||
if (nsnull == gContentDelegate) {
|
||||
NS_NEWXPCOM(gContentDelegate, ZContentDelegate);
|
||||
NS_ADDREF(gContentDelegate);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
@ -725,22 +654,6 @@ nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
NS_IF_RELEASE(mTag);
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
// XXX what about mScriptObject? it's now safe to GC it...
|
||||
|
||||
#if 0
|
||||
// This code didn't work; and since content delegates are going
|
||||
// away, I'm not going to fix it. So for now, we will leak a content
|
||||
// delegate per address space. whoope doopie. -- kipp
|
||||
NS_PRECONDITION(nsnull != gContentDelegate, "null content delegate");
|
||||
if (nsnull != gContentDelegate) {
|
||||
// Remove our reference to the shared content delegate object. If
|
||||
// the last reference just went away, null out gContentDelegate.
|
||||
nsrefcnt rc;
|
||||
NS_RELEASE2(gContentDelegate, rc);
|
||||
if (0 == rc) {
|
||||
gContentDelegate = nsnull;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1533,13 +1446,6 @@ nsGenericHTMLElement::GetStyleRule(nsIStyleRule*& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentDelegate*
|
||||
nsGenericHTMLElement::GetDelegate(nsIPresContext* aCX)
|
||||
{
|
||||
NS_ADDREF(gContentDelegate);
|
||||
return gContentDelegate;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::ListAttributes(FILE* out) const
|
||||
{
|
||||
|
@ -121,7 +121,6 @@ public:
|
||||
nsresult SetAttribute(const nsString& aName, const nsString& aValue,
|
||||
PRBool aNotify);
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aResult) const;
|
||||
nsIContentDelegate* GetDelegate(nsIPresContext* aCX);
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
@ -667,9 +666,6 @@ public:
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aName, aResult); \
|
||||
} \
|
||||
virtual nsIContentDelegate* GetDelegate(nsIPresContext* aCX) { \
|
||||
return _g.GetDelegate(aCX); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
|
@ -71,26 +71,6 @@ static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
|
||||
static nsIContentDelegate* gContentDelegate;
|
||||
|
||||
/**
|
||||
* THE html content delegate. There is exactly one instance of this
|
||||
* class and it's used for all html content. It just turns around
|
||||
* and asks the content object to create the frame.
|
||||
*/
|
||||
class ZContentDelegate : public nsIContentDelegate {
|
||||
public:
|
||||
ZContentDelegate();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult);
|
||||
protected:
|
||||
~ZContentDelegate();
|
||||
};
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
// object that implements nsIDOMAttribute and nsIDOMNode and
|
||||
// nsIScriptObjectOwner
|
||||
@ -165,50 +145,6 @@ private:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ZContentDelegate::ZContentDelegate()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ZContentDelegate, kIContentDelegateIID);
|
||||
|
||||
ZContentDelegate::~ZContentDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ZContentDelegate::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame*& aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContent, "null ptr");
|
||||
|
||||
// Make sure the content is html content
|
||||
nsIHTMLContent* hc;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
||||
if (NS_OK != rv) {
|
||||
// This means that *somehow* somebody which is not an html
|
||||
// content object got ahold of this delegate and tried to
|
||||
// create a frame with it. Give them back an nsFrame.
|
||||
rv = nsFrame::NewFrame(&frame, aContent, aParentFrame);
|
||||
if (NS_OK == rv) {
|
||||
frame->SetStyleContext(aPresContext, aStyleContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Ask the content object to create the frame
|
||||
rv = hc->CreateFrame(aPresContext, aParentFrame, aStyleContext, frame);
|
||||
NS_RELEASE(hc);
|
||||
}
|
||||
aResult = frame;
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
DOMAttribute::DOMAttribute(const nsString& aName, const nsString& aValue)
|
||||
: mName(aName), mValue(aValue)
|
||||
{
|
||||
@ -620,15 +556,6 @@ nsHTMLGenericContent::nsHTMLGenericContent()
|
||||
mContent = nsnull;
|
||||
mScriptObject = nsnull;
|
||||
mListenerManager = nsnull;
|
||||
|
||||
// Create shared content delegate if this is the first html content
|
||||
// object being created.
|
||||
if (nsnull == gContentDelegate) {
|
||||
gContentDelegate = new ZContentDelegate();
|
||||
}
|
||||
|
||||
// Add a reference to the shared content delegate object
|
||||
NS_ADDREF(gContentDelegate);
|
||||
}
|
||||
|
||||
nsHTMLGenericContent::~nsHTMLGenericContent()
|
||||
@ -639,16 +566,6 @@ nsHTMLGenericContent::~nsHTMLGenericContent()
|
||||
NS_IF_RELEASE(mTag);
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
// XXX what about mScriptObject? it's now safe to GC it...
|
||||
|
||||
NS_PRECONDITION(nsnull != gContentDelegate, "null content delegate");
|
||||
if (nsnull != gContentDelegate) {
|
||||
// Remove our reference to the shared content delegate object. If
|
||||
// the last reference just went away, null out gContentDelegate.
|
||||
nsrefcnt rc = gContentDelegate->Release();
|
||||
if (0 == rc) {
|
||||
gContentDelegate = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1394,13 +1311,6 @@ nsHTMLGenericContent::GetStyleRule(nsIStyleRule*& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentDelegate*
|
||||
nsHTMLGenericContent::GetDelegate(nsIPresContext* aCX)
|
||||
{
|
||||
gContentDelegate->AddRef();
|
||||
return gContentDelegate;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLGenericContent::ListAttributes(FILE* out) const
|
||||
{
|
||||
|
@ -246,6 +246,12 @@ public:
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
// XXX style rule enumerations
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
@ -1311,10 +1317,11 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -1354,10 +1361,11 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsIFrame* parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
@ -1423,6 +1431,73 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the frame that precedes the insertion point.
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
|
||||
// Note: not all content objects are associated with a frame so
|
||||
// keep looking until we find a previous frame
|
||||
for (PRInt32 index = aIndexInContainer; index > 0; index--) {
|
||||
nsIContent* precedingContent;
|
||||
aContainer->ChildAt(index - 1, precedingContent);
|
||||
prevSibling = shell->FindFrameWithContent(precedingContent);
|
||||
NS_RELEASE(precedingContent);
|
||||
|
||||
if (nsnull != prevSibling) {
|
||||
// The frame may have a next-in-flow. Get the last-in-flow
|
||||
nsIFrame* nextInFlow;
|
||||
do {
|
||||
prevSibling->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
prevSibling = nextInFlow;
|
||||
}
|
||||
} while (nsnull != nextInFlow);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the geometric parent.
|
||||
// XXX Deal with frame moved out of the flow, e.g., floated and absolutely
|
||||
// positioned frames...
|
||||
nsIFrame* parentFrame;
|
||||
if (nsnull == prevSibling) {
|
||||
parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
} else {
|
||||
prevSibling->GetGeometricParent(parentFrame);
|
||||
}
|
||||
|
||||
// Construct a new frame
|
||||
if (nsnull != parentFrame) {
|
||||
nsIFrame* newFrame;
|
||||
rv = ConstructFrame(aPresContext, aChild, parentFrame, newFrame);
|
||||
|
||||
// Notify the parent frame with a reflow command, passing it the
|
||||
// new child frame
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||
nsIReflowCommand* reflowCmd;
|
||||
|
||||
rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, newFrame, prevSibling);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
NS_RELEASE(reflowCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(shell);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void HTMLStyleSheetImpl::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
nsAutoString buffer;
|
||||
|
@ -682,11 +682,12 @@ void nsTableFrame::EnsureColumnFrameAt(PRInt32 aColIndex,
|
||||
// Resolve style for the child
|
||||
nsIStyleContext* colGroupStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(lastColGroup, this, PR_TRUE); // kidStyleContext: REFCNT++
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = lastColGroup->GetDelegate(aPresContext); // kidDel: REFCNT++
|
||||
rv = kidDel->CreateFrame(aPresContext, lastColGroup, this,
|
||||
colGroupStyleContext, (nsIFrame *&)lastColGroupFrame);
|
||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||
|
||||
// Create a col group frame
|
||||
nsIFrame* newFrame;
|
||||
NS_NewTableColGroupFrame(lastColGroup, this, newFrame);
|
||||
lastColGroupFrame = (nsTableColGroupFrame*)newFrame;
|
||||
lastColGroupFrame->SetStyleContext(aPresContext, colGroupStyleContext);
|
||||
NS_RELEASE(colGroupStyleContext); // kidStyleContenxt: REFCNT--
|
||||
|
||||
// hook lastColGroupFrame into child list
|
||||
@ -1555,7 +1556,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
||||
nscoord bottomInset = borderPadding.bottom;
|
||||
nscoord leftInset = borderPadding.left;
|
||||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
nsIContent * prevKid; // do NOT hold a reference for this temp pointer!
|
||||
|
||||
for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
||||
nsSize maxKidElementSize(0,0);
|
||||
@ -2687,12 +2687,10 @@ nsTableFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
// Resolve style for the child
|
||||
nsIStyleContext* kidStyleContext =
|
||||
aPresContext.ResolveStyleContextFor(content, cf); // kidStyleContext: REFCNT++
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = content->GetDelegate(&aPresContext); // kidDel: REFCNT++
|
||||
|
||||
nsIFrame* duplicateFrame;
|
||||
nsresult rv = kidDel->CreateFrame(&aPresContext, content, cf,
|
||||
kidStyleContext, duplicateFrame);
|
||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||
NS_NewTableRowGroupFrame(content, cf, duplicateFrame);
|
||||
duplicateFrame->SetStyleContext(&aPresContext, kidStyleContext);
|
||||
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
||||
|
||||
if (nsnull==lastSib)
|
||||
|
@ -607,6 +607,8 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aState,
|
||||
}
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
// Create the inner table frame
|
||||
@ -674,6 +676,7 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD
|
||||
nsTableOuterFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
|
@ -246,6 +246,12 @@ public:
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
// XXX style rule enumerations
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
@ -1311,10 +1317,11 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -1354,10 +1361,11 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsIFrame* parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
@ -1423,6 +1431,73 @@ NS_IMETHODIMP HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetShell();
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the frame that precedes the insertion point.
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
|
||||
// Note: not all content objects are associated with a frame so
|
||||
// keep looking until we find a previous frame
|
||||
for (PRInt32 index = aIndexInContainer; index > 0; index--) {
|
||||
nsIContent* precedingContent;
|
||||
aContainer->ChildAt(index - 1, precedingContent);
|
||||
prevSibling = shell->FindFrameWithContent(precedingContent);
|
||||
NS_RELEASE(precedingContent);
|
||||
|
||||
if (nsnull != prevSibling) {
|
||||
// The frame may have a next-in-flow. Get the last-in-flow
|
||||
nsIFrame* nextInFlow;
|
||||
do {
|
||||
prevSibling->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
prevSibling = nextInFlow;
|
||||
}
|
||||
} while (nsnull != nextInFlow);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the geometric parent.
|
||||
// XXX Deal with frame moved out of the flow, e.g., floated and absolutely
|
||||
// positioned frames...
|
||||
nsIFrame* parentFrame;
|
||||
if (nsnull == prevSibling) {
|
||||
parentFrame = shell->FindFrameWithContent(aContainer);
|
||||
} else {
|
||||
prevSibling->GetGeometricParent(parentFrame);
|
||||
}
|
||||
|
||||
// Construct a new frame
|
||||
if (nsnull != parentFrame) {
|
||||
nsIFrame* newFrame;
|
||||
rv = ConstructFrame(aPresContext, aChild, parentFrame, newFrame);
|
||||
|
||||
// Notify the parent frame with a reflow command, passing it the
|
||||
// new child frame
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||
nsIReflowCommand* reflowCmd;
|
||||
|
||||
rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, newFrame, prevSibling);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
NS_RELEASE(reflowCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(shell);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void HTMLStyleSheetImpl::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
nsAutoString buffer;
|
||||
|
@ -764,12 +764,8 @@ NS_IMETHODIMP StyleSetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
#if 0
|
||||
return mFrameConstructor->ContentInserted(aPresContext, aDocument, aContainer,
|
||||
aChild, aIndexInContainer);
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext,
|
||||
|
@ -682,11 +682,12 @@ void nsTableFrame::EnsureColumnFrameAt(PRInt32 aColIndex,
|
||||
// Resolve style for the child
|
||||
nsIStyleContext* colGroupStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(lastColGroup, this, PR_TRUE); // kidStyleContext: REFCNT++
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = lastColGroup->GetDelegate(aPresContext); // kidDel: REFCNT++
|
||||
rv = kidDel->CreateFrame(aPresContext, lastColGroup, this,
|
||||
colGroupStyleContext, (nsIFrame *&)lastColGroupFrame);
|
||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||
|
||||
// Create a col group frame
|
||||
nsIFrame* newFrame;
|
||||
NS_NewTableColGroupFrame(lastColGroup, this, newFrame);
|
||||
lastColGroupFrame = (nsTableColGroupFrame*)newFrame;
|
||||
lastColGroupFrame->SetStyleContext(aPresContext, colGroupStyleContext);
|
||||
NS_RELEASE(colGroupStyleContext); // kidStyleContenxt: REFCNT--
|
||||
|
||||
// hook lastColGroupFrame into child list
|
||||
@ -1555,7 +1556,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
||||
nscoord bottomInset = borderPadding.bottom;
|
||||
nscoord leftInset = borderPadding.left;
|
||||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
nsIContent * prevKid; // do NOT hold a reference for this temp pointer!
|
||||
|
||||
for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
||||
nsSize maxKidElementSize(0,0);
|
||||
@ -2687,12 +2687,10 @@ nsTableFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
// Resolve style for the child
|
||||
nsIStyleContext* kidStyleContext =
|
||||
aPresContext.ResolveStyleContextFor(content, cf); // kidStyleContext: REFCNT++
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = content->GetDelegate(&aPresContext); // kidDel: REFCNT++
|
||||
|
||||
nsIFrame* duplicateFrame;
|
||||
nsresult rv = kidDel->CreateFrame(&aPresContext, content, cf,
|
||||
kidStyleContext, duplicateFrame);
|
||||
NS_RELEASE(kidDel); // kidDel: REFCNT--
|
||||
NS_NewTableRowGroupFrame(content, cf, duplicateFrame);
|
||||
duplicateFrame->SetStyleContext(&aPresContext, kidStyleContext);
|
||||
NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT--
|
||||
|
||||
if (nsnull==lastSib)
|
||||
|
@ -607,6 +607,8 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aState,
|
||||
}
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
// Create the inner table frame
|
||||
@ -674,6 +676,7 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD
|
||||
nsTableOuterFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
|
||||
|
Loading…
x
Reference in New Issue
Block a user