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
This commit is contained in:
L. David Baron 2008-12-29 10:07:38 -05:00
Родитель aa7f97d3a9
Коммит 4690547534
25 изменённых файлов: 145 добавлений и 167 удалений

Просмотреть файл

@ -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")

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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<nsIDOMHTMLLegendElement> legendContent(do_QueryInterface(aContent));
@ -8336,7 +8348,7 @@ GetAdjustedParentFrame(nsIFrame* aParentFrame,
// parent unless the new content is a legend.
nsCOMPtr<nsIDOMHTMLLegendElement> 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();

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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));
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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));
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -74,7 +74,7 @@ void
nsLegendFrame::Destroy()
{
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(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<nsIFrame*>(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()
{

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)
{}

Просмотреть файл

@ -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"

Просмотреть файл

@ -112,7 +112,6 @@ endif
CPPSRCS = \
nsAbsoluteContainingBlock.cpp \
nsAreaFrame.cpp \
nsBRFrame.cpp \
nsBlockBandData.cpp \
nsBlockFrame.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");
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"

Просмотреть файл

@ -123,6 +123,7 @@ CPPSRCS += \
nsListBoxBodyFrame.cpp \
nsListItemFrame.cpp \
nsListBoxLayout.cpp \
nsXULLabelFrame.cpp \
nsXULPopupManager.cpp \
$(NULL)

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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 <label>s without a control attribute.
// XXXjag a side-effect is that we filter out anonymous <label>s
// in e.g. <menu>, <menuitem>, <button>. These <label>s inherit
@ -107,16 +89,14 @@ nsAreaFrame::RegUnregAccessKey(PRBool aDoReg)
return rv;
}
#endif
/////////////////////////////////////////////////////////////////////////////
// nsIFrame
#ifdef MOZ_XUL
NS_IMETHODIMP
nsAreaFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
nsXULLabelFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsresult rv = nsBlockFrame::Init(aContent, aParent, aPrevInFlow);
if (NS_FAILED(rv))
@ -127,7 +107,7 @@ nsAreaFrame::Init(nsIContent* aContent,
}
void
nsAreaFrame::Destroy()
nsXULLabelFrame::Destroy()
{
// unregister access key
RegUnregAccessKey(PR_FALSE);
@ -135,9 +115,9 @@ nsAreaFrame::Destroy()
}
NS_IMETHODIMP
nsAreaFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
nsXULLabelFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsresult rv = nsBlockFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
@ -149,12 +129,11 @@ nsAreaFrame::AttributeChanged(PRInt32 aNameSpaceID,
return rv;
}
#endif
nsIAtom*
nsAreaFrame::GetType() const
nsXULLabelFrame::GetType() const
{
return nsGkAtoms::areaFrame;
return nsGkAtoms::XULLabelFrame;
}
/////////////////////////////////////////////////////////////////////////////
@ -162,8 +141,8 @@ nsAreaFrame::GetType() const
#ifdef NS_DEBUG
NS_IMETHODIMP
nsAreaFrame::GetFrameName(nsAString& aResult) const
nsXULLabelFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Area"), aResult);
return MakeFrameName(NS_LITERAL_STRING("XULLabel"), aResult);
}
#endif

Просмотреть файл

@ -35,32 +35,23 @@
*
* ***** END LICENSE BLOCK ***** */
/* derived class of nsBlockFrame; distinction barely relevant anymore */
/* derived class of nsBlockFrame used for xul:label elements */
#ifndef nsAreaFrame_h___
#define nsAreaFrame_h___
#ifndef nsXULLabelFrame_h_
#define nsXULLabelFrame_h_
#include "nsBlockFrame.h"
#include "nsAbsoluteContainingBlock.h"
struct nsStyleDisplay;
struct nsStylePosition;
#ifndef MOZ_XUL
#error "This file should not be included
#endif
/**
* The area frame has an additional named child list:
* - "Absolute-list" which contains the absolutely positioned frames
*
* @see nsGkAtoms::absoluteList
*/
class nsAreaFrame : public nsBlockFrame
class nsXULLabelFrame : public nsBlockFrame
{
public:
friend nsIFrame* NS_NewAreaFrame(nsIPresShell* aPresShell, nsStyleContext *aContext, PRUint32 aFlags);
friend nsIFrame* NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext *aContext, PRUint32 aFlags);
// nsIFrame
#ifdef MOZ_XUL
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
@ -70,12 +61,11 @@ public:
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
#endif
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::areaFrame
* @see nsGkAtoms::XULLabelFrame
*/
virtual nsIAtom* GetType() const;
@ -84,11 +74,12 @@ public:
#endif
protected:
nsAreaFrame(nsStyleContext *aContext) : nsBlockFrame(aContext) {}
nsXULLabelFrame(nsStyleContext *aContext) : nsBlockFrame(aContext) {}
#ifdef MOZ_XUL
nsresult RegUnregAccessKey(PRBool aDoReg);
#endif
};
#endif /* nsAreaFrame_h___ */
nsIFrame*
NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
#endif /* !defined(nsXULLabelFrame_h_) */