diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 97feb6d927dd..c93e5c2da130 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1903,10 +1903,8 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState, aState.GetGeometricParent(outerStyleContext->GetStyleDisplay(), aParentFrame); - // Init the table outer frame and see if we need to create a view, e.g. - // the frame is absolutely positioned + // Init the table outer frame InitAndRestoreFrame(aState, content, geometricParent, nsnull, newFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Create the inner table frame nsIFrame* innerFrame; @@ -1986,7 +1984,6 @@ nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState, return NS_ERROR_OUT_OF_MEMORY; } InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); nsFrameItems childItems; nsresult rv; @@ -2087,7 +2084,6 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState, // Initialize the table cell frame InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Resolve pseudo style and initialize the body cell frame nsRefPtr innerPseudoStyle; @@ -2435,9 +2431,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle } *aNewFrame = frameItems.FirstChild(); processChildren = PR_TRUE; - - // See if we need to create a view - nsContainerFrame::CreateViewForFrame(contentFrame, PR_FALSE); } else { return NS_ERROR_FAILURE; } @@ -2955,8 +2948,6 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, buttonFrame->Destroy(); return rv; } - // See if we need to create a view - nsContainerFrame::CreateViewForFrame(buttonFrame, PR_FALSE); nsRefPtr innerBlockContext; innerBlockContext = @@ -3084,17 +3075,12 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState, aState.GetGeometricParent(aStyleDisplay, aParentFrame), nsnull, comboboxFrame); - nsContainerFrame::CreateViewForFrame(comboboxFrame, PR_FALSE); - rv = aState.AddChild(comboboxFrame, aFrameItems, content, styleContext, aParentFrame); if (NS_FAILED(rv)) { return rv; } - /////////////////////////////////////////////////////////////////// - // Combobox - Old Native Implementation - /////////////////////////////////////////////////////////////////// nsIComboboxControlFrame* comboBox = do_QueryFrame(comboboxFrame); NS_ASSERTION(comboBox, "NS_NewComboboxControlFrame returned frame that " "doesn't implement nsIComboboxControlFrame"); @@ -3128,11 +3114,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState, comboboxFrame, listStyle, PR_TRUE, aItem.mPendingBinding, aFrameItems); - // Set flag so the events go to the listFrame not child frames. - // XXX: We should replace this with a real widget manager similar - // to how the nsFormControlFrame works. Re-directing events is a temporary Kludge. NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nsnull"); - //listFrame->GetView()->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN); // Create display and button frames from the combobox's anonymous content. // The anonymous content is appended to existing anonymous content for this @@ -3159,9 +3141,6 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState, aState.mFrameState); } } else { - /////////////////////////////////////////////////////////////////// - // ListBox - Old Native Implementation - /////////////////////////////////////////////////////////////////// nsIFrame* listFrame = NS_NewListControlFrame(mPresShell, styleContext); if (listFrame) { rv = NS_OK; @@ -3223,7 +3202,9 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsFrameConstructorState& aState, } } - nsContainerFrame::CreateViewForFrame(scrollFrame, aBuildCombobox); + if (aBuildCombobox) { + nsContainerFrame::CreateViewForFrame(scrollFrame, PR_TRUE); + } BuildScrollFrame(aState, aContent, aStyleContext, scrolledFrame, geometricParent, scrollFrame); @@ -3272,10 +3253,6 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, aState.GetGeometricParent(aStyleDisplay, aParentFrame), nsnull, newFrame); - // See if we need to create a view, e.g. the frame is absolutely - // positioned - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); - // Resolve style and initialize the frame nsRefPtr fieldsetContentStyle; fieldsetContentStyle = mPresShell->StyleSet()-> @@ -4229,9 +4206,6 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState, } InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, gfxScrollFrame); - - // Create a view - nsContainerFrame::CreateViewForFrame(gfxScrollFrame, PR_FALSE); } // if there are any anonymous children for the scroll frame, create @@ -4912,7 +4886,6 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a // We don't allow this frame to be out of flow InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); nsresult rv = aState.AddChild(newFrame, aFrameItems, content, styleContext, aParentFrame, PR_FALSE, PR_FALSE); @@ -8374,7 +8347,6 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShe if (newFrame) { newFrame->Init(aContent, aParentFrame, aFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Create a continuing inner table frame, and if there's a caption then // replicate the caption @@ -8420,7 +8392,6 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, if (newFrame) { newFrame->Init(aContent, aParentFrame, aFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Replicate any header/footer frames nsFrameItems childFrames; @@ -8500,7 +8471,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::inlineFrame == frameType) { @@ -8508,7 +8478,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::blockFrame == frameType) { @@ -8516,7 +8485,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } #ifdef MOZ_XUL @@ -8525,7 +8493,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } #endif } else if (nsGkAtoms::columnSetFrame == frameType) { @@ -8533,7 +8500,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::positionedInlineFrame == frameType) { @@ -8541,7 +8507,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::pageFrame == frameType) { @@ -8561,7 +8526,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::tableRowFrame == frameType) { @@ -8569,7 +8533,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Create a continuing frame for each table cell frame nsFrameItems newChildList; @@ -8603,7 +8566,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); // Create a continuing area frame nsIFrame* continuingBlockFrame; @@ -8625,7 +8587,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::letterFrame == frameType) { @@ -8633,7 +8594,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else if (nsGkAtoms::imageFrame == frameType) { @@ -8673,8 +8633,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); - // Create a continuing area frame // XXXbz we really shouldn't have to do this by hand! nsIFrame* continuingBlockFrame; @@ -8694,7 +8652,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); - nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); } } else { NS_NOTREACHED("unexpected frame type"); @@ -10625,6 +10582,7 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState, { // Create column wrapper if necessary nsIFrame* blockFrame = *aNewFrame; + NS_ASSERTION(blockFrame->GetType() == nsGkAtoms::blockFrame, "not a block frame?"); nsIFrame* parent = aParentFrame; nsRefPtr blockStyle = aStyleContext; const nsStyleColumn* columns = aStyleContext->GetStyleColumn(); @@ -10638,8 +10596,6 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState, } InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, columnSetFrame); - // See if we need to create a view - nsContainerFrame::CreateViewForFrame(columnSetFrame, PR_FALSE); blockStyle = mPresShell->StyleSet()-> ResolveAnonymousBoxStyle(nsCSSAnonBoxes::columnContent, aStyleContext); parent = columnSetFrame; @@ -10659,9 +10615,6 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState, return rv; } - // See if we need to create a view, e.g. the frame is absolutely positioned - nsHTMLContainerFrame::CreateViewForFrame(blockFrame, PR_FALSE); - if (!mRootElementFrame) { // The frame we're constructing will be the root element frame. // Set mRootElementFrame before processing children. @@ -10778,9 +10731,6 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState, // because the object's destructor is significant // this is part of the fix for bug 42372 - // Any inline frame might need a view (because of opacity, or fixed background) - nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE); - if (positioned) { // Relatively positioned frames becomes a container for child // frames that are positioned @@ -10867,9 +10817,6 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState, InitAndRestoreFrame(aState, content, parentFrame, nsnull, blockFrame, PR_FALSE); - // Any frame could have a view - nsContainerFrame::CreateViewForFrame(blockFrame, PR_FALSE); - // Find the first non-block child which defines the end of our block kids // and the start of our next inline's kids nsFrameList::FrameLinkEnumerator firstNonBlock = @@ -10894,9 +10841,6 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState, InitAndRestoreFrame(aState, content, parentFrame, nsnull, inlineFrame, PR_FALSE); - // Any frame might need a view - nsHTMLContainerFrame::CreateViewForFrame(inlineFrame, PR_FALSE); - if (aChildItems.NotEmpty()) { nsFrameList::FrameLinkEnumerator firstBlock(aChildItems); FindFirstBlock(firstBlock); diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index fa7c13def223..4b8e588dfb11 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -1451,6 +1451,8 @@ private: nsIFrame* aScrolledFrame); // InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false + // aBuildCombobox indicates if we are building a combobox that has a dropdown + // popup widget or not. nsresult InitializeSelectFrame(nsFrameConstructorState& aState, nsIFrame* scrollFrame,