Bug 508665 - part 3, Change GetContentInsertionFrame() to return a nsContainerFrame*, and return null for leaf frames. Deal with GetContentInsertionFrame() returning null in a couple of places. r=roc

This commit is contained in:
Mats Palmgren 2014-05-24 22:20:39 +00:00
parent 31ebc7ec9b
commit 273ad272f1
33 changed files with 122 additions and 109 deletions

View File

@ -2677,11 +2677,12 @@ ElementRestyler::RestyleBeforePseudo()
{
// Make sure not to do this for pseudo-frames or frames that
// can't have generated content.
nsContainerFrame* cif;
if (!mFrame->StyleContext()->GetPseudo() &&
((mFrame->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT) ||
// Our content insertion frame might have gotten flagged
(mFrame->GetContentInsertionFrame()->GetStateBits() &
NS_FRAME_MAY_HAVE_GENERATED_CONTENT))) {
((cif = mFrame->GetContentInsertionFrame()) &&
(cif->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)))) {
// Check for a new :before pseudo and an existing :before
// frame, but only if the frame is the first continuation.
nsIFrame* prevContinuation = mFrame->GetPrevContinuation();
@ -2711,11 +2712,12 @@ ElementRestyler::RestyleAfterPseudo(nsIFrame* aFrame)
{
// Make sure not to do this for pseudo-frames or frames that
// can't have generated content.
nsContainerFrame* cif;
if (!aFrame->StyleContext()->GetPseudo() &&
((aFrame->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT) ||
// Our content insertion frame might have gotten flagged
(aFrame->GetContentInsertionFrame()->GetStateBits() &
NS_FRAME_MAY_HAVE_GENERATED_CONTENT))) {
((cif = aFrame->GetContentInsertionFrame()) &&
(cif->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)))) {
// Check for new :after content, but only if the frame is the
// last continuation.
nsIFrame* nextContinuation = aFrame->GetNextContinuation();

View File

@ -336,7 +336,7 @@ AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
#define AssertAnonymousFlexOrGridItemParent(x, y) do { /* nothing */ } while(0)
#endif
static inline nsIFrame*
static inline nsContainerFrame*
GetFieldSetBlockFrame(nsIFrame* aFieldsetFrame)
{
// Depends on the fieldset child frame order - see ConstructFieldSetFrame() below.
@ -444,29 +444,29 @@ IsFramePartOfIBSplit(nsIFrame* aFrame)
return (aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0;
}
static nsIFrame* GetIBSplitSibling(nsIFrame* aFrame)
static nsContainerFrame* GetIBSplitSibling(nsIFrame* aFrame)
{
NS_PRECONDITION(IsFramePartOfIBSplit(aFrame), "Shouldn't call this");
// We only store the "ib-split sibling" annotation with the first
// frame in the continuation chain. Walk back to find that frame now.
return static_cast<nsIFrame*>
return static_cast<nsContainerFrame*>
(aFrame->FirstContinuation()->
Properties().Get(nsIFrame::IBSplitSibling()));
}
static nsIFrame* GetIBSplitPrevSibling(nsIFrame* aFrame)
static nsContainerFrame* GetIBSplitPrevSibling(nsIFrame* aFrame)
{
NS_PRECONDITION(IsFramePartOfIBSplit(aFrame), "Shouldn't call this");
// We only store the ib-split sibling annotation with the first
// frame in the continuation chain. Walk back to find that frame now.
return static_cast<nsIFrame*>
return static_cast<nsContainerFrame*>
(aFrame->FirstContinuation()->
Properties().Get(nsIFrame::IBSplitPrevSibling()));
}
static nsIFrame*
static nsContainerFrame*
GetLastIBSplitSibling(nsIFrame* aFrame, bool aReturnEmptyTrailingInline)
{
for (nsIFrame *frame = aFrame, *next; ; frame = next) {
@ -476,7 +476,7 @@ GetLastIBSplitSibling(nsIFrame* aFrame, bool aReturnEmptyTrailingInline)
!GetIBSplitSibling(next))) {
NS_ASSERTION(!next || !frame->IsInlineOutside(),
"Should have a block here!");
return frame;
return static_cast<nsContainerFrame*>(frame);
}
}
NS_NOTREACHED("unreachable code");
@ -591,7 +591,7 @@ SetInitialSingleChild(nsIFrame* aParent, nsIFrame* aFrame)
aParent->SetInitialChildList(kPrincipalList, temp);
}
static nsIFrame*
static nsContainerFrame*
GetContentInsertionFrameFor(nsIContent* aContent)
{
// Get the primary frame associated with the content
@ -607,9 +607,9 @@ GetContentInsertionFrameFor(nsIContent* aContent)
return nullptr;
}
nsIFrame* insertionFrame = frame->GetContentInsertionFrame();
nsContainerFrame* insertionFrame = frame->GetContentInsertionFrame();
NS_ASSERTION(insertionFrame == frame || !frame->IsLeaf(),
NS_ASSERTION(!insertionFrame || insertionFrame == frame || !frame->IsLeaf(),
"The insertion frame is the primary frame or the primary frame isn't a leaf");
return insertionFrame;
@ -3173,7 +3173,8 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
for (nsFrameList::Enumerator e(childItems); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
if (child->GetContentInsertionFrame()->GetType() == nsGkAtoms::legendFrame) {
nsContainerFrame* cif = child->GetContentInsertionFrame();
if (cif && cif->GetType() == nsGkAtoms::legendFrame) {
// We want the legend to be the first frame in the fieldset child list.
// That way the EventStateManager will do the right thing when tabbing
// from a selection point within the legend (bug 236071), which is
@ -5765,10 +5766,10 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIFrame* aFrame)
* parent to use for newly-appended content. *aAfterFrame points to the :after
* frame before which appended content should go, if there is one.
*/
static nsIFrame*
static nsContainerFrame*
AdjustAppendParentForAfterContent(nsPresContext* aPresContext,
nsIContent* aContainer,
nsIFrame* aParentFrame,
nsContainerFrame* aParentFrame,
nsIFrame** aAfterFrame)
{
// See if the parent has an :after pseudo-element. Check for the presence
@ -5795,7 +5796,7 @@ AdjustAppendParentForAfterContent(nsPresContext* aPresContext,
// appending to that last part, so advance to it if needed. Note that here
// aParentFrame is the result of a GetLastIBSplitSibling call, so must be
// either the last or next to last ib-split sibling.
nsIFrame* trailingInline = GetIBSplitSibling(aParentFrame);
nsContainerFrame* trailingInline = GetIBSplitSibling(aParentFrame);
if (trailingInline) {
aParentFrame = trailingInline;
}
@ -5806,7 +5807,8 @@ AdjustAppendParentForAfterContent(nsPresContext* aPresContext,
// other cases appending to the last nonempty continuation is fine
// and in fact not doing that can confuse code that doesn't know
// to pull kids from continuations other than its next one.
aParentFrame = aParentFrame->LastContinuation();
aParentFrame =
static_cast<nsContainerFrame*>(aParentFrame->LastContinuation());
}
return aParentFrame;
@ -6023,7 +6025,10 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
if (IsFrameForFieldSet(parentFrame, parentType)) {
// Legends can be sibling of legends but not of other content in the fieldset
nsIAtom* sibType = aSibling->GetContentInsertionFrame()->GetType();
if (nsContainerFrame* cif = aSibling->GetContentInsertionFrame()) {
aSibling = cif;
}
nsIAtom* sibType = aSibling->GetType();
bool legendContent = aContent->IsHTML(nsGkAtoms::legend);
if ((legendContent && (nsGkAtoms::legendFrame != sibType)) ||
@ -6119,15 +6124,15 @@ nsCSSFrameConstructor::FindNextSibling(FlattenedChildIterator aIter,
}
// For fieldsets, returns the area frame, if the child is not a legend.
static nsIFrame*
GetAdjustedParentFrame(nsIFrame* aParentFrame,
nsIAtom* aParentFrameType,
nsIContent* aChildContent)
static nsContainerFrame*
GetAdjustedParentFrame(nsContainerFrame* aParentFrame,
nsIAtom* aParentFrameType,
nsIContent* aChildContent)
{
NS_PRECONDITION(nsGkAtoms::tableOuterFrame != aParentFrameType,
"Shouldn't be happening!");
nsIFrame* newParent = nullptr;
nsContainerFrame* newParent = nullptr;
if (nsGkAtoms::fieldSetFrame == aParentFrameType) {
// If the parent is a fieldSet, use the fieldSet's area frame as the
@ -6136,11 +6141,11 @@ GetAdjustedParentFrame(nsIFrame* aParentFrame,
newParent = GetFieldSetBlockFrame(aParentFrame);
}
}
return (newParent) ? newParent : aParentFrame;
return newParent ? newParent : aParentFrame;
}
nsIFrame*
nsCSSFrameConstructor::GetInsertionPrevSibling(nsIFrame*& aParentFrame,
nsCSSFrameConstructor::GetInsertionPrevSibling(nsContainerFrame*& aParentFrame,
nsIContent* aContainer,
nsIContent* aChild,
bool* aIsAppend,
@ -6504,7 +6509,7 @@ nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
}
}
nsIFrame*
nsContainerFrame*
nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild,
@ -6514,7 +6519,7 @@ nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
// real parent frame; if not, then the frame hasn't been built yet
// and we just bail.
bool multiple = false;
nsIFrame* insertionPoint = GetInsertionPoint(aContainer, nullptr, &multiple);
nsContainerFrame* insertionPoint = GetInsertionPoint(aContainer, nullptr, &multiple);
if (!insertionPoint && !multiple)
return nullptr; // Don't build the frames.
@ -6645,7 +6650,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
}
// Get the frame associated with the content
nsIFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer);
nsContainerFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer);
// See comment in ContentRangeInserted for why this is necessary.
if (!parentFrame && !aContainer->IsActiveChildrenElement()) {
@ -7078,7 +7083,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
return rv;
}
nsIFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer);
nsContainerFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer);
// The xbl:children element won't have a frame, but default content can have the children as
// a parent. While its uncommon to change the structure of the default content itself, a label,
// for example, can be reframed by having its value attribute set or removed.
@ -7408,7 +7413,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
// We need to determine where to put the caption items; start with the
// the parent frame that has already been determined and get the insertion
// prevsibling of the first caption item.
nsIFrame* captionParent = parentFrame;
nsContainerFrame* captionParent = parentFrame;
bool captionIsAppend;
nsIFrame* captionPrevSibling = nullptr;
@ -8340,7 +8345,7 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
return NS_OK;
}
nsIFrame*
nsContainerFrame*
nsCSSFrameConstructor::GetInsertionPoint(nsIContent* aContainer,
nsIContent* aChildContent,
bool* aMultiple)
@ -8375,7 +8380,8 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIContent* aContainer,
insertionElement = aContainer;
}
nsIFrame* insertionPoint = ::GetContentInsertionFrameFor(insertionElement);
nsContainerFrame* insertionPoint =
::GetContentInsertionFrameFor(insertionElement);
// fieldsets have multiple insertion points. Note that we might
// have to look at insertionElement here...
@ -8502,7 +8508,8 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
return true;
}
if (aFrame->GetContentInsertionFrame()->GetType() == nsGkAtoms::legendFrame &&
nsContainerFrame* insertionFrame = aFrame->GetContentInsertionFrame();
if (insertionFrame && insertionFrame->GetType() == nsGkAtoms::legendFrame &&
aFrame->GetParent()->GetType() == nsGkAtoms::fieldSetFrame) {
// When we remove the legend for a fieldset, we should reframe
// the fieldset to ensure another legend is used, if there is one
@ -9311,7 +9318,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
nsIFrame* aPossiblyLeafFrame)
{
NS_PRECONDITION(aFrame, "Must have parent frame here");
NS_PRECONDITION(aFrame->GetContentInsertionFrame() == aFrame,
NS_PRECONDITION(!aFrame->GetContentInsertionFrame() ||
aFrame->GetContentInsertionFrame() == aFrame,
"Parent frame in ProcessChildren should be its own "
"content insertion frame");
const uint32_t kMaxDepth = 2 * MAX_REFLOW_DEPTH;
@ -9612,7 +9620,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames(
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsIFrame** aParentFrame,
nsContainerFrame** aParentFrame,
nsIFrame* aPrevSibling,
nsFrameItems& aFrameItems)
{

View File

@ -29,6 +29,7 @@ struct nsStyleDisplay;
class nsIDOMHTMLSelectElement;
struct nsGenConInitializer;
class nsContainerFrame;
class nsFirstLineFrame;
class nsICSSAnonBoxPseudo;
class nsPageContentFrame;
@ -111,10 +112,10 @@ private:
// that insertion point. If not, returns null and issues single
// ContentInserted calls for each child. aEndChild = nullptr indicates that we
// are dealing with an append.
nsIFrame* GetRangeInsertionPoint(nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild,
bool aAllowLazyConstruction);
nsContainerFrame* GetRangeInsertionPoint(nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild,
bool aAllowLazyConstruction);
// Returns true if parent was recreated due to frameset child, false otherwise.
bool MaybeRecreateForFrameset(nsIFrame* aParentFrame,
@ -233,9 +234,9 @@ public:
nsresult ReplicateFixedFrames(nsPageContentFrame* aParentFrame);
// Get the XBL insertion point for a child
nsIFrame* GetInsertionPoint(nsIContent* aContainer,
nsIContent* aChildContent,
bool* aMultiple = nullptr);
nsContainerFrame* GetInsertionPoint(nsIContent* aContainer,
nsIContent* aChildContent,
bool* aMultiple = nullptr);
nsresult CreateListBoxContent(nsPresContext* aPresContext,
nsIFrame* aParentFrame,
@ -1687,7 +1688,7 @@ private:
nsresult InsertFirstLineFrames(nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aBlockFrame,
nsIFrame** aParentFrame,
nsContainerFrame** aParentFrame,
nsIFrame* aPrevSibling,
nsFrameItems& aFrameItems);
@ -1728,7 +1729,7 @@ private:
// including aEndSkipChild will be skipped over when looking for sibling
// frames. Skipping a range can deal with XBL but not when there are multiple
// insertion points.
nsIFrame* GetInsertionPrevSibling(nsIFrame*& aParentFrame, /* inout */
nsIFrame* GetInsertionPrevSibling(nsContainerFrame*& aParentFrame, /* inout */
nsIContent* aContainer,
nsIContent* aChild,
bool* aIsAppend,

View File

@ -301,8 +301,12 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
if (NS_FAILED(rv))
return rv;
nsIFrame *frame = aFrame->GetContentInsertionFrame();
NS_ASSERTION(frame, "We should not be in the middle of reflow");
nsIFrame* frame = aFrame->GetContentInsertionFrame();
if (!frame) {
frame = aFrame;
}
NS_ASSERTION(!(frame->GetStateBits() & NS_FRAME_IN_REFLOW),
"We should not be in the middle of reflow");
nscoord baseline = frame->GetCaretBaseline();
nscoord ascent = 0, descent = 0;
nsRefPtr<nsFontMetrics> fm;

View File

@ -2478,9 +2478,8 @@ nsDocumentViewer::FindContainerView()
if (!parentPresShell) {
NS_WARNING("Subdocument container has no presshell");
} else {
nsIFrame* f = parentPresShell->GetRealPrimaryFrameFor(containerElement);
if (f) {
nsIFrame* subdocFrame = f->GetContentInsertionFrame();
nsIFrame* subdocFrame = parentPresShell->GetRealPrimaryFrameFor(containerElement);
if (subdocFrame) {
// subdocFrame might not be a subdocument frame; the frame
// constructor can treat a <frame> as an inline in some XBL
// cases. Treat that as display:none, the document is not

View File

@ -909,16 +909,15 @@ nsLayoutUtils::GetCriticalDisplayPort(nsIContent* aContent, nsRect* aResult)
return false;
}
nsIFrame*
nsLayoutUtils::LastContinuationWithChild(nsIFrame* aFrame)
nsContainerFrame*
nsLayoutUtils::LastContinuationWithChild(nsContainerFrame* aFrame)
{
NS_PRECONDITION(aFrame, "NULL frame pointer");
aFrame = aFrame->LastContinuation();
while (!aFrame->GetFirstPrincipalChild() &&
aFrame->GetPrevContinuation()) {
aFrame = aFrame->GetPrevContinuation();
nsIFrame* f = aFrame->LastContinuation();
while (!f->GetFirstPrincipalChild() && f->GetPrevContinuation()) {
f = f->GetPrevContinuation();
}
return aFrame;
return static_cast<nsContainerFrame*>(f);
}
/**
@ -957,13 +956,13 @@ GetFirstChildFrame(nsIFrame* aFrame,
* @param aFrame the frame's content node
*/
static nsIFrame*
GetLastChildFrame(nsIFrame* aFrame,
nsIContent* aContent)
GetLastChildFrame(nsContainerFrame* aFrame,
nsIContent* aContent)
{
NS_PRECONDITION(aFrame, "NULL frame pointer");
// Get the last continuation frame that's a parent
nsIFrame* lastParentContinuation =
nsContainerFrame* lastParentContinuation =
nsLayoutUtils::LastContinuationWithChild(aFrame);
nsIFrame* lastChildFrame =
lastParentContinuation->GetLastChild(nsIFrame::kPrincipalList);
@ -978,7 +977,8 @@ GetLastChildFrame(nsIFrame* aFrame,
if (lastChildFrame &&
lastChildFrame->IsPseudoFrame(aContent) &&
!lastChildFrame->IsGeneratedContentFrame()) {
return GetLastChildFrame(lastChildFrame, aContent);
return GetLastChildFrame(static_cast<nsContainerFrame*>(lastChildFrame),
aContent);
}
return lastChildFrame;
@ -1094,8 +1094,10 @@ nsLayoutUtils::GetBeforeFrame(nsIFrame* aFrame)
"aFrame must be first continuation");
nsIFrame* cif = aFrame->GetContentInsertionFrame();
if (!cif) {
return nullptr;
}
nsIFrame* firstFrame = GetFirstChildFrame(cif, aFrame->GetContent());
if (firstFrame && IsGeneratedContentFor(nullptr, firstFrame,
nsCSSPseudoElements::before)) {
return firstFrame;
@ -1110,9 +1112,11 @@ nsLayoutUtils::GetAfterFrame(nsIFrame* aFrame)
{
NS_PRECONDITION(aFrame, "NULL frame pointer");
nsIFrame* cif = aFrame->GetContentInsertionFrame();
nsContainerFrame* cif = aFrame->GetContentInsertionFrame();
if (!cif) {
return nullptr;
}
nsIFrame* lastFrame = GetLastChildFrame(cif, aFrame->GetContent());
if (lastFrame && IsGeneratedContentFor(nullptr, lastFrame,
nsCSSPseudoElements::after)) {
return lastFrame;

View File

@ -45,6 +45,7 @@ class nsFontFaceList;
class nsIImageLoadingContent;
class nsStyleContext;
class nsBlockFrame;
class nsContainerFrame;
class gfxASurface;
class gfxDrawable;
class nsView;
@ -384,7 +385,7 @@ public:
* LastContinuationWithChild gets the last continuation in aFrame's chain
* that has a child, or the first continuation if the frame has no children.
*/
static nsIFrame* LastContinuationWithChild(nsIFrame* aFrame);
static nsContainerFrame* LastContinuationWithChild(nsContainerFrame* aFrame);
/**
* GetLastSibling simply finds the last sibling of aFrame, or returns nullptr if

View File

@ -125,7 +125,7 @@ nsColorControlFrame::AttributeChanged(int32_t aNameSpaceID,
aModType);
}
nsIFrame*
nsContainerFrame*
nsColorControlFrame::GetContentInsertionFrame()
{
return this;

View File

@ -45,7 +45,7 @@ public:
nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE;
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;

View File

@ -1116,7 +1116,7 @@ nsComboboxControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aValue)
return fcFrame->SetFormProperty(aName, aValue);
}
nsIFrame*
nsContainerFrame*
nsComboboxControlFrame::GetContentInsertionFrame() {
return mInRedisplayText ? mDisplayFrame : mDropdownFrame->GetContentInsertionFrame();
}

View File

@ -108,7 +108,7 @@ public:
virtual const nsFrameList& GetChildList(ChildListID aListID) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
// nsIFormControlFrame
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
@ -255,7 +255,7 @@ protected:
nsFrameList mPopupFrames; // additional named child list
nsCOMPtr<nsIContent> mDisplayContent; // Anonymous content used to display the current selection
nsCOMPtr<nsIContent> mButtonContent; // Anonymous content for the button
nsIFrame* mDisplayFrame; // frame to display selection
nsContainerFrame* mDisplayFrame; // frame to display selection
nsIFrame* mButtonFrame; // button frame
nsIFrame* mDropdownFrame; // dropdown list frame
nsIListControlFrame * mListControlFrame; // ListControl Interface for the dropdown frame

View File

@ -210,7 +210,7 @@ nsGfxButtonControlFrame::IsLeaf() const
return true;
}
nsIFrame*
nsContainerFrame*
nsGfxButtonControlFrame::GetContentInsertionFrame()
{
return this;

View File

@ -50,7 +50,7 @@ public:
virtual bool IsLeaf() const MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
protected:
nsresult GetDefaultLabel(nsXPIDLString& aLabel) const;

View File

@ -80,7 +80,7 @@ public:
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
// Inserted child content gets its frames parented by our child block
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -596,7 +596,7 @@ nsListControlFrame::ShouldPropagateComputedHeightToScrolledContent() const
}
//---------------------------------------------------------
nsIFrame*
nsContainerFrame*
nsListControlFrame::GetContentInsertionFrame() {
return GetOptionsContainer()->GetContentInsertionFrame();
}

View File

@ -86,7 +86,7 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
/**
* Get the "type" of the frame

View File

@ -39,7 +39,7 @@ public:
*/
virtual nscoord GetAvailableContentHeight(const nsHTMLReflowState& aReflowState);
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
nsIFrame* frame = GetFirstPrincipalChild();
// if no children return nullptr

View File

@ -61,6 +61,10 @@ public:
nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE
{
return this;
}
virtual const nsFrameList& GetChildList(ChildListID aList) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;

View File

@ -519,7 +519,7 @@ public:
return this;
}
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
}
@ -802,7 +802,7 @@ public:
return this;
}
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
}

View File

@ -86,7 +86,7 @@ public:
#endif
// Inserted child content gets its frames parented by our child block
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -568,7 +568,7 @@ public:
* Get the frame that should be the parent for the frames of child elements
* May return nullptr during reflow
*/
virtual nsIFrame* GetContentInsertionFrame() { return this; }
virtual nsContainerFrame* GetContentInsertionFrame() { return nullptr; }
/**
* Move any frames on our overflow list to the end of our principal list.

View File

@ -279,7 +279,7 @@ public:
nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE
{
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -39,7 +39,7 @@ public:
nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -79,7 +79,7 @@ public:
}
#endif
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
// Any children must be added to our single anonymous inner frame kid.
NS_ABORT_IF_FALSE(GetFirstPrincipalChild() &&
GetFirstPrincipalChild()->GetType() ==

View File

@ -88,7 +88,7 @@ public:
nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
// Any children must be added to our single anonymous inner frame kid.
NS_ABORT_IF_FALSE(GetFirstPrincipalChild() &&
GetFirstPrincipalChild()->GetType() ==

View File

@ -71,7 +71,7 @@ public:
virtual nsresult RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -86,7 +86,7 @@ public:
virtual nsresult RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return GetFirstPrincipalChild()->GetContentInsertionFrame();
}

View File

@ -1098,7 +1098,7 @@ nsBoxFrame::AppendFrames(ChildListID aListID,
return NS_OK;
}
/* virtual */ nsIFrame*
/* virtual */ nsContainerFrame*
nsBoxFrame::GetContentInsertionFrame()
{
if (GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK)

View File

@ -99,7 +99,7 @@ public:
virtual nsresult RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) MOZ_OVERRIDE;

View File

@ -159,17 +159,6 @@ nsMenuBarFrame::ToggleMenuActiveState()
return nullptr;
}
static void
GetInsertionPoint(nsIPresShell* aShell, nsIFrame* aFrame, nsIFrame* aChild,
nsIFrame** aResult)
{
nsIContent* child = nullptr;
if (aChild)
child = aChild->GetContent();
*aResult = aShell->FrameConstructor()->
GetInsertionPoint(aFrame->GetContent(), child);
}
nsMenuFrame*
nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
{
@ -188,8 +177,8 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
return nullptr; // no character was pressed so just return
// Enumerate over our list of frames.
nsIFrame* immediateParent = nullptr;
GetInsertionPoint(PresContext()->PresShell(), this, nullptr, &immediateParent);
nsIFrame* immediateParent = PresContext()->PresShell()->FrameConstructor()->
GetInsertionPoint(GetContent(), nullptr);
if (!immediateParent)
immediateParent = this;

View File

@ -1622,7 +1622,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction
doAction = false;
// Enumerate over our list of frames.
nsIFrame* immediateParent = PresContext()->PresShell()->
nsContainerFrame* immediateParent = PresContext()->PresShell()->
FrameConstructor()->GetInsertionPoint(GetContent(), nullptr);
if (!immediateParent)
immediateParent = this;

View File

@ -2144,12 +2144,12 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
}
nsMenuFrame*
nsXULPopupManager::GetNextMenuItem(nsIFrame* aParent,
nsXULPopupManager::GetNextMenuItem(nsContainerFrame* aParent,
nsMenuFrame* aStart,
bool aIsPopup)
{
nsPresContext* presContext = aParent->PresContext();
nsIFrame* immediateParent = presContext->PresShell()->
nsContainerFrame* immediateParent = presContext->PresShell()->
FrameConstructor()->GetInsertionPoint(aParent->GetContent(), nullptr);
if (!immediateParent)
immediateParent = aParent;
@ -2185,12 +2185,12 @@ nsXULPopupManager::GetNextMenuItem(nsIFrame* aParent,
}
nsMenuFrame*
nsXULPopupManager::GetPreviousMenuItem(nsIFrame* aParent,
nsXULPopupManager::GetPreviousMenuItem(nsContainerFrame* aParent,
nsMenuFrame* aStart,
bool aIsPopup)
{
nsPresContext* presContext = aParent->PresContext();
nsIFrame* immediateParent = presContext->PresShell()->
nsContainerFrame* immediateParent = presContext->PresShell()->
FrameConstructor()->GetInsertionPoint(aParent->GetContent(), nullptr);
if (!immediateParent)
immediateParent = aParent;

View File

@ -46,6 +46,7 @@
* calling Rollup.
*/
class nsContainerFrame;
class nsMenuFrame;
class nsMenuPopupFrame;
class nsMenuBarFrame;
@ -329,10 +330,10 @@ public:
// returns the item before it, while GetNextMenuItem returns the
// item after it.
// aIsPopup - true for menupopups, false for menubars
static nsMenuFrame* GetPreviousMenuItem(nsIFrame* aParent,
static nsMenuFrame* GetPreviousMenuItem(nsContainerFrame* aParent,
nsMenuFrame* aStart,
bool aIsPopup);
static nsMenuFrame* GetNextMenuItem(nsIFrame* aParent,
static nsMenuFrame* GetNextMenuItem(nsContainerFrame* aParent,
nsMenuFrame* aStart,
bool aIsPopup);