Less-than-ideal fix for the problem where XTF insertion points don't work if the insertion point has only inline frame ancestors (which are not in the primary frame map) in the anonymous content tree. Track the insertion point content node as we're constructing anonymous content frames and insert the explicit content when we reach the insertion point. Bug 269023, r=bzbarsky, sr=dbaron.

This commit is contained in:
bryner%brianryner.com 2005-01-14 23:12:20 +00:00
parent e710e37ba9
commit cf6382ba15
9 changed files with 372 additions and 72 deletions

View File

@ -41,6 +41,9 @@
#include "nsISupports.h"
class nsISupportsArray;
class nsIDOMElement;
////////////////////////////////////////////////////////////////////////
// nsIXTFVisualWrapperPrivate: private interface for visual frames

View File

@ -894,7 +894,26 @@ private:
nsIAtom* mChildListName;
nsFrameConstructorState* mState;
friend struct nsFrameConstructorState;
friend class nsFrameConstructorState;
};
// Structure for saving the existing state when pushing/popping insertion
// points for nsIAnonymousContentCreator. The destructor restores the state
// to its previous state. See documentation of these members in
// nsFrameConstructorState.
class nsFrameConstructorInsertionState {
public:
nsFrameConstructorInsertionState();
~nsFrameConstructorInsertionState();
private:
nsIFrame* mAnonymousCreator;
nsIContent* mInsertionContent;
PRBool mCreatorIsBlock;
nsFrameConstructorState* mState;
friend class nsFrameConstructorState;
};
// Structure used for maintaining state information during the
@ -914,6 +933,13 @@ public:
nsCOMPtr<nsILayoutHistoryState> mFrameState;
nsPseudoFrames mPseudoFrames;
// The nsIAnonymousContentCreator we're currently constructing children for.
nsIFrame *mAnonymousCreator;
// The insertion point node for mAnonymousCreator.
nsIContent *mInsertionContent;
// Whether the parent is a block (see ProcessChildren's aParentIsBlock)
PRBool mCreatorIsBlock;
// Constructor
// Use the passed-in history state.
nsFrameConstructorState(nsPresContext* aPresContext,
@ -979,8 +1005,15 @@ public:
PRBool aCanBePositioned = PR_TRUE,
PRBool aCanBeFloated = PR_TRUE);
// Push an nsIAnonymousContentCreator and its insertion node
void PushAnonymousContentCreator(nsIFrame *aCreator,
nsIContent *aContent,
PRBool aIsBlock,
nsFrameConstructorInsertionState &aSaveState);
protected:
friend class nsFrameConstructorSaveState;
friend class nsFrameConstructorInsertionState;
/**
* ProcessFrameInsertions takes the frames in aFrameItems and adds them as
@ -1004,7 +1037,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsPresContext* aPresCont
mFirstLetterStyle(PR_FALSE),
mFirstLineStyle(PR_FALSE),
mFrameState(aHistoryState),
mPseudoFrames()
mPseudoFrames(),
mAnonymousCreator(nsnull),
mInsertionContent(nsnull),
mCreatorIsBlock(PR_FALSE)
{
}
@ -1020,7 +1056,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsPresContext* aPresCont
mFloatedItems(aFloatContainingBlock),
mFirstLetterStyle(PR_FALSE),
mFirstLineStyle(PR_FALSE),
mPseudoFrames()
mPseudoFrames(),
mAnonymousCreator(nsnull),
mInsertionContent(nsnull),
mCreatorIsBlock(PR_FALSE)
{
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
@ -1212,6 +1251,23 @@ nsFrameConstructorState::AddChild(nsIFrame* aNewFrame,
return NS_OK;
}
void
nsFrameConstructorState::PushAnonymousContentCreator(nsIFrame *aCreator,
nsIContent *aContent,
PRBool aIsBlock,
nsFrameConstructorInsertionState &aSaveState)
{
NS_ASSERTION(aCreator || !aContent, "Must have a frame if there is an insertion node");
aSaveState.mAnonymousCreator = mAnonymousCreator;
aSaveState.mInsertionContent = mInsertionContent;
aSaveState.mCreatorIsBlock = mCreatorIsBlock;
aSaveState.mState = this;
mAnonymousCreator = aCreator;
mInsertionContent = aContent;
mCreatorIsBlock = aIsBlock;
}
void
nsFrameConstructorState::ProcessFrameInsertions(nsAbsoluteItems& aFrameItems,
nsIAtom* aChildListName)
@ -1320,6 +1376,40 @@ nsFrameConstructorSaveState::~nsFrameConstructorSaveState()
}
}
nsFrameConstructorInsertionState::nsFrameConstructorInsertionState()
: mAnonymousCreator(nsnull),
mInsertionContent(nsnull),
mCreatorIsBlock(PR_FALSE),
mState(nsnull)
{
}
nsFrameConstructorInsertionState::~nsFrameConstructorInsertionState()
{
// Restore the state
if (mState) {
mState->mAnonymousCreator = mAnonymousCreator;
mState->mInsertionContent = mInsertionContent;
mState->mCreatorIsBlock = mCreatorIsBlock;
}
}
// Putting this up here to help inlining work on compilers that won't inline
// definitions that are after the call site.
inline nsresult
nsCSSFrameConstructor::CreateInsertionPointChildren(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsFrameConstructorState &aState,
nsIFrame *aNewFrame,
nsIContent *aContent,
PRBool aUseInsertionFrame)
{
if (aState.mInsertionContent == aContent)
return CreateInsertionPointChildren(aPresShell, aPresContext, aState,
aNewFrame, aUseInsertionFrame);
return NS_OK;
}
static
PRBool IsBorderCollapse(nsIFrame* aFrame)
@ -5298,6 +5388,12 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
}
}
if (newFrame) {
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent);
NS_ENSURE_SUCCESS(rv, rv);
}
if (addToHashTable) {
// Add a mapping from content object to primary frame. Note that for
// floated and positioned frames this is the out-of-flow frame and not
@ -5387,7 +5483,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
return CreateAnonymousFrames(aPresShell, aPresContext, aState, aParent,
mDocument, aNewFrame, PR_FALSE,
aAppendToExisting, aChildItems);
aAppendToExisting, aChildItems,
nsnull, nsnull, PR_FALSE);
}
// after the node has been constructed and initialized create any
@ -5401,13 +5498,22 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
nsIFrame* aParentFrame,
PRBool aForceBindingParent,
PRBool aAppendToExisting,
nsFrameItems& aChildItems)
nsFrameItems& aChildItems,
nsIFrame* aAnonymousCreator,
nsIContent* aInsertionNode,
PRBool aAnonymousParentIsBlock)
{
nsCOMPtr<nsIAnonymousContentCreator> creator(do_QueryInterface(aParentFrame));
if (!creator)
return NS_OK;
nsFrameConstructorInsertionState saveState;
aState.PushAnonymousContentCreator(aAnonymousCreator,
aInsertionNode,
aAnonymousParentIsBlock,
saveState);
nsCOMPtr<nsISupportsArray> anonymousItems;
NS_NewISupportsArray(getter_AddRefs(anonymousItems));
@ -6044,6 +6150,12 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
// addToHashTable:
if (newFrame) {
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent);
NS_ENSURE_SUCCESS(rv, rv);
}
if (topFrame) {
// the top frame is always what we map the content to. This is the frame that contains a pointer
// to the content node.
@ -6299,7 +6411,7 @@ nsCSSFrameConstructor::InitGfxScrollFrame(nsIPresShell* aPresShell,
// if there are any anonymous children for the scroll frame, create frames for them.
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, aDocument, aNewFrame,
PR_FALSE, PR_FALSE, aAnonymousFrames);
PR_FALSE, PR_FALSE, aAnonymousFrames, nsnull, nsnull, PR_FALSE);
return NS_OK;
}
@ -6678,12 +6790,18 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
"Cases where AddChild() can fail must handle it themselves");
}
if (newFrame && addToHashTable) {
// Add a mapping from content object to primary frame. Note that for
// floated and positioned frames this is the out-of-flow frame and not
// the placeholder frame
if (!primaryFrameSet)
aState.mFrameManager->SetPrimaryFrameFor(aContent, newFrame);
if (newFrame) {
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent);
NS_ENSURE_SUCCESS(rv, rv);
if (addToHashTable) {
// Add a mapping from content object to primary frame. Note that for
// floated and positioned frames this is the out-of-flow frame and not
// the placeholder frame
if (!primaryFrameSet)
aState.mFrameManager->SetPrimaryFrameFor(aContent, newFrame);
}
}
return rv;
@ -6937,6 +7055,8 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
// Set the frame's initial child list
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent);
}
return rv;
}
@ -7013,6 +7133,11 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsIPresShell* aPresShell,
return rv;
}
// Get the content node in the anonymous content tree where the explicit
// children should be inserted.
nsCOMPtr<nsIContent> insertionNode = newFrame->GetContentInsertionNode();
// Create anonymous frames before processing children, so that
// explicit child content can be appended to the correct anonymous
// frame. Call version of CreateAnonymousFrames that doesn't check
@ -7023,25 +7148,24 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsIPresShell* aPresShell,
"xtf wrapper not implementing nsIXTFVisualWrapperPrivate");
nsFrameItems childItems;
// Since we've set the insertion frame, our children will automatically
// be constructed once |insertionNode| has had its frame created.
// Call version of CreateAnonymousFrames that doesn't check tag:
CreateAnonymousFrames(aPresShell, aPresContext, aState, aContent, mDocument, newFrame,
visual->ApplyDocumentStyleSheets(),
PR_FALSE, childItems);
PR_FALSE, childItems,
newFrame, insertionNode, isBlock);
// Set the frame's initial child list
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
// Process the child content if requested
nsIFrame *insertionFrame = newFrame->GetContentInsertionFrame();
if (insertionFrame) {
nsFrameItems insertionItems;
rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
insertionFrame, PR_TRUE, insertionItems, isBlock);
if (insertionItems.childList) {
AppendFrames(aPresContext, aPresShell,aState.mFrameManager,
aContent, insertionFrame,
insertionItems.childList);
}
}
// Note: we don't worry about insertionFrame here because we know
// that XTF elements always insert into the primary frame of their
// insertion content.
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent, PR_FALSE);
}
return rv;
}
@ -7363,6 +7487,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
// Set the frame's initial child list
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
}
rv = CreateInsertionPointChildren(aPresShell, aPresContext,
aState, newFrame, aContent);
}
return rv;
}
@ -13667,4 +13794,29 @@ nsCSSFrameConstructor::RestyleEvent::RestyleEvent(nsCSSFrameConstructor* aConstr
PL_InitEvent(this, aConstructor,
::HandleRestyleEvent, ::DestroyRestyleEvent);
}
nsresult
nsCSSFrameConstructor::CreateInsertionPointChildren(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsFrameConstructorState &aState,
nsIFrame *aNewFrame,
PRBool aUseInsertionFrame)
{
nsIContent *creatorContent = aState.mAnonymousCreator->GetContent();
nsFrameItems insertionItems;
nsIFrame *insertionFrame =
aUseInsertionFrame ? aNewFrame->GetContentInsertionFrame() : aNewFrame;
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState,
creatorContent, insertionFrame, PR_TRUE,
insertionItems, aState.mCreatorIsBlock);
if (NS_SUCCEEDED(rv) && insertionItems.childList) {
rv = AppendFrames(aPresContext, aPresShell, aState.mFrameManager,
creatorContent, insertionFrame,
insertionItems.childList);
}
return rv;
}

View File

@ -69,8 +69,8 @@ struct nsFindFrameHint
nsFindFrameHint() : mPrimaryFrameForPrevSibling(nsnull) { }
};
struct nsFrameConstructorState;
class nsFrameConstructorState;
class nsCSSFrameConstructor
{
public:
@ -606,7 +606,10 @@ private:
nsIFrame* aNewFrame,
PRBool aForceBindingParent,
PRBool aAppendToExisting,
nsFrameItems& aChildItems);
nsFrameItems& aChildItems,
nsIFrame* aAnonymousCreator,
nsIContent* aInsertionNode,
PRBool aAnonymousParentIsBlock);
//MathML Mod - RBS
#ifdef MOZ_MATHML
@ -1079,6 +1082,21 @@ private:
mQuoteList.RecalcAll();
}
inline NS_HIDDEN_(nsresult)
CreateInsertionPointChildren(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsFrameConstructorState &aState,
nsIFrame *aNewFrame,
nsIContent *aContent,
PRBool aUseInsertionFrame = PR_TRUE);
NS_HIDDEN_(nsresult)
CreateInsertionPointChildren(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsFrameConstructorState &aState,
nsIFrame *aNewFrame,
PRBool aUseInsertionFrame);
public:
struct RestyleData;
friend struct RestyleData;
@ -1101,7 +1119,7 @@ public:
void HandleEvent();
};
friend struct nsFrameConstructorState;
friend class nsFrameConstructorState;
protected:
nsCOMPtr<nsIEventQueue> mRestyleEventQueue;

View File

@ -94,9 +94,9 @@ struct nsMargin;
typedef class nsIFrame nsIBox;
// IID for the nsIFrame interface
// 8657598f-a18a-4b7f-96f3-6e7fe8a8beee
// c8f3532b-ed45-4812-8da9-2a1b0afe4179
#define NS_IFRAME_IID \
{ 0x8657598f, 0xa18a, 0x4b7f, { 0x96, 0xf3, 0x6e, 0x7f, 0xe8, 0xa8, 0xbe, 0xee } }
{ 0xc8f3532b, 0xed45, 0x4812, { 0x8d, 0xa9, 0x2a, 0x1b, 0x0a, 0xfe, 0x41, 0x79 } }
/**
* Indication of how the frame can be split. This is used when doing runaround
@ -563,6 +563,15 @@ public:
*/
virtual nsIFrame* GetContentInsertionFrame() { return this; }
/**
* Get the child content node whose frame should be used as the parent for
* the frames of child elements. A frame can implement this method, instead
* of GetContentInsertionFrame, if its insertion point corresponds to a
* content node, and the frame for that node is not constructed immediately
* when the frame is initialized.
*/
virtual already_AddRefed<nsIContent> GetContentInsertionNode() { return nsnull; }
/**
* Get the offsets of the frame. most will be 0,0
*

View File

@ -64,6 +64,7 @@ REQUIRES = xpcom \
CPPSRCS = \
nsXTFXULDisplayFrame.cpp \
nsXTFXMLDisplayFrame.cpp \
nsXTFFrameUtils.cpp \
$(NULL)
ifdef MOZ_SVG

View File

@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
* Alex Fritze <alex@croczilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsXTFFrameUtils.h"
#include "nsIFrame.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIDOMElement.h"
nsIFrame*
nsXTFFrameUtils::GetContentInsertionFrame(nsIFrame *aFrame)
{
nsCOMPtr<nsIContent> content =
nsXTFFrameUtils::GetContentInsertionNode(aFrame);
NS_ASSERTION(content, "element not implementing nsIContent!?");
nsIFrame* insertionFrame = nsnull;
aFrame->GetPresContext()->PresShell()->GetPrimaryFrameFor(content,
&insertionFrame);
return insertionFrame;
}
already_AddRefed<nsIContent>
nsXTFFrameUtils::GetContentInsertionNode(nsIFrame *aFrame)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual =
do_QueryInterface(aFrame->GetContent());
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
nsCOMPtr<nsIDOMElement> childInsertionPoint;
visual->GetInsertionPoint(getter_AddRefs(childInsertionPoint));
if (!childInsertionPoint) return nsnull; // we don't take visual child content
nsIContent *content = nsnull;
CallQueryInterface(childInsertionPoint, &content);
return content;
}

View File

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
* Alex Fritze <alex@croczilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef nsXTFFrameUtils_h_
#define nsXTFFrameUtils_h_
#include "nsIContent.h"
#include "nsCOMPtr.h"
class nsIFrame;
class nsXTFFrameUtils
{
public:
static NS_HIDDEN_(already_AddRefed<nsIContent>)
GetContentInsertionNode(nsIFrame *aFrame);
static NS_HIDDEN_(nsIFrame*) GetContentInsertionFrame(nsIFrame *aFrame);
};
#endif

View File

@ -46,6 +46,7 @@
#include "nsIDOMElement.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIAnonymousContentCreator.h"
#include "nsXTFFrameUtils.h"
////////////////////////////////////////////////////////////////////////
// nsXTFXMLBlockDisplayFrame
@ -71,6 +72,7 @@ private:
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
@ -108,22 +110,15 @@ NS_INTERFACE_MAP_END_INHERITING(nsXTFXMLBlockDisplayFrameBase)
nsIFrame*
nsXTFXMLBlockDisplayFrame::GetContentInsertionFrame()
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
nsCOMPtr<nsIDOMElement> childInsertionPoint;
visual->GetInsertionPoint(getter_AddRefs(childInsertionPoint));
if (!childInsertionPoint) return nsnull; // we don't take visual child content
nsCOMPtr<nsIContent> content = do_QueryInterface(childInsertionPoint);
NS_ASSERTION(content, "element not implementing nsIContent!?");
nsIFrame* insertionFrame = nsnull;
GetPresContext()->PresShell()->GetPrimaryFrameFor(content, &insertionFrame);
return insertionFrame;
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
already_AddRefed<nsIContent>
nsXTFXMLBlockDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP
nsXTFXMLBlockDisplayFrame::DidReflow(nsPresContext* aPresContext,
@ -174,6 +169,7 @@ private:
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
@ -211,22 +207,14 @@ NS_INTERFACE_MAP_END_INHERITING(nsXTFXMLInlineDisplayFrameBase)
nsIFrame*
nsXTFXMLInlineDisplayFrame::GetContentInsertionFrame()
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
nsCOMPtr<nsIDOMElement> childInsertionPoint;
visual->GetInsertionPoint(getter_AddRefs(childInsertionPoint));
if (!childInsertionPoint) return nsnull; // we don't take visual child content
nsCOMPtr<nsIContent> content = do_QueryInterface(childInsertionPoint);
NS_ASSERTION(content, "element not implementing nsIContent!?");
nsIFrame* insertionFrame = nsnull;
GetPresContext()->PresShell()->GetPrimaryFrameFor(content, &insertionFrame);
return insertionFrame;
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
already_AddRefed<nsIContent>
nsXTFXMLInlineDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP
nsXTFXMLInlineDisplayFrame::DidReflow(nsPresContext* aPresContext,

View File

@ -40,6 +40,7 @@
#include "nsIDOMElement.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIAnonymousContentCreator.h"
#include "nsXTFFrameUtils.h"
typedef nsBoxFrame nsXTFXULDisplayFrameBase;
@ -61,6 +62,7 @@ private:
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD EndLayout(nsBoxLayoutState& aState);
@ -108,19 +110,13 @@ NS_INTERFACE_MAP_END_INHERITING(nsXTFXULDisplayFrameBase)
nsIFrame*
nsXTFXULDisplayFrame::GetContentInsertionFrame()
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
nsCOMPtr<nsIDOMElement> childInsertionPoint;
visual->GetInsertionPoint(getter_AddRefs(childInsertionPoint));
if (!childInsertionPoint) return nsnull; // we don't take visual child content
nsCOMPtr<nsIContent> content = do_QueryInterface(childInsertionPoint);
NS_ASSERTION(content, "element not implementing nsIContent!?");
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
nsIFrame* insertionFrame = nsnull;
GetPresContext()->GetPresShell()->GetPrimaryFrameFor(content, &insertionFrame);
return insertionFrame;
already_AddRefed<nsIContent>
nsXTFXULDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP