From 7f933168f7d3ee297fb0d762cd40af27932a7f18 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Mon, 29 Dec 2008 10:07:38 -0500 Subject: [PATCH] Stop using nsAreaFrame for anything other than xul:label, which is the only thing for which it does anything different from nsBlockFrame, and rename it accordingly. (Bug 471356) r+sr=roc --HG-- rename : layout/generic/nsAreaFrame.cpp => layout/xul/base/src/nsXULLabelFrame.cpp rename : layout/generic/nsAreaFrame.h => layout/xul/base/src/nsXULLabelFrame.h --- content/base/src/nsGkAtomList.h | 4 +- content/xul/content/src/nsXULElement.cpp | 2 +- layout/base/nsCSSFrameConstructor.cpp | 91 +++++++++++-------- layout/forms/nsComboboxControlFrame.cpp | 18 ++-- layout/forms/nsComboboxControlFrame.h | 6 +- layout/forms/nsFileControlFrame.cpp | 16 ++-- layout/forms/nsFileControlFrame.h | 6 +- layout/forms/nsIsIndexFrame.cpp | 12 +-- layout/forms/nsIsIndexFrame.h | 4 +- layout/forms/nsLegendFrame.cpp | 8 +- layout/forms/nsLegendFrame.h | 6 +- layout/forms/nsSelectsAreaFrame.cpp | 6 +- layout/forms/nsSelectsAreaFrame.h | 12 +-- layout/forms/nsTextControlFrame.h | 2 +- layout/generic/Makefile.in | 1 - layout/generic/nsFrame.cpp | 4 +- layout/generic/nsHTMLParts.h | 7 -- layout/generic/nsHTMLReflowState.cpp | 8 +- .../base/src/nsMathMLForeignFrameWrapper.cpp | 2 +- .../mathml/base/src/nsMathMLmtableFrame.cpp | 2 +- layout/xul/base/src/Makefile.in | 1 + layout/xul/base/src/nsBoxFrame.cpp | 2 +- layout/xul/base/src/nsTextBoxFrame.cpp | 2 +- .../base/src/nsXULLabelFrame.cpp} | 53 ++++------- .../base/src/nsXULLabelFrame.h} | 37 +++----- 25 files changed, 145 insertions(+), 167 deletions(-) rename layout/{generic/nsAreaFrame.cpp => xul/base/src/nsXULLabelFrame.cpp} (76%) rename layout/{generic/nsAreaFrame.h => xul/base/src/nsXULLabelFrame.h} (77%) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 87fc511c497..a0ba4b00584 100755 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -1482,7 +1482,6 @@ GK_ATOM(processingInstructionTagName, "#processing-instruction") GK_ATOM(textTagName, "#text") // Frame types -GK_ATOM(areaFrame, "AreaFrame") GK_ATOM(bcTableCellFrame, "BCTableCellFrame") // table cell in border collapsing model GK_ATOM(blockFrame, "BlockFrame") GK_ATOM(boxFrame, "BoxFrame") @@ -1535,6 +1534,9 @@ GK_ATOM(tableRowFrame, "TableRowFrame") GK_ATOM(textInputFrame,"TextInputFrame") GK_ATOM(textFrame, "TextFrame") GK_ATOM(viewportFrame, "ViewportFrame") +#ifdef MOZ_XUL +GK_ATOM(XULLabelFrame, "XULLabelFrame") +#endif #ifdef MOZ_SVG GK_ATOM(svgAFrame, "SVGAFrame") GK_ATOM(svgClipPathFrame, "SVGClipPathFrame") diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 51d786cdfbd..c83faf9d0db 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -1342,7 +1342,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) } // If the accesskey attribute is removed, unregister it here - // Also see nsAreaFrame, nsBoxFrame and nsTextBoxFrame's AttributeChanged + // Also see nsXULLabelFrame, nsBoxFrame and nsTextBoxFrame's AttributeChanged if (aName == nsGkAtoms::accesskey || aName == nsGkAtoms::control) { UnregisterAccessKey(oldValue); } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index cea999ac745..190364d376f 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -271,6 +271,7 @@ static FrameCtorDebugFlags gFlags[] = { #include "nsPIListBoxObject.h" #include "nsListBoxBodyFrame.h" #include "nsListItemFrame.h" +#include "nsXULLabelFrame.h" //------------------------------------------------------------------ @@ -399,7 +400,7 @@ SVG_GetFirstNonAAncestorFrame(nsIFrame *aParentFrame) #endif static inline nsIFrame* -GetFieldSetAreaFrame(nsIFrame* aFieldsetFrame) +GetFieldSetBlockFrame(nsIFrame* aFieldsetFrame) { // Depends on the fieldset child frame order - see ConstructFieldSetFrame() below. nsIFrame* firstChild = aFieldsetFrame->GetFirstChild(nsnull); @@ -4823,16 +4824,16 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, nsCSSAnonBoxes::buttonContent, aStyleContext); - nsIFrame* areaFrame = NS_NewAreaFrame(mPresShell, styleContext, - NS_BLOCK_SPACE_MGR); + nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, styleContext, + NS_BLOCK_SPACE_MGR); - if (NS_UNLIKELY(!areaFrame)) { + if (NS_UNLIKELY(!blockFrame)) { buttonFrame->Destroy(); return NS_ERROR_OUT_OF_MEMORY; } - rv = InitAndRestoreFrame(aState, aContent, buttonFrame, nsnull, areaFrame); + rv = InitAndRestoreFrame(aState, aContent, buttonFrame, nsnull, blockFrame); if (NS_FAILED(rv)) { - areaFrame->Destroy(); + blockFrame->Destroy(); buttonFrame->Destroy(); return rv; } @@ -4840,7 +4841,7 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, rv = aState.AddChild(buttonFrame, aFrameItems, aContent, aStyleContext, aParentFrame); if (NS_FAILED(rv)) { - areaFrame->Destroy(); + blockFrame->Destroy(); buttonFrame->Destroy(); return rv; } @@ -4853,7 +4854,7 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, ShouldHaveSpecialBlockStyle(aContent, aStyleContext, &haveFirstLetterStyle, &haveFirstLineStyle); nsFrameConstructorSaveState floatSaveState; - aState.PushFloatContainingBlock(areaFrame, floatSaveState, + aState.PushFloatContainingBlock(blockFrame, floatSaveState, haveFirstLetterStyle, haveFirstLineStyle); @@ -4864,18 +4865,18 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, if (aStyleDisplay->IsPositioned()) { // The area frame becomes a container for child frames that are // absolutely positioned - aState.PushAbsoluteContainingBlock(areaFrame, absoluteSaveState); + aState.PushAbsoluteContainingBlock(blockFrame, absoluteSaveState); } - rv = ProcessChildren(aState, aContent, areaFrame, PR_TRUE, childItems, + rv = ProcessChildren(aState, aContent, blockFrame, PR_TRUE, childItems, buttonFrame->GetStyleDisplay()->IsBlockOutside()); if (NS_FAILED(rv)) return rv; // Set the areas frame's initial child lists - areaFrame->SetInitialChildList(nsnull, childItems.childList); + blockFrame->SetInitialChildList(nsnull, childItems.childList); } - buttonFrame->SetInitialChildList(nsnull, areaFrame); + buttonFrame->SetInitialChildList(nsnull, blockFrame); nsFrameItems anonymousChildItems; // if there are any anonymous children create frames for them @@ -4883,7 +4884,8 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, PR_FALSE, anonymousChildItems); if (anonymousChildItems.childList) { // the anonymous content is already parented to the area frame - aState.mFrameManager->AppendFrames(areaFrame, nsnull, anonymousChildItems.childList); + aState.mFrameManager->AppendFrames(blockFrame, nsnull, + anonymousChildItems.childList); } // our new button frame returned is the top frame. @@ -5164,9 +5166,10 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, nsCSSAnonBoxes::fieldsetContent, aStyleContext); - nsIFrame* areaFrame = NS_NewAreaFrame(mPresShell, styleContext, - NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT); - InitAndRestoreFrame(aState, aContent, newFrame, nsnull, areaFrame); + nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, styleContext, + NS_BLOCK_SPACE_MGR | + NS_BLOCK_MARGIN_ROOT); + InitAndRestoreFrame(aState, aContent, newFrame, nsnull, blockFrame); nsresult rv = aState.AddChild(newFrame, aFrameItems, aContent, aStyleContext, aParentFrame); @@ -5180,7 +5183,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, ShouldHaveSpecialBlockStyle(aContent, aStyleContext, &haveFirstLetterStyle, &haveFirstLineStyle); nsFrameConstructorSaveState floatSaveState; - aState.PushFloatContainingBlock(areaFrame, floatSaveState, + aState.PushFloatContainingBlock(blockFrame, floatSaveState, haveFirstLetterStyle, haveFirstLineStyle); @@ -5191,10 +5194,10 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, if (aStyleDisplay->IsPositioned()) { // The area frame becomes a container for child frames that are // absolutely positioned - aState.PushAbsoluteContainingBlock(areaFrame, absoluteSaveState); + aState.PushAbsoluteContainingBlock(blockFrame, absoluteSaveState); } - ProcessChildren(aState, aContent, areaFrame, PR_TRUE, + ProcessChildren(aState, aContent, blockFrame, PR_TRUE, childItems, PR_TRUE); static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); @@ -5214,7 +5217,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, } else { childItems.childList = legendFrame->GetNextSibling(); } - legendFrame->SetNextSibling(areaFrame); + legendFrame->SetNextSibling(blockFrame); legendFrame->SetParent(newFrame); break; } @@ -5223,10 +5226,10 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, } // Set the scrolled frame's initial child lists - areaFrame->SetInitialChildList(nsnull, childItems.childList); + blockFrame->SetInitialChildList(nsnull, childItems.childList); // Set the scroll frame's initial child list - newFrame->SetInitialChildList(nsnull, legendFrame ? legendFrame : areaFrame); + newFrame->SetInitialChildList(nsnull, legendFrame ? legendFrame : blockFrame); // our new frame returned is the top frame which is the list frame. aNewFrame = newFrame; @@ -5885,8 +5888,15 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState, (! aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value))) { // XXX we should probably be calling ConstructBlock here to handle // things like columns etc - newFrame = NS_NewAreaFrame(mPresShell, aStyleContext, - NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT); + if (aTag == nsGkAtoms::label) { + newFrame = NS_NewXULLabelFrame(mPresShell, aStyleContext, + NS_BLOCK_SPACE_MGR | + NS_BLOCK_MARGIN_ROOT); + } else { + newFrame = NS_NewBlockFrame(mPresShell, aStyleContext, + NS_BLOCK_SPACE_MGR | + NS_BLOCK_MARGIN_ROOT); + } } else { newFrame = NS_NewTextBoxFrame(mPresShell, aStyleContext); @@ -6170,7 +6180,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState, // that's why we call different things here. nsIAtom* frameType = geometricParent->GetType(); if ((frameType == nsGkAtoms::blockFrame) || - (frameType == nsGkAtoms::areaFrame)) { + (frameType == nsGkAtoms::XULLabelFrame)) { */ // See if we need to create a view, e.g. the frame is absolutely positioned nsHTMLContainerFrame::CreateViewForFrame(newFrame, aParentFrame, PR_FALSE); @@ -6457,8 +6467,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta // Initialize it // pass a temporary stylecontext, the correct one will be set later nsIFrame* scrolledFrame = - NS_NewAreaFrame(mPresShell, aStyleContext, - NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT); + NS_NewBlockFrame(mPresShell, aStyleContext, + NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT); nsFrameItems blockItem; rv = ConstructBlock(aState, @@ -7738,14 +7748,16 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame) for (nsIFrame* wrappedFrame = aFrame; wrappedFrame != frame->GetParent(); wrappedFrame = wrappedFrame->GetParent()) { nsIAtom* frameType = wrappedFrame->GetType(); - if (nsGkAtoms::areaFrame == frameType || - nsGkAtoms::blockFrame == frameType || + if (nsGkAtoms::blockFrame == frameType || +#ifdef MOZ_XUL + nsGkAtoms::XULLabelFrame == frameType || +#endif nsGkAtoms::positionedInlineFrame == frameType) { containingBlock = wrappedFrame; } else if (nsGkAtoms::fieldSetFrame == frameType) { // If the positioned frame is a fieldset, use the area frame inside it. // We don't use GetContentInsertionFrame for fieldsets yet. - containingBlock = GetFieldSetAreaFrame(wrappedFrame); + containingBlock = GetFieldSetBlockFrame(wrappedFrame); } } @@ -8158,7 +8170,7 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling, } else if (nsGkAtoms::fieldSetFrame == parentType || (nsGkAtoms::fieldSetFrame == grandparentType && - nsGkAtoms::areaFrame == parentType)) { + nsGkAtoms::blockFrame == parentType)) { // Legends can be sibling of legends but not of other content in the fieldset nsIAtom* sibType = aSibling->GetType(); nsCOMPtr legendContent(do_QueryInterface(aContent)); @@ -8336,7 +8348,7 @@ GetAdjustedParentFrame(nsIFrame* aParentFrame, // parent unless the new content is a legend. nsCOMPtr legendContent(do_QueryInterface(childContent)); if (!legendContent) { - newParent = GetFieldSetAreaFrame(aParentFrame); + newParent = GetFieldSetBlockFrame(aParentFrame); } } return (newParent) ? newParent : aParentFrame; @@ -10404,15 +10416,16 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); } - } else if (nsGkAtoms::areaFrame == frameType) { - newFrame = NS_NewAreaFrame(shell, styleContext, 0); +#ifdef MOZ_XUL + } else if (nsGkAtoms::XULLabelFrame == frameType) { + newFrame = NS_NewXULLabelFrame(shell, styleContext, 0); if (newFrame) { newFrame->Init(content, aParentFrame, aFrame); // XXXbz should we be passing in a non-null aContentParentFrame? nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); } - +#endif } else if (nsGkAtoms::columnSetFrame == frameType) { newFrame = NS_NewColumnSetFrame(shell, styleContext, 0); @@ -10498,8 +10511,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, // Create a continuing area frame nsIFrame* continuingAreaFrame; - nsIFrame* areaFrame = aFrame->GetFirstChild(nsnull); - rv = CreateContinuingFrame(aPresContext, areaFrame, newFrame, + nsIFrame* blockFrame = aFrame->GetFirstChild(nsnull); + rv = CreateContinuingFrame(aPresContext, blockFrame, newFrame, &continuingAreaFrame); if (NS_FAILED(rv)) { newFrame->Destroy(); @@ -10570,8 +10583,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, // Create a continuing area frame // XXXbz we really shouldn't have to do this by hand! nsIFrame* continuingAreaFrame; - nsIFrame* areaFrame = GetFieldSetAreaFrame(aFrame); - rv = CreateContinuingFrame(aPresContext, areaFrame, newFrame, + nsIFrame* blockFrame = GetFieldSetBlockFrame(aFrame); + rv = CreateContinuingFrame(aPresContext, blockFrame, newFrame, &continuingAreaFrame); if (NS_FAILED(rv)) { newFrame->Destroy(); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 85883974a80..a5bed373bd1 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -264,7 +264,7 @@ static PRInt32 gReflowInx = -1; //------------------------------------------------------ nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext) - : nsAreaFrame(aContext), + : nsBlockFrame(aContext), mDisplayWidth(0) { mListControlFrame = nsnull; @@ -316,7 +316,7 @@ nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return NS_OK; } - return nsAreaFrame::QueryInterface(aIID, aInstancePtr); + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } #ifdef ACCESSIBILITY @@ -689,7 +689,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext, mDisplayWidth = aReflowState.ComputedWidth() - buttonWidth; - nsresult rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, + nsresult rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); NS_ENSURE_SUCCESS(rv, rv); @@ -968,7 +968,7 @@ nsComboboxControlFrame::HandleEvent(nsPresContext* aPresContext, // nsFrame::HandleEvent so that selection takes place when appropriate. const nsStyleUserInterface* uiStyle = GetStyleUserInterface(); if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) - return nsAreaFrame::HandleEvent(aPresContext, aEvent, aEventStatus); + return nsBlockFrame::HandleEvent(aPresContext, aEvent, aEventStatus); return NS_OK; } @@ -1245,7 +1245,7 @@ nsComboboxControlFrame::Destroy() mPopupFrames.DestroyFrames(); nsContentUtils::DestroyAnonymousContent(&mDisplayContent); nsContentUtils::DestroyAnonymousContent(&mButtonContent); - nsAreaFrame::Destroy(); + nsBlockFrame::Destroy(); } @@ -1255,7 +1255,7 @@ nsComboboxControlFrame::GetFirstChild(nsIAtom* aListName) const if (nsGkAtoms::selectPopupList == aListName) { return mPopupFrames.FirstChild(); } - return nsAreaFrame::GetFirstChild(aListName); + return nsBlockFrame::GetFirstChild(aListName); } NS_IMETHODIMP @@ -1266,7 +1266,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIAtom* aListName, if (nsGkAtoms::selectPopupList == aListName) { mPopupFrames.SetFrames(aChildList); } else { - rv = nsAreaFrame::SetInitialChildList(aListName, aChildList); + rv = nsBlockFrame::SetInitialChildList(aListName, aChildList); for (nsIFrame * child = aChildList; child; child = child->GetNextSibling()) { @@ -1291,7 +1291,7 @@ nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex) const // of the combox's children because it would take up space, when it is suppose to // be floating above the display. if (aIndex < NS_BLOCK_LIST_COUNT) { - return nsAreaFrame::GetAdditionalChildListName(aIndex); + return nsBlockFrame::GetAdditionalChildListName(aIndex); } if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) { @@ -1380,7 +1380,7 @@ nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } else { // REVIEW: Our in-flow child frames are inline-level so they will paint in our // content list, so we don't need to mess with layers. - nsresult rv = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsresult rv = nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index ac7970fd3ef..08e70aef97b 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -55,7 +55,7 @@ //Mark used to indicate when onchange has been fired for current combobox item #define NS_SKIP_NOTIFY_INDEX -2 -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsIFormControlFrame.h" #include "nsIComboboxControlFrame.h" #include "nsIAnonymousContentCreator.h" @@ -80,7 +80,7 @@ class nsComboboxDisplayFrame; */ #define NS_COMBO_LIST_COUNT (NS_BLOCK_LIST_COUNT + 1) -class nsComboboxControlFrame : public nsAreaFrame, +class nsComboboxControlFrame : public nsBlockFrame, public nsIFormControlFrame, public nsIComboboxControlFrame, public nsIAnonymousContentCreator, @@ -133,7 +133,7 @@ public: virtual PRBool IsFrameOfType(PRUint32 aFlags) const { - return nsAreaFrame::IsFrameOfType(aFlags & + return nsBlockFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); } diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 40e837555c1..4720a43e6aa 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -88,7 +88,7 @@ NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) } nsFileControlFrame::nsFileControlFrame(nsStyleContext* aContext): - nsAreaFrame(aContext), + nsBlockFrame(aContext), mTextFrame(nsnull), mCachedState(nsnull) { @@ -107,7 +107,7 @@ nsFileControlFrame::Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow) { - nsresult rv = nsAreaFrame::Init(aContent, aParent, aPrevInFlow); + nsresult rv = nsBlockFrame::Init(aContent, aParent, aPrevInFlow); NS_ENSURE_SUCCESS(rv, rv); mMouseListener = new MouseListener(this); @@ -143,7 +143,7 @@ nsFileControlFrame::Destroy() } mMouseListener->ForgetFrame(); - nsAreaFrame::Destroy(); + nsBlockFrame::Destroy(); } nsresult @@ -243,7 +243,7 @@ nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return NS_OK; } - return nsAreaFrame::QueryInterface(aIID, aInstancePtr); + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } void @@ -421,7 +421,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext* aPresContext, } // The Areaframe takes care of all our reflow - return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, + return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } @@ -430,7 +430,7 @@ NS_IMETHODIMP nsFileControlFrame::SetInitialChildList(nsIAtom* aListName, nsIFrame* aChildList) { - nsAreaFrame::SetInitialChildList(aListName, aChildList); + nsBlockFrame::SetInitialChildList(aListName, aChildList); // given that the CSS frame constructor created all our frames. We need to find the text field // so we can get info from it. @@ -514,7 +514,7 @@ nsFileControlFrame::AttributeChanged(PRInt32 aNameSpaceID, } } - return nsAreaFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); + return nsBlockFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } PRBool @@ -578,7 +578,7 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // styles in forms.css) -- doing it just makes us look ugly in some cases and // has no effect in others. nsDisplayListCollection tempList; - nsresult rv = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList); + nsresult rv = nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList); if (NS_FAILED(rv)) return rv; diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index fc974fcd45d..18e36f66ede 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -38,7 +38,7 @@ #ifndef nsFileControlFrame_h___ #define nsFileControlFrame_h___ -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsIFormControlFrame.h" #include "nsIDOMMouseListener.h" #include "nsIAnonymousContentCreator.h" @@ -47,7 +47,7 @@ #include "nsTextControlFrame.h" typedef nsTextControlFrame nsNewFrame; -class nsFileControlFrame : public nsAreaFrame, +class nsFileControlFrame : public nsBlockFrame, public nsIFormControlFrame, public nsIAnonymousContentCreator { @@ -128,7 +128,7 @@ protected: virtual PRBool IsFrameOfType(PRUint32 aFlags) const { - return nsAreaFrame::IsFrameOfType(aFlags & + return nsBlockFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); } diff --git a/layout/forms/nsIsIndexFrame.cpp b/layout/forms/nsIsIndexFrame.cpp index 3542347b600..07f0a85f35f 100644 --- a/layout/forms/nsIsIndexFrame.cpp +++ b/layout/forms/nsIsIndexFrame.cpp @@ -85,7 +85,7 @@ NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) } nsIsIndexFrame::nsIsIndexFrame(nsStyleContext* aContext) : - nsAreaFrame(aContext) + nsBlockFrame(aContext) { SetFlags(NS_BLOCK_SPACE_MGR); } @@ -105,10 +105,10 @@ nsIsIndexFrame::Destroy() nsContentUtils::DestroyAnonymousContent(&mTextContent); nsContentUtils::DestroyAnonymousContent(&mPreHr); nsContentUtils::DestroyAnonymousContent(&mPostHr); - nsAreaFrame::Destroy(); + nsBlockFrame::Destroy(); } -// REVIEW: We don't need to override BuildDisplayList, nsAreaFrame will honour +// REVIEW: We don't need to override BuildDisplayList, nsBlockFrame will honour // our visibility setting nsresult @@ -256,7 +256,7 @@ nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return NS_OK; } - return nsAreaFrame::QueryInterface(aIID, aInstancePtr); + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } nscoord @@ -266,7 +266,7 @@ nsIsIndexFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) DISPLAY_MIN_WIDTH(this, result); // Our min width is our pref width; the rest of our reflow is - // happily handled by nsAreaFrame + // happily handled by nsBlockFrame result = GetPrefWidth(aRenderingContext); return result; } @@ -286,7 +286,7 @@ nsIsIndexFrame::AttributeChanged(PRInt32 aNameSpaceID, if (nsGkAtoms::prompt == aAttribute) { rv = UpdatePromptLabel(PR_TRUE); } else { - rv = nsAreaFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); + rv = nsBlockFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } return rv; } diff --git a/layout/forms/nsIsIndexFrame.h b/layout/forms/nsIsIndexFrame.h index b242671cfd4..c5ef853a9e9 100644 --- a/layout/forms/nsIsIndexFrame.h +++ b/layout/forms/nsIsIndexFrame.h @@ -38,7 +38,7 @@ #ifndef nsIsIndexFrame_h___ #define nsIsIndexFrame_h___ -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsIFormControlFrame.h" #include "nsIAnonymousContentCreator.h" #include "nsIStatefulFrame.h" @@ -48,7 +48,7 @@ #include "nsTextControlFrame.h" typedef nsTextControlFrame nsNewFrame; -class nsIsIndexFrame : public nsAreaFrame, +class nsIsIndexFrame : public nsBlockFrame, public nsIAnonymousContentCreator, public nsIDOMKeyListener, public nsIStatefulFrame diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index abc4a08c446..c73ca0fcd74 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -74,7 +74,7 @@ void nsLegendFrame::Destroy() { nsFormControlFrame::RegUnRegAccessKey(static_cast(this), PR_FALSE); - nsAreaFrame::Destroy(); + nsBlockFrame::Destroy(); } // Frames are not refcounted, no need to AddRef @@ -88,7 +88,7 @@ nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_OK; } - return nsAreaFrame::QueryInterface(aIID, aInstancePtr); + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } NS_IMETHODIMP @@ -102,10 +102,10 @@ nsLegendFrame::Reflow(nsPresContext* aPresContext, if (mState & NS_FRAME_FIRST_REFLOW) { nsFormControlFrame::RegUnRegAccessKey(static_cast(this), PR_TRUE); } - return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); + return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } -// REVIEW: We don't need to override BuildDisplayList, nsAreaFrame will honour +// REVIEW: We don't need to override BuildDisplayList, nsBlockFrame will honour // our visibility setting PRInt32 nsLegendFrame::GetAlign() { diff --git a/layout/forms/nsLegendFrame.h b/layout/forms/nsLegendFrame.h index b752938abde..b616847092c 100644 --- a/layout/forms/nsLegendFrame.h +++ b/layout/forms/nsLegendFrame.h @@ -38,7 +38,7 @@ #ifndef nsLegendFrame_h___ #define nsLegendFrame_h___ -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsPresContext.h" #include "nsCOMPtr.h" @@ -52,9 +52,9 @@ struct nsRect; #define NS_LEGEND_FRAME_CID \ { 0x73805d40, 0x5a24, 0x11d2, { 0x80, 0x46, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } } -class nsLegendFrame : public nsAreaFrame { +class nsLegendFrame : public nsBlockFrame { public: - nsLegendFrame(nsStyleContext* aContext) : nsAreaFrame(aContext) {} + nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {} NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); diff --git a/layout/forms/nsSelectsAreaFrame.cpp b/layout/forms/nsSelectsAreaFrame.cpp index 657e523c830..96bedf12e15 100644 --- a/layout/forms/nsSelectsAreaFrame.cpp +++ b/layout/forms/nsSelectsAreaFrame.cpp @@ -201,7 +201,7 @@ nsSelectsAreaFrame::BuildDisplayListInternal(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - nsresult rv = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsresult rv = nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); NS_ENSURE_SUCCESS(rv, rv); nsListControlFrame* listFrame = GetEnclosingListFrame(this); @@ -234,7 +234,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext, nscoord oldHeight; if (isInDropdownMode) { // Store the height now in case it changes during - // nsAreaFrame::Reflow for some odd reason. + // nsBlockFrame::Reflow for some odd reason. if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { oldHeight = GetSize().height; } else { @@ -242,7 +242,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext, } } - nsresult rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, + nsresult rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); NS_ENSURE_SUCCESS(rv, rv); diff --git a/layout/forms/nsSelectsAreaFrame.h b/layout/forms/nsSelectsAreaFrame.h index e76431b8ab9..14a8764d993 100644 --- a/layout/forms/nsSelectsAreaFrame.h +++ b/layout/forms/nsSelectsAreaFrame.h @@ -37,16 +37,10 @@ #ifndef nsSelectsAreaFrame_h___ #define nsSelectsAreaFrame_h___ -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" class nsIContent; -/** - * The area frame has an additional named child list: - * - "Absolute-list" which contains the absolutely positioned frames - * - * @see nsGkAtoms::absoluteList - */ -class nsSelectsAreaFrame : public nsAreaFrame +class nsSelectsAreaFrame : public nsBlockFrame { public: friend nsIFrame* NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRUint32 aFlags); @@ -71,7 +65,7 @@ public: protected: nsSelectsAreaFrame(nsStyleContext* aContext) : - nsAreaFrame(aContext), + nsBlockFrame(aContext), mHeightOfARow(0) {} diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 207216e6020..8ca8bb1f03c 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -39,7 +39,7 @@ #define nsTextControlFrame_h___ #include "nsStackFrame.h" -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsIFormControlFrame.h" #include "nsIDOMMouseListener.h" #include "nsIAnonymousContentCreator.h" diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index e9bfdea9f1e..28afc28dccf 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -112,7 +112,6 @@ endif CPPSRCS = \ nsAbsoluteContainingBlock.cpp \ - nsAreaFrame.cpp \ nsBRFrame.cpp \ nsBlockBandData.cpp \ nsBlockFrame.cpp \ diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 156f7054274..b4f387a3c95 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -7325,7 +7325,6 @@ DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName) void DR_State::InitFrameTypeTable() { - AddFrameTypeInfo(nsGkAtoms::areaFrame, "area", "area"); AddFrameTypeInfo(nsGkAtoms::blockFrame, "block", "block"); AddFrameTypeInfo(nsGkAtoms::brFrame, "br", "br"); AddFrameTypeInfo(nsGkAtoms::bulletFrame, "bullet", "bullet"); @@ -7357,6 +7356,9 @@ void DR_State::InitFrameTypeTable() AddFrameTypeInfo(nsGkAtoms::textInputFrame, "textCtl", "textInput"); AddFrameTypeInfo(nsGkAtoms::textFrame, "text", "text"); AddFrameTypeInfo(nsGkAtoms::viewportFrame, "VP", "viewport"); +#ifdef MOZ_XUL + AddFrameTypeInfo(nsGkAtoms::XULLabelFrame, "XULLabel", "XULLabel"); +#endif AddFrameTypeInfo(nsnull, "unknown", "unknown"); } diff --git a/layout/generic/nsHTMLParts.h b/layout/generic/nsHTMLParts.h index 2362a6d7081..d38e62e7d43 100644 --- a/layout/generic/nsHTMLParts.h +++ b/layout/generic/nsHTMLParts.h @@ -82,9 +82,6 @@ class nsTableColFrame; // Factory methods for creating html layout objects -// These are variations on AreaFrame with slightly different layout -// policies. - // Create a frame that supports "display: block" layout behavior nsIFrame* NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags = 0); @@ -103,10 +100,6 @@ NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager, nsIFrame* NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags); -// Create a basic area frame. -nsIFrame* -NS_NewAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags); - // These AreaFrame's shrink wrap around their contents inline nsIFrame* NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 8cc4a1baac6..8c611bcc2f5 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -331,7 +331,9 @@ IsQuirkContainingBlockHeight(const nsHTMLReflowState* rs) { nsIAtom* frameType = rs->frame->GetType(); if (nsGkAtoms::blockFrame == frameType || - nsGkAtoms::areaFrame == frameType || +#ifdef MOZ_XUL + nsGkAtoms::XULLabelFrame == frameType || +#endif nsGkAtoms::scrollFrame == frameType) { // Note: This next condition could change due to a style change, // but that would cause a style reflow anyway, which means we're ok. @@ -1434,7 +1436,9 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState* aCBReflowState) // if the ancestor is auto height then skip it and continue up if it // is the first block/area frame and possibly the body/html if (nsGkAtoms::blockFrame == frameType || - nsGkAtoms::areaFrame == frameType || +#ifdef MOZ_XUL + nsGkAtoms::XULLabelFrame == frameType || +#endif nsGkAtoms::scrollFrame == frameType) { secondAncestorRS = firstAncestorRS; diff --git a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp index ba46f51a95a..8a2230b83f2 100644 --- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp +++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp @@ -44,7 +44,7 @@ #include "nsCOMPtr.h" #include "nsHTMLParts.h" #include "nsFrame.h" -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsLineLayout.h" #include "nsPresContext.h" #include "nsStyleContext.h" diff --git a/layout/mathml/base/src/nsMathMLmtableFrame.cpp b/layout/mathml/base/src/nsMathMLmtableFrame.cpp index 7dfd2375132..39105914591 100644 --- a/layout/mathml/base/src/nsMathMLmtableFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmtableFrame.cpp @@ -38,7 +38,7 @@ #include "nsCOMPtr.h" #include "nsFrame.h" -#include "nsAreaFrame.h" +#include "nsBlockFrame.h" #include "nsPresContext.h" #include "nsStyleContext.h" #include "nsStyleConsts.h" diff --git a/layout/xul/base/src/Makefile.in b/layout/xul/base/src/Makefile.in index bfc62ab7a90..e45c851d2e9 100644 --- a/layout/xul/base/src/Makefile.in +++ b/layout/xul/base/src/Makefile.in @@ -123,6 +123,7 @@ CPPSRCS += \ nsListBoxBodyFrame.cpp \ nsListItemFrame.cpp \ nsListBoxLayout.cpp \ + nsXULLabelFrame.cpp \ nsXULPopupManager.cpp \ $(NULL) diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index daef65404cb..5e374683bb1 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1865,7 +1865,7 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext, } // If you make changes to this function, check its counterparts -// in nsTextBoxFrame and nsAreaFrame +// in nsTextBoxFrame and nsXULLabelFrame nsresult nsBoxFrame::RegUnregAccessKey(PRBool aDoReg) { diff --git a/layout/xul/base/src/nsTextBoxFrame.cpp b/layout/xul/base/src/nsTextBoxFrame.cpp index f9f2ef0aa83..701e43d712a 100644 --- a/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/layout/xul/base/src/nsTextBoxFrame.cpp @@ -1100,7 +1100,7 @@ nsTextBoxFrame::GetFrameName(nsAString& aResult) const #endif // If you make changes to this function, check its counterparts -// in nsBoxFrame and nsAreaFrame +// in nsBoxFrame and nsXULLabelFrame nsresult nsTextBoxFrame::RegUnregAccessKey(PRBool aDoReg) { diff --git a/layout/generic/nsAreaFrame.cpp b/layout/xul/base/src/nsXULLabelFrame.cpp similarity index 76% rename from layout/generic/nsAreaFrame.cpp rename to layout/xul/base/src/nsXULLabelFrame.cpp index daaf9c0d769..dfd4056103e 100644 --- a/layout/generic/nsAreaFrame.cpp +++ b/layout/xul/base/src/nsXULLabelFrame.cpp @@ -35,29 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ -/* derived class of nsBlockFrame; distinction barely relevant anymore */ +/* derived class of nsBlockFrame used for xul:label elements */ -#include "nsAreaFrame.h" -#include "nsBlockBandData.h" -#include "nsStyleContext.h" -#include "nsStyleConsts.h" -#include "nsPresContext.h" -#include "nsINodeInfo.h" -#include "nsGkAtoms.h" +#include "nsXULLabelFrame.h" #include "nsHTMLParts.h" - -#ifdef MOZ_XUL #include "nsINameSpaceManager.h" #include "nsIEventStateManager.h" -#endif - -#undef NOISY_MAX_ELEMENT_SIZE -#undef NOISY_FINAL_SIZE nsIFrame* -NS_NewAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) +NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) { - nsAreaFrame* it = new (aPresShell) nsAreaFrame(aContext); + nsXULLabelFrame* it = new (aPresShell) nsXULLabelFrame(aContext); if (it != nsnull) it->SetFlags(aFlags); @@ -65,21 +53,15 @@ NS_NewAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFl return it; } -#ifdef MOZ_XUL - // If you make changes to this function, check its counterparts // in nsBoxFrame and nsTextBoxFrame nsresult -nsAreaFrame::RegUnregAccessKey(PRBool aDoReg) +nsXULLabelFrame::RegUnregAccessKey(PRBool aDoReg) { // if we have no content, we can't do anything if (!mContent) return NS_ERROR_FAILURE; - // only support accesskeys for the following elements - if (!mContent->NodeInfo()->Equals(nsGkAtoms::label, kNameSpaceID_XUL)) - return NS_OK; - // To filter out