зеркало из https://github.com/mozilla/gecko-dev.git
bugs fixes for: 28460, 27242, 29462
-r hyatt, -a jar
This commit is contained in:
Родитель
421437ef3c
Коммит
cf0d42fc25
|
@ -104,6 +104,7 @@ XUL_ATOM(titledbox, "titledbox")
|
|||
XUL_ATOM(title, "title")
|
||||
XUL_ATOM(titledboxContentPseudo, ":titledbox-content")
|
||||
|
||||
XUL_ATOM(stack, "stack")
|
||||
XUL_ATOM(deck, "deck")
|
||||
XUL_ATOM(tabcontrol, "tabcontrol")
|
||||
XUL_ATOM(tab, "tab")
|
||||
|
@ -124,6 +125,7 @@ XUL_ATOM(collapse, "collapse")
|
|||
XUL_ATOM(resizebefore, "resizebefore")
|
||||
XUL_ATOM(resizeafter, "resizeafter")
|
||||
XUL_ATOM(state, "state")
|
||||
XUL_ATOM(debug, "debug")
|
||||
|
||||
// toolbar & toolbar d&d atoms
|
||||
XUL_ATOM(ddDropLocation, "dd-droplocation")
|
||||
|
|
|
@ -146,6 +146,12 @@ NS_NewTabFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
|||
nsresult
|
||||
NS_NewDeckFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewSpringFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewStackFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewProgressMeterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
|
@ -165,7 +171,7 @@ nsresult
|
|||
NS_NewTitleFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
NS_NewBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot);
|
||||
|
||||
nsresult
|
||||
NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
@ -2080,7 +2086,11 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::toolbox == tag.get()) ||
|
||||
(nsXULAtoms::toolbar == tag.get()) ||
|
||||
(nsXULAtoms::toolbaritem == tag.get()) ||
|
||||
(nsXULAtoms::stack == tag.get()) ||
|
||||
(nsXULAtoms::deck == tag.get()) ||
|
||||
(nsXULAtoms::spring == tag.get()) ||
|
||||
(nsXULAtoms::title == tag.get()) ||
|
||||
(nsXULAtoms::titledbox == tag.get()) ||
|
||||
(nsXULAtoms::tabcontrol == tag.get()) ||
|
||||
(nsXULAtoms::tabbox == tag.get()) ||
|
||||
(nsXULAtoms::tabpanel == tag.get()) ||
|
||||
|
@ -2323,7 +2333,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
PRInt32 nameSpaceID;
|
||||
if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
NS_NewBoxFrame(aPresShell, &contentFrame);
|
||||
NS_NewBoxFrame(aPresShell, &contentFrame, PR_TRUE);
|
||||
}
|
||||
else {
|
||||
NS_NewDocumentElementFrame(aPresShell, &contentFrame);
|
||||
|
@ -2982,6 +2992,10 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
nsIComboboxControlFrame* comboBox = nsnull;
|
||||
if (NS_SUCCEEDED(comboboxFrame->QueryInterface(kIComboboxControlFrameIID, (void**)&comboBox))) {
|
||||
|
||||
// XXX added for Rods code. -EDV
|
||||
//comboBox->SetFrameConstructor(this);
|
||||
|
||||
// Create a listbox
|
||||
nsIFrame * listFrame;
|
||||
rv = NS_NewListControlFrame(aPresShell, &listFrame);
|
||||
|
@ -4066,7 +4080,144 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
isAbsolutelyPositioned = PR_TRUE;
|
||||
|
||||
// Create a frame based on the tag
|
||||
if (aTag == nsXULAtoms::spinner)
|
||||
// box is first because it is created the most.
|
||||
// BOX CONSTRUCTION
|
||||
if (aTag == nsXULAtoms::box || aTag == nsXULAtoms::tabbox ||
|
||||
aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image) {
|
||||
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::spring) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewSpringFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
// TEXT CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewXULTextFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TEXT CONSTRUCTION logic
|
||||
|
||||
// Menu Construction
|
||||
else if (aTag == nsXULAtoms::menu ||
|
||||
aTag == nsXULAtoms::menuitem ||
|
||||
aTag == nsXULAtoms::menulist ||
|
||||
aTag == nsXULAtoms::menubutton) {
|
||||
// A derived class box frame
|
||||
// that has custom reflow to prevent menu children
|
||||
// from becoming part of the flow.
|
||||
processChildren = PR_TRUE; // Will need this to be custom.
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menubar) {
|
||||
#ifdef XP_MAC // The Mac uses its native menu bar.
|
||||
aHaltProcessing = PR_TRUE;
|
||||
return NS_OK;
|
||||
#else
|
||||
processChildren = PR_TRUE;
|
||||
rv = NS_NewMenuBarFrame(aPresShell, &newFrame);
|
||||
#endif
|
||||
}
|
||||
else if (aTag == nsXULAtoms::popupset) {
|
||||
// This frame contains child popups
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menupopup || aTag == nsXULAtoms::popup) {
|
||||
// This is its own frame that derives from
|
||||
// box.
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuPopupFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::title) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitleFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::titledbox) {
|
||||
|
||||
ConstructTitledBoxFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aStyleContext, newFrame);
|
||||
processChildren = PR_FALSE;
|
||||
isReplaced = PR_TRUE;
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (aTag == nsXULAtoms::spinner)
|
||||
rv = NS_NewSpinnerFrame(aPresShell, &newFrame);
|
||||
else if (aTag == nsXULAtoms::colorpicker)
|
||||
rv = NS_NewColorPickerFrame(aPresShell, &newFrame);
|
||||
|
@ -4222,129 +4373,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewProgressMeterFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of PROGRESS METER CONSTRUCTION logic
|
||||
|
||||
// Menu Construction
|
||||
else if (aTag == nsXULAtoms::menu ||
|
||||
aTag == nsXULAtoms::menuitem ||
|
||||
aTag == nsXULAtoms::menulist ||
|
||||
aTag == nsXULAtoms::menubutton) {
|
||||
// A derived class box frame
|
||||
// that has custom reflow to prevent menu children
|
||||
// from becoming part of the flow.
|
||||
processChildren = PR_TRUE; // Will need this to be custom.
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menubar) {
|
||||
#ifdef XP_MAC // The Mac uses its native menu bar.
|
||||
aHaltProcessing = PR_TRUE;
|
||||
return NS_OK;
|
||||
#else
|
||||
processChildren = PR_TRUE;
|
||||
rv = NS_NewMenuBarFrame(aPresShell, &newFrame);
|
||||
#endif
|
||||
}
|
||||
else if (aTag == nsXULAtoms::popupset) {
|
||||
// This frame contains child popups
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menupopup || aTag == nsXULAtoms::popup) {
|
||||
// This is its own frame that derives from
|
||||
// box.
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuPopupFrame(aPresShell, &newFrame);
|
||||
}
|
||||
|
||||
// BOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::box || aTag == nsXULAtoms::tabbox ||
|
||||
aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::title) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitleFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::titledbox) {
|
||||
|
||||
ConstructTitledBoxFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aStyleContext, newFrame);
|
||||
processChildren = PR_FALSE;
|
||||
isReplaced = PR_TRUE;
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image) {
|
||||
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
|
||||
// XULCHECKBOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::checkbox ||
|
||||
aTag == nsXULAtoms::radio) {
|
||||
|
@ -4354,13 +4383,13 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
// End of XULCHECKBOX CONSTRUCTION logic
|
||||
|
||||
// TEXT CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
// STACK CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::stack) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewXULTextFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewStackFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TEXT CONSTRUCTION logic
|
||||
// End of STACK CONSTRUCTION logic
|
||||
|
||||
// DECK CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::deck || aTag == nsXULAtoms::tabpanel) {
|
||||
|
|
|
@ -141,7 +141,7 @@ static NS_DEFINE_CID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
|
|||
static PRInt32 gMaxRCProcessingTime = -1;
|
||||
|
||||
// Largest chunk size we recycle
|
||||
static const size_t gMaxRecycledSize = 200;
|
||||
static const size_t gMaxRecycledSize = 300;
|
||||
|
||||
// Flag for enabling/disabling asynchronous reflow
|
||||
// Set via the "layout.reflow.async" pref
|
||||
|
|
|
@ -1465,8 +1465,6 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext,
|
|||
nsSize size;
|
||||
GetScrolledContentSize(aPresContext, size);
|
||||
|
||||
PRBool mustReflow = PR_FALSE;
|
||||
|
||||
// There are two cases to consider
|
||||
if (size.height <= scrollAreaSize.height
|
||||
|| aReflowState.mStyleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL
|
||||
|
@ -1488,6 +1486,13 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext,
|
|||
|
||||
// Go ahead and reflow the child a second time if we added or removed the scrollbar
|
||||
if (mustReflow) {
|
||||
|
||||
// make sure we mark it as dirty so it will reflow again.
|
||||
nsFrameState childState;
|
||||
mScrollAreaFrame->GetFrameState(&childState);
|
||||
childState |= NS_FRAME_IS_DIRTY;
|
||||
mScrollAreaFrame->SetFrameState(childState);
|
||||
|
||||
scrollAreaReflowSize.SizeTo(scrollAreaSize.width, scrollAreaSize.height);
|
||||
|
||||
resized = PR_FALSE;
|
||||
|
@ -1750,6 +1755,22 @@ nsGfxScrollFrame::InvalidateCache(nsIFrame* aChild)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxScrollFrame::SetDebug(nsIPresContext* aPresContext, PRBool aDebug)
|
||||
{
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
while (nsnull != kid) {
|
||||
nsIBox* ibox = nsnull;
|
||||
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
||||
ibox->SetDebug(aPresContext, aDebug);
|
||||
}
|
||||
|
||||
kid->GetNextSibling(&kid);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxScrollFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize)
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
virtual ~nsGfxScrollFrame();
|
||||
|
||||
|
||||
|
|
|
@ -1465,8 +1465,6 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext,
|
|||
nsSize size;
|
||||
GetScrolledContentSize(aPresContext, size);
|
||||
|
||||
PRBool mustReflow = PR_FALSE;
|
||||
|
||||
// There are two cases to consider
|
||||
if (size.height <= scrollAreaSize.height
|
||||
|| aReflowState.mStyleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL
|
||||
|
@ -1488,6 +1486,13 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext,
|
|||
|
||||
// Go ahead and reflow the child a second time if we added or removed the scrollbar
|
||||
if (mustReflow) {
|
||||
|
||||
// make sure we mark it as dirty so it will reflow again.
|
||||
nsFrameState childState;
|
||||
mScrollAreaFrame->GetFrameState(&childState);
|
||||
childState |= NS_FRAME_IS_DIRTY;
|
||||
mScrollAreaFrame->SetFrameState(childState);
|
||||
|
||||
scrollAreaReflowSize.SizeTo(scrollAreaSize.width, scrollAreaSize.height);
|
||||
|
||||
resized = PR_FALSE;
|
||||
|
@ -1750,6 +1755,22 @@ nsGfxScrollFrame::InvalidateCache(nsIFrame* aChild)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxScrollFrame::SetDebug(nsIPresContext* aPresContext, PRBool aDebug)
|
||||
{
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
while (nsnull != kid) {
|
||||
nsIBox* ibox = nsnull;
|
||||
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
||||
ibox->SetDebug(aPresContext, aDebug);
|
||||
}
|
||||
|
||||
kid->GetNextSibling(&kid);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxScrollFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize)
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
virtual ~nsGfxScrollFrame();
|
||||
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ static NS_DEFINE_CID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
|
|||
static PRInt32 gMaxRCProcessingTime = -1;
|
||||
|
||||
// Largest chunk size we recycle
|
||||
static const size_t gMaxRecycledSize = 200;
|
||||
static const size_t gMaxRecycledSize = 300;
|
||||
|
||||
// Flag for enabling/disabling asynchronous reflow
|
||||
// Set via the "layout.reflow.async" pref
|
||||
|
|
|
@ -76,6 +76,24 @@ NS_NewScrollPortFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollPortFrame::SetDebug(nsIPresContext* aPresContext, PRBool aDebug)
|
||||
{
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
while (nsnull != kid) {
|
||||
nsIBox* ibox = nsnull;
|
||||
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
||||
ibox->SetDebug(aPresContext, aDebug);
|
||||
}
|
||||
|
||||
kid->GetNextSibling(&kid);
|
||||
}
|
||||
|
||||
mNeedsRecalc = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsScrollPortFrame::nsScrollPortFrame()
|
||||
{
|
||||
//mIncremental = PR_FALSE;
|
||||
|
@ -424,12 +442,18 @@ nsScrollPortFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
nscoord theHeight;
|
||||
nsIBox* box;
|
||||
nsReflowReason reason = aReflowState.reason;
|
||||
nsresult result = kidFrame->QueryInterface(NS_GET_IID(nsIBox), (void**)&box);
|
||||
if (NS_SUCCEEDED(result))
|
||||
if (NS_SUCCEEDED(result))
|
||||
theHeight = aReflowState.mComputedHeight;
|
||||
else
|
||||
else {
|
||||
theHeight = NS_INTRINSICSIZE;
|
||||
|
||||
// html can't handle a reflow of dirty. Convert it to
|
||||
// a resize reflow
|
||||
if (reason == eReflowReason_Dirty)
|
||||
reason = eReflowReason_Resize;
|
||||
}
|
||||
|
||||
nsSize kidReflowSize(aReflowState.availableWidth, theHeight);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
||||
kidFrame, kidReflowSize);
|
||||
|
@ -437,6 +461,7 @@ nsScrollPortFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
kidReflowState.mComputedWidth = aReflowState.mComputedWidth;
|
||||
kidReflowState.mComputedHeight = theHeight;
|
||||
kidReflowState.reason = reason;
|
||||
|
||||
nscoord pwidth = (kidReflowState.mComputedBorderPadding.left + kidReflowState.mComputedBorderPadding.right);
|
||||
nscoord pheight = (kidReflowState.mComputedBorderPadding.top + kidReflowState.mComputedBorderPadding.bottom);
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
// Called to set the one and only child frame. Returns NS_ERROR_INVALID_ARG
|
||||
// if the child frame is NULL, and NS_ERROR_UNEXPECTED if the child list
|
||||
// contains more than one frame
|
||||
|
|
|
@ -146,6 +146,12 @@ NS_NewTabFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
|||
nsresult
|
||||
NS_NewDeckFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewSpringFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewStackFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewProgressMeterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
|
@ -165,7 +171,7 @@ nsresult
|
|||
NS_NewTitleFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
||||
nsresult
|
||||
NS_NewBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
NS_NewBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot);
|
||||
|
||||
nsresult
|
||||
NS_NewSliderFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame );
|
||||
|
@ -2080,7 +2086,11 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::toolbox == tag.get()) ||
|
||||
(nsXULAtoms::toolbar == tag.get()) ||
|
||||
(nsXULAtoms::toolbaritem == tag.get()) ||
|
||||
(nsXULAtoms::stack == tag.get()) ||
|
||||
(nsXULAtoms::deck == tag.get()) ||
|
||||
(nsXULAtoms::spring == tag.get()) ||
|
||||
(nsXULAtoms::title == tag.get()) ||
|
||||
(nsXULAtoms::titledbox == tag.get()) ||
|
||||
(nsXULAtoms::tabcontrol == tag.get()) ||
|
||||
(nsXULAtoms::tabbox == tag.get()) ||
|
||||
(nsXULAtoms::tabpanel == tag.get()) ||
|
||||
|
@ -2323,7 +2333,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
PRInt32 nameSpaceID;
|
||||
if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
NS_NewBoxFrame(aPresShell, &contentFrame);
|
||||
NS_NewBoxFrame(aPresShell, &contentFrame, PR_TRUE);
|
||||
}
|
||||
else {
|
||||
NS_NewDocumentElementFrame(aPresShell, &contentFrame);
|
||||
|
@ -2982,6 +2992,10 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
nsIComboboxControlFrame* comboBox = nsnull;
|
||||
if (NS_SUCCEEDED(comboboxFrame->QueryInterface(kIComboboxControlFrameIID, (void**)&comboBox))) {
|
||||
|
||||
// XXX added for Rods code. -EDV
|
||||
//comboBox->SetFrameConstructor(this);
|
||||
|
||||
// Create a listbox
|
||||
nsIFrame * listFrame;
|
||||
rv = NS_NewListControlFrame(aPresShell, &listFrame);
|
||||
|
@ -4066,7 +4080,144 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
isAbsolutelyPositioned = PR_TRUE;
|
||||
|
||||
// Create a frame based on the tag
|
||||
if (aTag == nsXULAtoms::spinner)
|
||||
// box is first because it is created the most.
|
||||
// BOX CONSTRUCTION
|
||||
if (aTag == nsXULAtoms::box || aTag == nsXULAtoms::tabbox ||
|
||||
aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image) {
|
||||
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::spring) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewSpringFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
// TEXT CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewXULTextFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TEXT CONSTRUCTION logic
|
||||
|
||||
// Menu Construction
|
||||
else if (aTag == nsXULAtoms::menu ||
|
||||
aTag == nsXULAtoms::menuitem ||
|
||||
aTag == nsXULAtoms::menulist ||
|
||||
aTag == nsXULAtoms::menubutton) {
|
||||
// A derived class box frame
|
||||
// that has custom reflow to prevent menu children
|
||||
// from becoming part of the flow.
|
||||
processChildren = PR_TRUE; // Will need this to be custom.
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menubar) {
|
||||
#ifdef XP_MAC // The Mac uses its native menu bar.
|
||||
aHaltProcessing = PR_TRUE;
|
||||
return NS_OK;
|
||||
#else
|
||||
processChildren = PR_TRUE;
|
||||
rv = NS_NewMenuBarFrame(aPresShell, &newFrame);
|
||||
#endif
|
||||
}
|
||||
else if (aTag == nsXULAtoms::popupset) {
|
||||
// This frame contains child popups
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menupopup || aTag == nsXULAtoms::popup) {
|
||||
// This is its own frame that derives from
|
||||
// box.
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuPopupFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::title) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitleFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::titledbox) {
|
||||
|
||||
ConstructTitledBoxFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aStyleContext, newFrame);
|
||||
processChildren = PR_FALSE;
|
||||
isReplaced = PR_TRUE;
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (aTag == nsXULAtoms::spinner)
|
||||
rv = NS_NewSpinnerFrame(aPresShell, &newFrame);
|
||||
else if (aTag == nsXULAtoms::colorpicker)
|
||||
rv = NS_NewColorPickerFrame(aPresShell, &newFrame);
|
||||
|
@ -4222,129 +4373,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewProgressMeterFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of PROGRESS METER CONSTRUCTION logic
|
||||
|
||||
// Menu Construction
|
||||
else if (aTag == nsXULAtoms::menu ||
|
||||
aTag == nsXULAtoms::menuitem ||
|
||||
aTag == nsXULAtoms::menulist ||
|
||||
aTag == nsXULAtoms::menubutton) {
|
||||
// A derived class box frame
|
||||
// that has custom reflow to prevent menu children
|
||||
// from becoming part of the flow.
|
||||
processChildren = PR_TRUE; // Will need this to be custom.
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menubar) {
|
||||
#ifdef XP_MAC // The Mac uses its native menu bar.
|
||||
aHaltProcessing = PR_TRUE;
|
||||
return NS_OK;
|
||||
#else
|
||||
processChildren = PR_TRUE;
|
||||
rv = NS_NewMenuBarFrame(aPresShell, &newFrame);
|
||||
#endif
|
||||
}
|
||||
else if (aTag == nsXULAtoms::popupset) {
|
||||
// This frame contains child popups
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::menupopup || aTag == nsXULAtoms::popup) {
|
||||
// This is its own frame that derives from
|
||||
// box.
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewMenuPopupFrame(aPresShell, &newFrame);
|
||||
}
|
||||
|
||||
// BOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::box || aTag == nsXULAtoms::tabbox ||
|
||||
aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::title) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitleFrame(aPresShell, &newFrame);
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
|
||||
}
|
||||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
else if (aTag == nsXULAtoms::titledbox) {
|
||||
|
||||
ConstructTitledBoxFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aStyleContext, newFrame);
|
||||
processChildren = PR_FALSE;
|
||||
isReplaced = PR_TRUE;
|
||||
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// Boxes can scroll.
|
||||
if (IsScrollable(aPresContext, display)) {
|
||||
|
||||
// set the top to be the newly created scrollframe
|
||||
BuildScrollFrame(aPresShell, aPresContext, aState, aContent, aStyleContext, newFrame, aParentFrame,
|
||||
topFrame, aStyleContext);
|
||||
|
||||
// we have a scrollframe so the parent becomes the scroll frame.
|
||||
newFrame->GetParent(&aParentFrame);
|
||||
|
||||
primaryFrameSet = PR_TRUE;
|
||||
|
||||
frameHasBeenInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image) {
|
||||
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TITLED BUTTON CONSTRUCTION logic
|
||||
|
||||
|
||||
// XULCHECKBOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::checkbox ||
|
||||
aTag == nsXULAtoms::radio) {
|
||||
|
@ -4354,13 +4383,13 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
// End of XULCHECKBOX CONSTRUCTION logic
|
||||
|
||||
// TEXT CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
// STACK CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::stack) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewXULTextFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewStackFrame(aPresShell, &newFrame);
|
||||
}
|
||||
// End of TEXT CONSTRUCTION logic
|
||||
// End of STACK CONSTRUCTION logic
|
||||
|
||||
// DECK CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::deck || aTag == nsXULAtoms::tabpanel) {
|
||||
|
|
Двоичные данные
layout/macbuild/layout.mcp
Двоичные данные
layout/macbuild/layout.mcp
Двоичный файл не отображается.
|
@ -30,7 +30,10 @@ MODULE = layout
|
|||
LIBRARY_NAME = raptorxulbase_s
|
||||
|
||||
CPPSRCS = \
|
||||
nsXULTextFrame.cpp \
|
||||
nsStackFrame.cpp \
|
||||
nsSpringFrame.cpp \
|
||||
nsXULLeafFrame.cpp \
|
||||
nsXULTextFrame.cpp \
|
||||
nsTitledBoxFrame.cpp \
|
||||
nsTitleFrame.cpp \
|
||||
nsFrameNavigator.cpp \
|
||||
|
|
|
@ -28,6 +28,8 @@ REQUIRES=xpcom raptor pref
|
|||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS= \
|
||||
nsSpringFrame.cpp \
|
||||
nsXULLeafFrame.cpp \
|
||||
nsXULTextFrame.cpp \
|
||||
nsTitleFrame.cpp \
|
||||
nsTitledBoxFrame.cpp \
|
||||
|
@ -38,6 +40,7 @@ CPPSRCS= \
|
|||
nsSplitterFrame.cpp \
|
||||
nsGrippyFrame.cpp \
|
||||
nsTabFrame.cpp \
|
||||
nsStackFrame.cpp \
|
||||
nsDeckFrame.cpp \
|
||||
nsBoxFrame.cpp \
|
||||
nsProgressMeterFrame.cpp \
|
||||
|
@ -70,8 +73,10 @@ CPPSRCS= \
|
|||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsTitleFrame.obj \
|
||||
.\$(OBJDIR)\nsSpringFrame.obj \
|
||||
.\$(OBJDIR)\nsXULLeafFrame.obj \
|
||||
.\$(OBJDIR)\nsXULTextFrame.obj \
|
||||
.\$(OBJDIR)\nsTitleFrame.obj \
|
||||
.\$(OBJDIR)\nsTitledBoxFrame.obj \
|
||||
.\$(OBJDIR)\nsFrameNavigator.obj \
|
||||
.\$(OBJDIR)\nsRepeatService.obj \
|
||||
|
@ -81,6 +86,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsSplitterFrame.obj \
|
||||
.\$(OBJDIR)\nsTabFrame.obj \
|
||||
.\$(OBJDIR)\nsDeckFrame.obj \
|
||||
.\$(OBJDIR)\nsStackFrame.obj \
|
||||
.\$(OBJDIR)\nsBoxFrame.obj \
|
||||
.\$(OBJDIR)\nsProgressMeterFrame.obj \
|
||||
.\$(OBJDIR)\nsTitledButtonFrame.obj \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -41,6 +41,7 @@ class nsBoxDebugInner;
|
|||
class nsHTMLReflowCommand;
|
||||
class nsHTMLInfo;
|
||||
|
||||
// flags for box info
|
||||
#define NS_FRAME_BOX_SIZE_VALID 0x0001
|
||||
#define NS_FRAME_BOX_IS_COLLAPSED 0x0002
|
||||
#define NS_FRAME_BOX_NEEDS_RECALC 0x0004
|
||||
|
@ -49,14 +50,11 @@ class nsHTMLInfo;
|
|||
class nsCalculatedBoxInfo : public nsBoxInfo {
|
||||
public:
|
||||
nsSize calculatedSize;
|
||||
/*
|
||||
PRBool sizeValid;
|
||||
PRBool collapsed;
|
||||
PRBool needsRecalc;
|
||||
*/
|
||||
PRInt16 mFlags;
|
||||
nsCalculatedBoxInfo* next;
|
||||
nsIFrame* frame;
|
||||
|
||||
virtual void Recycle(nsIPresShell* aShell);
|
||||
};
|
||||
|
||||
class nsInfoList
|
||||
|
@ -67,11 +65,19 @@ public:
|
|||
virtual PRInt32 GetCount()=0;
|
||||
};
|
||||
|
||||
// flags from box
|
||||
#define NS_STATE_IS_HORIZONTAL 0x00400000
|
||||
#define NS_STATE_AUTO_STRETCH 0x00800000
|
||||
#define NS_STATE_IS_ROOT 0x01000000
|
||||
#define NS_STATE_CURRENTLY_IN_DEBUG 0x02000000
|
||||
#define NS_STATE_SET_TO_DEBUG 0x04000000
|
||||
#define NS_STATE_DEBUG_WAS_SET 0x08000000
|
||||
|
||||
class nsBoxFrame : public nsHTMLContainerFrame, public nsIBox
|
||||
{
|
||||
public:
|
||||
|
||||
friend nsresult NS_NewBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot = PR_FALSE);
|
||||
// gets the rect inside our border and debug border. If you wish to paint inside a box
|
||||
// call this method to get the rect so you don't draw on the debug border or outer border.
|
||||
|
||||
|
@ -149,22 +155,11 @@ public:
|
|||
|
||||
virtual void GetChildBoxInfo(PRInt32 aIndex, nsBoxInfo& aSize);
|
||||
|
||||
// Paint one child frame
|
||||
virtual void PaintChild(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsIFrame* aFrame,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
virtual void PaintChildren(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
// nsIBox methods
|
||||
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild);
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
enum Halignment {
|
||||
hAlign_Left,
|
||||
|
@ -179,7 +174,19 @@ public:
|
|||
vAlign_Bottom
|
||||
};
|
||||
protected:
|
||||
nsBoxFrame();
|
||||
nsBoxFrame(nsIPresShell* aPresShell, PRBool aIsRoot = PR_FALSE);
|
||||
|
||||
// Paint one child frame
|
||||
virtual void PaintChild(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsIFrame* aFrame,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
virtual void PaintChildren(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
|
||||
virtual void GetRedefinedMinPrefMax(nsIPresContext* aPresContext, nsIFrame* aFrame, nsCalculatedBoxInfo& aSize);
|
||||
|
@ -216,7 +223,7 @@ protected:
|
|||
private:
|
||||
|
||||
friend class nsBoxFrameInner;
|
||||
friend class nsBoxDebugInner;
|
||||
friend class nsBoxDebug;
|
||||
nsBoxFrameInner* mInner;
|
||||
}; // class nsBoxFrame
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ NS_NewDeckFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsDeckFrame* it = new (aPresShell) nsDeckFrame;
|
||||
nsDeckFrame* it = new (aPresShell) nsDeckFrame(aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -61,19 +61,10 @@ NS_NewDeckFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
|
||||
} // NS_NewDeckFrame
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeckFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
// Get the element's tag
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
//CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsDeckFrame::nsDeckFrame(nsIPresShell* aPresShell):nsStackFrame(aPresShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
|
@ -82,22 +73,12 @@ nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild,
|
||||
nsresult rv = nsStackFrame::AttributeChanged(aPresContext, aChild,
|
||||
aNameSpaceID, aAttribute, aHint);
|
||||
|
||||
|
||||
// if the index changed hide the old element and make the now element visible
|
||||
if (aAttribute == nsHTMLAtoms::index) {
|
||||
/*
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
nsCOMPtr<nsIReflowCommand> reflowCmd;
|
||||
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this,
|
||||
nsIReflowCommand::StyleChanged);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
*/
|
||||
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
|
||||
|
@ -230,87 +211,6 @@ NS_IMETHODIMP nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeckFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult r = nsBoxFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsDeckFrame::AddChildSize(nsBoxInfo& aInfo, nsBoxInfo& aChildInfo)
|
||||
{
|
||||
// largest preferred size
|
||||
if (aChildInfo.prefSize.width > aInfo.prefSize.width)
|
||||
aInfo.prefSize.width = aChildInfo.prefSize.width;
|
||||
|
||||
if (aChildInfo.prefSize.height > aInfo.prefSize.height)
|
||||
aInfo.prefSize.height = aChildInfo.prefSize.height;
|
||||
|
||||
// largest min size
|
||||
if (aChildInfo.minSize.width > aInfo.minSize.width)
|
||||
aInfo.minSize.width = aChildInfo.minSize.width;
|
||||
|
||||
if (aChildInfo.minSize.height > aInfo.minSize.height)
|
||||
aInfo.minSize.height = aChildInfo.minSize.height;
|
||||
|
||||
// smallest max size
|
||||
if (aChildInfo.maxSize.width < aInfo.maxSize.width)
|
||||
aInfo.maxSize.width = aChildInfo.maxSize.width;
|
||||
|
||||
if (aChildInfo.maxSize.height < aInfo.maxSize.height)
|
||||
aInfo.maxSize.height = aChildInfo.maxSize.height;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsDeckFrame::ComputeChildsNextPosition(nsCalculatedBoxInfo* aInfo, nscoord& aCurX, nscoord& aCurY, nscoord& aNextX, nscoord& aNextY, const nsSize& aCurrentChildSize, const nsRect& aBoxRect, nscoord aMaxAscent)
|
||||
{
|
||||
// let everything layout on top of each other.
|
||||
aCurX = aNextX = aBoxRect.x;
|
||||
aCurY = aNextY = aBoxRect.y;
|
||||
}
|
||||
|
||||
/*
|
||||
nsresult
|
||||
nsDeckFrame::PlaceChildren(nsIPresContext* aPresContext, nsRect& boxRect)
|
||||
{
|
||||
// ------- set the childs positions ---------
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
nsInfoList* list = GetInfoList();
|
||||
nsCalculatedBoxInfo* info = list->GetFirst();
|
||||
|
||||
nscoord count = 0;
|
||||
while (nsnull != childFrame)
|
||||
{
|
||||
nsresult rv;
|
||||
// make collapsed children not show up
|
||||
if (info->collapsed) {
|
||||
//nsRect rect(0,0,0,0);
|
||||
//childFrame->GetRect(rect);
|
||||
//if (rect.width > 0 || rect.height > 0) {
|
||||
// childFrame->SizeTo(0,0);
|
||||
CollapseChild(aPresContext, childFrame, PR_TRUE);
|
||||
//}
|
||||
} else {
|
||||
childFrame->MoveTo(aPresContext, boxRect.x, boxRect.y);
|
||||
}
|
||||
|
||||
rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
info = info->next;
|
||||
count++;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeckFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
|
@ -348,40 +248,3 @@ nsDeckFrame::DidReflow(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsDeckFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, nsRect& aRect, nscoord& aMaxAscent, nsCalculatedBoxInfo& aInfo, PRBool*& aResized, PRInt32 aInfoCount, nscoord& aChangedIndex, PRBool& aFinished, nscoord aIndex, nsString& aReason)
|
||||
{
|
||||
if (aDesiredSize.width > aRect.width) {
|
||||
aRect.width = aDesiredSize.width;
|
||||
InvalidateChildren();
|
||||
LayoutChildrenInRect(aRect, aMaxAscent);
|
||||
aReason = "child's width got bigger";
|
||||
aChangedIndex = aIndex;
|
||||
aFinished = PR_FALSE;
|
||||
} else if (aDesiredSize.height > aRect.height) {
|
||||
aRect.height = aDesiredSize.height;
|
||||
InvalidateChildren();
|
||||
LayoutChildrenInRect(aRect, aMaxAscent);
|
||||
aReason = "child's height got bigger";
|
||||
aChangedIndex = aIndex;
|
||||
aFinished = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDeckFrame::LayoutChildrenInRect(nsRect& aGivenSize, nscoord& aMaxAscent)
|
||||
{
|
||||
nsInfoList* list = GetInfoList();
|
||||
nsCalculatedBoxInfo* info = list->GetFirst();
|
||||
|
||||
while(info) {
|
||||
info->calculatedSize.width = aGivenSize.width;
|
||||
info->calculatedSize.height = aGivenSize.height;
|
||||
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
||||
info = info->next;
|
||||
}
|
||||
|
||||
aMaxAscent = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#ifndef nsDeckFrame_h___
|
||||
#define nsDeckFrame_h___
|
||||
|
||||
#include "nsBoxFrame.h"
|
||||
#include "nsStackFrame.h"
|
||||
|
||||
class nsDeckFrame : public nsBoxFrame
|
||||
class nsDeckFrame : public nsStackFrame
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -41,13 +41,6 @@ public:
|
|||
|
||||
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow);
|
||||
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
|
@ -63,17 +56,10 @@ public:
|
|||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
|
||||
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
virtual PRIntn GetSkipSides() const { return 0; }
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Deck";
|
||||
|
@ -82,13 +68,9 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
nsDeckFrame(nsIPresShell* aPresShell);
|
||||
|
||||
virtual nsIFrame* GetSelectedFrame();
|
||||
virtual void ComputeChildsNextPosition( nsCalculatedBoxInfo* aInfo, nscoord& aCurX, nscoord& aCurY, nscoord& aNextX, nscoord& aNextY, const nsSize& aCurrentChildSize, const nsRect& aBoxRect, nscoord aMaxAscent);
|
||||
virtual void ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, nsRect& aRect, nscoord& aMaxAscent, nsCalculatedBoxInfo& aInfo, PRBool*& aResized, PRInt32 aInfoCount, nscoord& aChangedIndex, PRBool& aFinished, nscoord aIndex, nsString& aReason);
|
||||
virtual void LayoutChildrenInRect(nsRect& aSize, nscoord& aMaxAscent);
|
||||
virtual void AddChildSize(nsBoxInfo& aInfo, nsBoxInfo& aChildInfo);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
class nsTitledBoxFrame : public nsBoxFrame {
|
||||
public:
|
||||
|
||||
nsTitledBoxFrame();
|
||||
nsTitledBoxFrame(nsIPresShell* aShell);
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
class nsTitledBoxInnerFrame : public nsBoxFrame {
|
||||
public:
|
||||
|
||||
nsTitledBoxInnerFrame() {}
|
||||
nsTitledBoxInnerFrame(nsIPresShell* aShell):nsBoxFrame(aShell) {}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -117,7 +117,7 @@ NS_NewTitledBoxInnerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTitledBoxInnerFrame* it = new (aPresShell) nsTitledBoxInnerFrame;
|
||||
nsTitledBoxInnerFrame* it = new (aPresShell) nsTitledBoxInnerFrame(aPresShell);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ NS_NewTitledBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTitledBoxFrame* it = new (aPresShell) nsTitledBoxFrame;
|
||||
nsTitledBoxFrame* it = new (aPresShell) nsTitledBoxFrame(aPresShell);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ NS_NewTitledBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTitledBoxFrame::nsTitledBoxFrame()
|
||||
nsTitledBoxFrame::nsTitledBoxFrame(nsIPresShell* aShell):nsBoxFrame(aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -70,12 +70,8 @@ public:
|
|||
*/
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild)=0;
|
||||
|
||||
/**
|
||||
* Helper method from doing box reflow
|
||||
*/
|
||||
static void HandleRootBoxReflow(nsIPresContext* aPresContext,
|
||||
nsIFrame* aBox,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug)=0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ NS_NewMenuBarFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsMenuBarFrame* it = new (aPresShell) nsMenuBarFrame;
|
||||
nsMenuBarFrame* it = new (aPresShell) nsMenuBarFrame (aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
|
@ -83,8 +83,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsToolbarFrame)
|
|||
//
|
||||
// nsMenuBarFrame cntr
|
||||
//
|
||||
nsMenuBarFrame::nsMenuBarFrame()
|
||||
:mIsActive(PR_FALSE), mTarget(nsnull), mKeyboardNavigator(nsnull), mMenuBarListener(nsnull)
|
||||
nsMenuBarFrame::nsMenuBarFrame(nsIPresShell* aShell):nsToolbarFrame(aShell),
|
||||
mIsActive(PR_FALSE), mTarget(nsnull), mKeyboardNavigator(nsnull), mMenuBarListener(nsnull)
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
|
|
@ -45,7 +45,7 @@ nsresult NS_NewMenuBarFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
|
|||
class nsMenuBarFrame : public nsToolbarFrame, public nsIMenuParent
|
||||
{
|
||||
public:
|
||||
nsMenuBarFrame();
|
||||
nsMenuBarFrame(nsIPresShell* aShell);
|
||||
~nsMenuBarFrame();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -76,7 +76,7 @@ NS_NewMenuFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsMenuFrame* it = new (aPresShell) nsMenuFrame;
|
||||
nsMenuFrame* it = new (aPresShell) nsMenuFrame (aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
|
@ -109,8 +109,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
|||
//
|
||||
// nsMenuFrame cntr
|
||||
//
|
||||
nsMenuFrame::nsMenuFrame()
|
||||
: mIsMenu(PR_FALSE),
|
||||
nsMenuFrame::nsMenuFrame(nsIPresShell* aShell):nsBoxFrame(aShell),
|
||||
mIsMenu(PR_FALSE),
|
||||
mMenuOpen(PR_FALSE),
|
||||
mChecked(PR_FALSE),
|
||||
mType(eMenuType_Normal),
|
||||
|
@ -808,6 +808,41 @@ nsMenuFrame::Reflow(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuFrame::SetDebug(nsIPresContext* aPresContext, PRBool aDebug)
|
||||
{
|
||||
// see if our state matches the given debug state
|
||||
PRBool debugSet = mState & NS_STATE_CURRENTLY_IN_DEBUG;
|
||||
PRBool debugChanged = (!aDebug && debugSet) || (aDebug && !debugSet);
|
||||
|
||||
// if it doesn't then tell each child below us the new debug state
|
||||
if (debugChanged)
|
||||
{
|
||||
nsBoxFrame::SetDebug(aPresContext, aDebug);
|
||||
SetDebug(aPresContext, mPopupFrames.FirstChild(), aDebug);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMenuFrame::SetDebug(nsIPresContext* aPresContext, nsIFrame* aList, PRBool aDebug)
|
||||
{
|
||||
if (!aList)
|
||||
return NS_OK;
|
||||
|
||||
while (aList) {
|
||||
nsIBox* ibox = nsnull;
|
||||
if (NS_SUCCEEDED(aList->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
||||
ibox->SetDebug(aPresContext, aDebug);
|
||||
}
|
||||
|
||||
aList->GetNextSibling(&aList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
|
@ -1325,6 +1360,7 @@ nsMenuFrame::InsertFrames(nsIPresContext* aPresContext,
|
|||
frameChild->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && tag.get() == nsXULAtoms::menupopup) {
|
||||
mPopupFrames.InsertFrames(nsnull, nsnull, aFrameList);
|
||||
SetDebug(aPresContext, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
|
||||
rv = GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
||||
} else {
|
||||
rv = nsBoxFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
|
||||
|
@ -1351,6 +1387,7 @@ nsMenuFrame::AppendFrames(nsIPresContext* aPresContext,
|
|||
frameChild->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && tag.get() == nsXULAtoms::menupopup) {
|
||||
mPopupFrames.AppendFrames(nsnull, aFrameList);
|
||||
SetDebug(aPresContext, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
|
||||
rv = GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
||||
} else {
|
||||
rv = nsBoxFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
|
||||
|
|
|
@ -54,7 +54,7 @@ class nsMenuFrame : public nsBoxFrame,
|
|||
public nsIAnonymousContentCreator
|
||||
{
|
||||
public:
|
||||
nsMenuFrame();
|
||||
nsMenuFrame(nsIPresShell* aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -70,6 +70,8 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
NS_IMETHOD IsActive(PRBool& aResult) { aResult = PR_TRUE; return NS_OK; };
|
||||
|
||||
// The following four methods are all overridden so that the menu children
|
||||
|
@ -187,6 +189,8 @@ protected:
|
|||
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);
|
||||
|
||||
protected:
|
||||
nsresult SetDebug(nsIPresContext* aPresContext, nsIFrame* aList, PRBool aDebug);
|
||||
|
||||
nsFrameList mPopupFrames;
|
||||
PRPackedBool mIsMenu; // Whether or not we can even have children or not.
|
||||
PRPackedBool mMenuOpen;
|
||||
|
|
|
@ -67,7 +67,7 @@ NS_NewMenuPopupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsMenuPopupFrame* it = new (aPresShell) nsMenuPopupFrame;
|
||||
nsMenuPopupFrame* it = new (aPresShell) nsMenuPopupFrame (aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
|
@ -99,8 +99,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
|||
//
|
||||
// nsMenuPopupFrame ctor
|
||||
//
|
||||
nsMenuPopupFrame::nsMenuPopupFrame()
|
||||
: mCurrentMenu(nsnull), mTimerMenu(nsnull), mCloseTimer(nsnull)
|
||||
nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell):nsBoxFrame(aShell),
|
||||
mCurrentMenu(nsnull), mTimerMenu(nsnull), mCloseTimer(nsnull)
|
||||
{
|
||||
SetIsContextMenu(PR_FALSE); // we're not a context menu by default
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class nsIDOMXULDocument;
|
|||
class nsMenuPopupFrame : public nsBoxFrame, public nsIMenuParent, public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
nsMenuPopupFrame();
|
||||
nsMenuPopupFrame(nsIPresShell* aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ NS_NewPopupSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPopupSetFrame* it = new (aPresShell) nsPopupSetFrame;
|
||||
nsPopupSetFrame* it = new (aPresShell) nsPopupSetFrame (aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
|
@ -93,8 +93,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
|||
//
|
||||
// nsPopupSetFrame cntr
|
||||
//
|
||||
nsPopupSetFrame::nsPopupSetFrame()
|
||||
:mPresContext(nsnull), mElementFrame(nsnull)
|
||||
nsPopupSetFrame::nsPopupSetFrame(nsIPresShell* aShell):nsBoxFrame(aShell),
|
||||
mPresContext(nsnull), mElementFrame(nsnull)
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
@ -265,6 +265,42 @@ nsPopupSetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPopupSetFrame::SetDebug(nsIPresContext* aPresContext, PRBool aDebug)
|
||||
{
|
||||
// see if our state matches the given debug state
|
||||
PRBool debugSet = mState & NS_STATE_CURRENTLY_IN_DEBUG;
|
||||
PRBool debugChanged = (!aDebug && debugSet) || (aDebug && !debugSet);
|
||||
|
||||
// if it doesn't then tell each child below us the new debug state
|
||||
if (debugChanged)
|
||||
{
|
||||
nsBoxFrame::SetDebug(aPresContext, aDebug);
|
||||
SetDebug(aPresContext, mPopupFrames.FirstChild(), aDebug);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPopupSetFrame::SetDebug(nsIPresContext* aPresContext, nsIFrame* aList, PRBool aDebug)
|
||||
{
|
||||
if (!aList)
|
||||
return NS_OK;
|
||||
|
||||
while (aList) {
|
||||
nsIBox* ibox = nsnull;
|
||||
if (NS_SUCCEEDED(aList->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
||||
ibox->SetDebug(aPresContext, aDebug);
|
||||
}
|
||||
|
||||
aList->GetNextSibling(&aList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPopupSetFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
|
@ -326,6 +362,7 @@ nsPopupSetFrame::InsertFrames(nsIPresContext* aPresContext,
|
|||
frameChild->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && tag.get() == nsXULAtoms::popup) {
|
||||
mPopupFrames.InsertFrames(nsnull, nsnull, aFrameList);
|
||||
SetDebug(aPresContext, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
|
||||
rv = GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
||||
} else {
|
||||
rv = nsBoxFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
|
||||
|
@ -352,6 +389,7 @@ nsPopupSetFrame::AppendFrames(nsIPresContext* aPresContext,
|
|||
frameChild->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && tag.get() == nsXULAtoms::popup) {
|
||||
mPopupFrames.AppendFrames(nsnull, aFrameList);
|
||||
SetDebug(aPresContext, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
|
||||
rv = GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
||||
} else {
|
||||
rv = nsBoxFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
|
||||
|
|
|
@ -41,7 +41,7 @@ nsresult NS_NewPopupSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
|
|||
class nsPopupSetFrame : public nsBoxFrame, public nsIPopupSetFrame
|
||||
{
|
||||
public:
|
||||
nsPopupSetFrame();
|
||||
nsPopupSetFrame(nsIPresShell* aShell);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug);
|
||||
|
||||
// The following four methods are all overridden so that the menu children
|
||||
// can be stored in a separate list (so that they don't impact reflow of the
|
||||
// actual menu item at all).
|
||||
|
@ -117,6 +119,8 @@ protected:
|
|||
void UpdateDismissalListener(nsIMenuParent* aMenuParent);
|
||||
|
||||
protected:
|
||||
nsresult SetDebug(nsIPresContext* aPresContext, nsIFrame* aList, PRBool aDebug);
|
||||
|
||||
nsFrameList mPopupFrames;
|
||||
nsIPresContext* mPresContext; // Our pres context.
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@ public:
|
|||
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild);
|
||||
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug) { return NS_OK; }
|
||||
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -242,7 +242,7 @@ NS_NewScrollbarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsScrollbarFrame* it = new (aPresShell) nsScrollbarFrame;
|
||||
nsScrollbarFrame* it = new (aPresShell) nsScrollbarFrame (aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class nsScrollbarFrame : public nsBoxFrame,
|
|||
public nsIAnonymousContentCreator
|
||||
{
|
||||
public:
|
||||
nsScrollbarFrame() {}
|
||||
nsScrollbarFrame(nsIPresShell* aShell):nsBoxFrame(aShell) {}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
|
|
|
@ -213,7 +213,7 @@ NS_NewSplitterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSplitterFrame* it = new (aPresShell) nsSplitterFrame;
|
||||
nsSplitterFrame* it = new (aPresShell) nsSplitterFrame(aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -222,7 +222,7 @@ NS_NewSplitterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
|
||||
} // NS_NewSplitterFrame
|
||||
|
||||
nsSplitterFrame::nsSplitterFrame()
|
||||
nsSplitterFrame::nsSplitterFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell)
|
||||
{
|
||||
mInner = new nsSplitterFrameInner(this);
|
||||
mInner->AddRef();
|
||||
|
|
|
@ -39,7 +39,7 @@ nsresult NS_NewSplitterFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
|
|||
class nsSplitterFrame : public nsBoxFrame, public nsIAnonymousContentCreator
|
||||
{
|
||||
public:
|
||||
nsSplitterFrame();
|
||||
nsSplitterFrame(nsIPresShell* aPresShell);
|
||||
~nsSplitterFrame();
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Eric Vaughan
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsSpringFrame.h"
|
||||
|
||||
nsresult
|
||||
NS_NewSpringFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSpringFrame* it = new (aPresShell) nsSpringFrame;
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewSpringFrame
|
||||
|
||||
NS_IMETHODIMP nsSpringFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
*aFrame = this;
|
||||
return NS_OK;
|
||||
/*
|
||||
// clicks just go right through springs.
|
||||
return NS_ERROR_FAILURE;
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Eric D Vaughan
|
||||
A frame that can have multiple children. Only one child may be displayed at one time. So the
|
||||
can be flipped though like a deck of cards.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef nsSpringFrame_h___
|
||||
#define nsSpringFrame_h___
|
||||
|
||||
#include "nsXULLeafFrame.h"
|
||||
|
||||
class nsSpringFrame : public nsXULLeafFrame
|
||||
{
|
||||
public:
|
||||
|
||||
friend nsresult NS_NewSpringFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
|
||||
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Spring";
|
||||
return NS_OK;
|
||||
}
|
||||
}; // class nsSpringFrame
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Eric Vaughan
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsStackFrame.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIViewManager.h"
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewStackFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsStackFrame* it = new (aPresShell) nsStackFrame(aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewDeckFrame
|
||||
|
||||
nsStackFrame::nsStackFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStackFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
// Get the element's tag
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsStackFrame::AddChildSize(nsBoxInfo& aInfo, nsBoxInfo& aChildInfo)
|
||||
{
|
||||
// largest preferred size
|
||||
if (aChildInfo.prefSize.width > aInfo.prefSize.width)
|
||||
aInfo.prefSize.width = aChildInfo.prefSize.width;
|
||||
|
||||
if (aChildInfo.prefSize.height > aInfo.prefSize.height)
|
||||
aInfo.prefSize.height = aChildInfo.prefSize.height;
|
||||
|
||||
// largest min size
|
||||
if (aChildInfo.minSize.width > aInfo.minSize.width)
|
||||
aInfo.minSize.width = aChildInfo.minSize.width;
|
||||
|
||||
if (aChildInfo.minSize.height > aInfo.minSize.height)
|
||||
aInfo.minSize.height = aChildInfo.minSize.height;
|
||||
|
||||
// smallest max size
|
||||
if (aChildInfo.maxSize.width < aInfo.maxSize.width)
|
||||
aInfo.maxSize.width = aChildInfo.maxSize.width;
|
||||
|
||||
if (aChildInfo.maxSize.height < aInfo.maxSize.height)
|
||||
aInfo.maxSize.height = aChildInfo.maxSize.height;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsStackFrame::ComputeChildsNextPosition(nsCalculatedBoxInfo* aInfo, nscoord& aCurX, nscoord& aCurY, nscoord& aNextX, nscoord& aNextY, const nsSize& aCurrentChildSize, const nsRect& aBoxRect, nscoord aMaxAscent)
|
||||
{
|
||||
// let everything layout on top of each other.
|
||||
aCurX = aNextX = aBoxRect.x;
|
||||
aCurY = aNextY = aBoxRect.y;
|
||||
}
|
||||
|
||||
void
|
||||
nsStackFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, nsRect& aRect, nscoord& aMaxAscent, nsCalculatedBoxInfo& aInfo, PRBool*& aResized, PRInt32 aInfoCount, nscoord& aChangedIndex, PRBool& aFinished, nscoord aIndex, nsString& aReason)
|
||||
{
|
||||
if (aDesiredSize.width > aRect.width) {
|
||||
aRect.width = aDesiredSize.width;
|
||||
InvalidateChildren();
|
||||
LayoutChildrenInRect(aRect, aMaxAscent);
|
||||
aReason = "child's width got bigger";
|
||||
aChangedIndex = aIndex;
|
||||
aFinished = PR_FALSE;
|
||||
} else if (aDesiredSize.height > aRect.height) {
|
||||
aRect.height = aDesiredSize.height;
|
||||
InvalidateChildren();
|
||||
LayoutChildrenInRect(aRect, aMaxAscent);
|
||||
aReason = "child's height got bigger";
|
||||
aChangedIndex = aIndex;
|
||||
aFinished = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsStackFrame::LayoutChildrenInRect(nsRect& aGivenSize, nscoord& aMaxAscent)
|
||||
{
|
||||
nsInfoList* list = GetInfoList();
|
||||
nsCalculatedBoxInfo* info = list->GetFirst();
|
||||
|
||||
while(info) {
|
||||
info->calculatedSize.width = aGivenSize.width;
|
||||
info->calculatedSize.height = aGivenSize.height;
|
||||
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
||||
info = info->next;
|
||||
}
|
||||
|
||||
aMaxAscent = 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStackFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsRect r(0,0,mRect.width, mRect.height);
|
||||
|
||||
// if it is not inside us fail
|
||||
if (!r.Contains(aPoint)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// is it inside our border, padding, and debugborder or insets?
|
||||
nsMargin im(0,0,0,0);
|
||||
GetInset(im);
|
||||
nsMargin border(0,0,0,0);
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
spacing->GetBorderPadding(border);
|
||||
r.Deflate(im);
|
||||
r.Deflate(border);
|
||||
|
||||
// no? Then it must be in our border so return us.
|
||||
if (!r.Contains(aPoint)) {
|
||||
*aFrame = this;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsPoint tmp;
|
||||
//tmp.MoveTo(aPoint.x - r.x, aPoint.y - r.y);
|
||||
|
||||
nsIFrame* first = mFrames.FirstChild();
|
||||
|
||||
|
||||
|
||||
// look at the children in reverse order
|
||||
nsresult rv;
|
||||
|
||||
if (first)
|
||||
rv = GetStackedFrameForPoint(aPresContext, first, nsRect(0,0,mRect.width, mRect.height), aPoint, aFrame);
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (!NS_SUCCEEDED(rv)) {
|
||||
const nsStyleColor* color =
|
||||
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
PRBool transparentBG = NS_STYLE_BG_COLOR_TRANSPARENT ==
|
||||
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
|
||||
PRBool backgroundImage = (color->mBackgroundImage.Length() > 0);
|
||||
|
||||
if (!transparentBG || backgroundImage)
|
||||
{
|
||||
*aFrame = this;
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("\n------------");
|
||||
|
||||
if (*aFrame)
|
||||
nsFrame::ListTag(stdout, *aFrame);
|
||||
printf("--------------\n");
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsStackFrame::GetStackedFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame* aChild,
|
||||
const nsRect& aRect,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
// look at all the children is reverse order. Use the stack to do
|
||||
// this.
|
||||
nsIFrame* next;
|
||||
aChild->GetNextSibling(&next);
|
||||
if (next != nsnull) {
|
||||
nsresult rv = GetStackedFrameForPoint(aPresContext, next, aRect, aPoint, aFrame);
|
||||
if (NS_SUCCEEDED(rv) && *aFrame)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsRect childRect;
|
||||
aChild->GetRect(childRect);
|
||||
|
||||
if (childRect.Contains(aPoint)) {
|
||||
nsPoint tmp;
|
||||
tmp.MoveTo(aPoint.x - childRect.x, aPoint.y - childRect.y);
|
||||
|
||||
return aChild->GetFrameForPoint(aPresContext, tmp, aFrame);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
nsStackFrame::PaintChildren(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
// we need to make sure we paint background then foreground of each child because they
|
||||
// are stacked. Otherwise the foreground of the first child could be on the top of the
|
||||
// background of the second.
|
||||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND)
|
||||
{
|
||||
nsBoxFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
}
|
||||
|
||||
// Paint one child frame
|
||||
void
|
||||
nsStackFrame::PaintChild(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsIFrame* aFrame,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
// we need to make sure we paint background then foreground of each child because they
|
||||
// are stacked. Otherwise the foreground of the first child could be on the top of the
|
||||
// background of the second.
|
||||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND)
|
||||
{
|
||||
nsBoxFrame::PaintChild(aPresContext, aRenderingContext, aDirtyRect, aFrame, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
nsBoxFrame::PaintChild(aPresContext, aRenderingContext, aDirtyRect, aFrame, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Eric D Vaughan
|
||||
A frame that can have multiple children. Only one child may be displayed at one time. So the
|
||||
can be flipped though like a deck of cards.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef nsStackFrame_h___
|
||||
#define nsStackFrame_h___
|
||||
|
||||
#include "nsBoxFrame.h"
|
||||
|
||||
class nsStackFrame : public nsBoxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
friend nsresult NS_NewStackFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow);
|
||||
|
||||
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Stack";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
nsStackFrame(nsIPresShell* aShell);
|
||||
|
||||
// Paint one child frame
|
||||
virtual void PaintChild(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsIFrame* aFrame,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
virtual void PaintChildren(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
virtual void ComputeChildsNextPosition( nsCalculatedBoxInfo* aInfo, nscoord& aCurX, nscoord& aCurY, nscoord& aNextX, nscoord& aNextY, const nsSize& aCurrentChildSize, const nsRect& aBoxRect, nscoord aMaxAscent);
|
||||
virtual void ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, nsRect& aRect, nscoord& aMaxAscent, nsCalculatedBoxInfo& aInfo, PRBool*& aResized, PRInt32 aInfoCount, nscoord& aChangedIndex, PRBool& aFinished, nscoord aIndex, nsString& aReason);
|
||||
virtual void LayoutChildrenInRect(nsRect& aSize, nscoord& aMaxAscent);
|
||||
virtual void AddChildSize(nsBoxInfo& aInfo, nsBoxInfo& aChildInfo);
|
||||
|
||||
private:
|
||||
virtual nsresult GetStackedFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame* aChild,
|
||||
const nsRect& aRect,
|
||||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame);
|
||||
}; // class nsStackFrame
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -50,7 +50,7 @@ NS_NewTitleFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTitleFrame* it = new (aPresShell) nsTitleFrame;
|
||||
nsTitleFrame* it = new (aPresShell) nsTitleFrame(aPresShell);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ NS_NewTitleFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTitleFrame::nsTitleFrame()
|
||||
nsTitleFrame::nsTitleFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class nsTitleFrame : public nsBoxFrame {
|
||||
public:
|
||||
|
||||
nsTitleFrame();
|
||||
nsTitleFrame(nsIPresShell* aShell);
|
||||
virtual ~nsTitleFrame();
|
||||
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
class nsTitledBoxFrame : public nsBoxFrame {
|
||||
public:
|
||||
|
||||
nsTitledBoxFrame();
|
||||
nsTitledBoxFrame(nsIPresShell* aShell);
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
class nsTitledBoxInnerFrame : public nsBoxFrame {
|
||||
public:
|
||||
|
||||
nsTitledBoxInnerFrame() {}
|
||||
nsTitledBoxInnerFrame(nsIPresShell* aShell):nsBoxFrame(aShell) {}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -117,7 +117,7 @@ NS_NewTitledBoxInnerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTitledBoxInnerFrame* it = new (aPresShell) nsTitledBoxInnerFrame;
|
||||
nsTitledBoxInnerFrame* it = new (aPresShell) nsTitledBoxInnerFrame(aPresShell);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ NS_NewTitledBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTitledBoxFrame* it = new (aPresShell) nsTitledBoxFrame;
|
||||
nsTitledBoxFrame* it = new (aPresShell) nsTitledBoxFrame(aPresShell);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ NS_NewTitledBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTitledBoxFrame::nsTitledBoxFrame()
|
||||
nsTitledBoxFrame::nsTitledBoxFrame(nsIPresShell* aShell):nsBoxFrame(aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ nsTitledButtonFrame::Destroy(nsIPresContext* aPresContext)
|
|||
// Release image loader first so that it's refcnt can go to zero
|
||||
mImageLoader.StopAllLoadImages(aPresContext);
|
||||
|
||||
return nsLeafFrame::Destroy(aPresContext);
|
||||
return nsXULLeafFrame::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext,
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
nsresult rv = nsXULLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mRenderer->SetNameSpace(kNameSpaceID_None);
|
||||
mRenderer->SetFrame(this,aPresContext);
|
||||
|
@ -822,7 +822,7 @@ nsTitledButtonFrame::PaintTitle(nsIPresContext* aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
if (eFramePaintLayer_Content == aWhichLayer) {
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
|
||||
if (mTitle.Length() == 0)
|
||||
return NS_OK;
|
||||
|
@ -915,7 +915,7 @@ nsTitledButtonFrame::PaintImage(nsIPresContext* aPresContext,
|
|||
if (!mHasImage || !aDirtyRect.Intersects(mImageRect))
|
||||
return NS_OK;
|
||||
|
||||
if (eFramePaintLayer_Content != aWhichLayer)
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND != aWhichLayer)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIImage> image ( dont_AddRef(mImageLoader.GetImage()) );
|
||||
|
@ -945,68 +945,14 @@ nsTitledButtonFrame::Reflow(nsIPresContext* aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// redraw us if we are flowed incremental and we are targeted or we are dirty.
|
||||
mNeedsAccessUpdate = PR_TRUE;
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsIFrame* targetFrame;
|
||||
|
||||
// See if it's targeted at us
|
||||
aReflowState.reflowCommand->GetTarget(targetFrame);
|
||||
if (this == targetFrame) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
} else if (eReflowReason_Dirty == aReflowState.reason) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mNeedsLayout = PR_TRUE;
|
||||
nsresult result = nsLeafFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.width == aReflowState.mComputedWidth + aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right,
|
||||
"TitledButtons width is wrong!!!");
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.height == aReflowState.mComputedHeight + aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom,
|
||||
"TitledButtons height is wrong!!!");
|
||||
nsresult result = nsXULLeafFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsTitledButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
// get our info object.
|
||||
nsBoxInfo info;
|
||||
info.Clear();
|
||||
|
||||
GetBoxInfo(aPresContext, aReflowState, info);
|
||||
|
||||
// size is our preferred unless calculated.
|
||||
aDesiredSize.width = info.prefSize.width;
|
||||
aDesiredSize.height = info.prefSize.height;
|
||||
|
||||
// if either the width or the height was not computed use our intrinsic size
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
aDesiredSize.width = aReflowState.mComputedWidth;
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
||||
aDesiredSize.height = aReflowState.mComputedHeight;
|
||||
nscoord descent = info.prefSize.height - info.ascent;
|
||||
aDesiredSize.ascent = aDesiredSize.height - descent;
|
||||
if (aDesiredSize.ascent < 0)
|
||||
aDesiredSize.ascent = 0;
|
||||
} else {
|
||||
aDesiredSize.ascent = info.ascent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct nsTitleRecessedBorder : public nsStyleSpacing {
|
||||
nsTitleRecessedBorder(nscoord aBorderWidth)
|
||||
: nsStyleSpacing()
|
||||
|
@ -1258,7 +1204,7 @@ nsTitledButtonFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
}
|
||||
|
||||
return nsLeafFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
return nsXULLeafFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1437,12 +1383,6 @@ nsTitledButtonFrame::GetImageSize(nsIPresContext* aPresContext)
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTitledButtonFrame::InvalidateCache(nsIFrame* aChild)
|
||||
{
|
||||
// we don't cache any information
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok return our dimensions
|
||||
|
@ -1526,43 +1466,6 @@ nsTitledButtonFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflow
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We can be a nsIBox
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsTitledButtonFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIBox))) {
|
||||
*aInstancePtr = (void*)(nsIBox*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* We are a frame and we do not maintain a ref count
|
||||
*/
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsTitledButtonFrame::AddRef(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsTitledButtonFrame::Release(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTitledButtonFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
|
@ -1571,15 +1474,3 @@ nsTitledButtonFrame::GetFrameName(nsString& aResult) const
|
|||
aResult += "]";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTitledButtonFrame::ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mState |= NS_FRAME_IS_DIRTY;
|
||||
return mParent->ReflowDirtyChild(shell, this);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
#define nsTitledButtonFrame_h___
|
||||
|
||||
#include "nsHTMLImageLoader.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsIBox.h"
|
||||
#include "nsXULLeafFrame.h"
|
||||
|
||||
class nsIPopUpMenu;
|
||||
class nsTitledButtonRenderer;
|
||||
|
||||
class nsTitledButtonFrame : public nsLeafFrame, public nsIBox
|
||||
class nsTitledButtonFrame : public nsXULLeafFrame
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -39,9 +38,8 @@ public:
|
|||
|
||||
// nsIBox frame interface
|
||||
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
@ -111,10 +109,6 @@ protected:
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
|
||||
void DisplayAltFeedback(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -148,11 +142,6 @@ protected:
|
|||
|
||||
virtual void GetImageSize(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// tri state methods
|
||||
|
|
|
@ -140,7 +140,7 @@ NS_NewToolbarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsToolbarFrame* it = new (aPresShell) nsToolbarFrame;
|
||||
nsToolbarFrame* it = new (aPresShell) nsToolbarFrame (aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -156,8 +156,8 @@ NS_NewToolbarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
//
|
||||
// Most of the work need to be delayed until Init(). Lame!
|
||||
//
|
||||
nsToolbarFrame :: nsToolbarFrame ( )
|
||||
: mXDropLoc ( -1 )
|
||||
nsToolbarFrame :: nsToolbarFrame (nsIPresShell* aShell):nsBoxFrame(aShell),
|
||||
mXDropLoc ( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
nsToolbarFrame();
|
||||
nsToolbarFrame(nsIPresShell* aShell);
|
||||
virtual ~nsToolbarFrame();
|
||||
|
||||
// pass-by-value not allowed for a coordinator because it corresponds 1-to-1
|
||||
|
|
|
@ -44,7 +44,7 @@ NS_NewToolbarItemFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if ( !aNewFrame )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsToolbarItemFrame* it = new (aPresShell) nsToolbarItemFrame;
|
||||
nsToolbarItemFrame* it = new (aPresShell) nsToolbarItemFrame(aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -57,7 +57,7 @@ NS_NewToolbarItemFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
//
|
||||
// nsToolbarItemFrame ctor and dtor
|
||||
//
|
||||
nsToolbarItemFrame::nsToolbarItemFrame()
|
||||
nsToolbarItemFrame::nsToolbarItemFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class nsToolbarItemFrame : public nsBoxFrame
|
|||
{
|
||||
public:
|
||||
|
||||
nsToolbarItemFrame();
|
||||
nsToolbarItemFrame(nsIPresShell* aShell);
|
||||
~nsToolbarItemFrame();
|
||||
|
||||
friend nsresult NS_NewToolbarItemFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
|
|
@ -82,7 +82,7 @@ NS_NewToolboxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsToolboxFrame* it = new (aPresShell) nsToolboxFrame;
|
||||
nsToolboxFrame* it = new (aPresShell) nsToolboxFrame (aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -98,8 +98,8 @@ NS_NewToolboxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
|||
//
|
||||
// Init, if necessary
|
||||
//
|
||||
nsToolboxFrame :: nsToolboxFrame ( )
|
||||
: mSumOfToolbarHeights(0), mNumToolbars(0),
|
||||
nsToolboxFrame :: nsToolboxFrame (nsIPresShell* aShell):nsBoxFrame(aShell)
|
||||
, mSumOfToolbarHeights(0), mNumToolbars(0),
|
||||
mGrippyHilighted(kNoGrippyHilighted),
|
||||
kCollapsedAtom(dont_AddRef( NS_NewAtom("collapsed"))),
|
||||
kHiddenAtom(dont_AddRef( NS_NewAtom("hidden"))),
|
||||
|
@ -571,7 +571,8 @@ nsToolboxFrame :: ClearGrippyList ( nsVoidArray & inList )
|
|||
void
|
||||
nsToolboxFrame::GetInset(nsMargin& margin)
|
||||
{
|
||||
margin = mInset;
|
||||
nsBoxFrame::GetInset(margin);
|
||||
margin += mInset;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ protected:
|
|||
PRBool mCollapsed;
|
||||
};
|
||||
|
||||
nsToolboxFrame();
|
||||
nsToolboxFrame(nsIPresShell* aShell);
|
||||
virtual ~nsToolboxFrame();
|
||||
|
||||
virtual PRBool GetInitialOrientation(PRBool& aIsHorizontal);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "nsTableOuterFrame.h"
|
||||
#include "nsIBox.h"
|
||||
#include "nsISelfScrollingFrame.h"
|
||||
#include "nsITreeFrame.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Eric Vaughan
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsXULLeafFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
//
|
||||
// NS_NewToolbarFrame
|
||||
//
|
||||
// Creates a new Toolbar frame and returns it in |aNewFrame|
|
||||
//
|
||||
nsresult
|
||||
NS_NewXULLeafFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsXULLeafFrame* it = new (aPresShell) nsXULLeafFrame;
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// it->SetFlags(aFlags);
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewTextFrame
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsIFrame* targetFrame;
|
||||
|
||||
// See if it's targeted at us
|
||||
aReflowState.reflowCommand->GetTarget(targetFrame);
|
||||
if (this == targetFrame) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
} else if (eReflowReason_Dirty == aReflowState.reason) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
nsresult result = nsLeafFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.width == aReflowState.mComputedWidth + aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right,
|
||||
"Text width is wrong!!!");
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.height == aReflowState.mComputedHeight + aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom,
|
||||
"Text height is wrong!!!");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULLeafFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
// get our info object.
|
||||
nsBoxInfo info;
|
||||
info.Clear();
|
||||
|
||||
GetBoxInfo(aPresContext, aReflowState, info);
|
||||
|
||||
// size is our preferred unless calculated.
|
||||
aDesiredSize.width = info.prefSize.width;
|
||||
aDesiredSize.height = info.prefSize.height;
|
||||
|
||||
// if either the width or the height was not computed use our intrinsic size
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
aDesiredSize.width = aReflowState.mComputedWidth;
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
||||
aDesiredSize.height = aReflowState.mComputedHeight;
|
||||
nscoord descent = info.prefSize.height - info.ascent;
|
||||
aDesiredSize.ascent = aDesiredSize.height - descent;
|
||||
if (aDesiredSize.ascent < 0)
|
||||
aDesiredSize.ascent = 0;
|
||||
} else {
|
||||
aDesiredSize.ascent = info.ascent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::InvalidateCache(nsIFrame* aChild)
|
||||
{
|
||||
// we don't cache any information
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok return our dimensions
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize)
|
||||
{
|
||||
aSize.prefSize.width = 0;
|
||||
aSize.prefSize.height = 0;
|
||||
aSize.minSize.width = 0;
|
||||
aSize.minSize.height = 0;
|
||||
aSize.maxSize.width = NS_INTRINSICSIZE;
|
||||
aSize.maxSize.height = NS_INTRINSICSIZE;
|
||||
aSize.ascent = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We can be a nsIBox
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIBox))) {
|
||||
*aInstancePtr = (void*)(nsIBox*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* We are a frame and we do not maintain a ref count
|
||||
*/
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsXULLeafFrame::AddRef(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsXULLeafFrame::Release(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Leaf";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULLeafFrame::ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mState |= NS_FRAME_IS_DIRTY;
|
||||
return mParent->ReflowDirtyChild(shell, this);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsXULLeafFrame_h___
|
||||
#define nsXULLeafFrame_h___
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsIBox.h"
|
||||
|
||||
class nsAccessKeyInfo;
|
||||
|
||||
class nsXULLeafFrame : public nsLeafFrame, public nsIBox
|
||||
{
|
||||
public:
|
||||
|
||||
friend nsresult NS_NewXULLeafFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsIBox frame interface
|
||||
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild);
|
||||
NS_IMETHOD SetDebug(nsIPresContext* aPresContext, PRBool aDebug) { return NS_OK; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
|
||||
nsXULLeafFrame() {}
|
||||
|
||||
private:
|
||||
|
||||
}; // class nsXULLeafFrame
|
||||
|
||||
#endif /* nsXULLeafFrame_h___ */
|
|
@ -39,45 +39,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
/*
|
||||
#include "nsButtonFrameRenderer.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsButtonFrameRenderer.h"
|
||||
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsString.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIImage.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsImageMap.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "prprf.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
#include "nsIStyleSet.h"
|
||||
|
||||
#include "nsFormControlHelper.h"
|
||||
*/
|
||||
|
||||
#define ELIPSIS "..."
|
||||
|
||||
#define CROP_LEFT "left"
|
||||
|
@ -165,7 +126,7 @@ nsXULTextFrame::Init(nsIPresContext* aPresContext,
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
nsresult rv = nsXULLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
PRBool a,b,c;
|
||||
UpdateAttributes(aPresContext, nsnull, a, b, c /* all */);
|
||||
|
@ -271,7 +232,7 @@ nsXULTextFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (!disp->mVisible)
|
||||
return NS_OK;
|
||||
|
||||
if (eFramePaintLayer_Content == aWhichLayer) {
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
|
||||
// remove the border and padding
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
|
@ -603,75 +564,9 @@ nsXULTextFrame::Reflow(nsIPresContext* aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsIFrame* targetFrame;
|
||||
|
||||
// See if it's targeted at us
|
||||
aReflowState.reflowCommand->GetTarget(targetFrame);
|
||||
if (this == targetFrame) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
} else if (eReflowReason_Dirty == aReflowState.reason) {
|
||||
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mState |= NS_STATE_NEED_LAYOUT;
|
||||
|
||||
nsresult result = nsLeafFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.width == aReflowState.mComputedWidth + aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right,
|
||||
"Text width is wrong!!!");
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE)
|
||||
NS_ASSERTION(aMetrics.height == aReflowState.mComputedHeight + aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom,
|
||||
"Text height is wrong!!!");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTextFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
// get our info object.
|
||||
nsBoxInfo info;
|
||||
info.Clear();
|
||||
|
||||
GetBoxInfo(aPresContext, aReflowState, info);
|
||||
|
||||
// size is our preferred unless calculated.
|
||||
aDesiredSize.width = info.prefSize.width;
|
||||
aDesiredSize.height = info.prefSize.height;
|
||||
|
||||
// if either the width or the height was not computed use our intrinsic size
|
||||
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
||||
aDesiredSize.width = aReflowState.mComputedWidth;
|
||||
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
||||
aDesiredSize.height = aReflowState.mComputedHeight;
|
||||
nscoord descent = info.prefSize.height - info.ascent;
|
||||
aDesiredSize.ascent = aDesiredSize.height - descent;
|
||||
if (aDesiredSize.ascent < 0)
|
||||
aDesiredSize.ascent = 0;
|
||||
} else {
|
||||
aDesiredSize.ascent = info.ascent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTextFrame::InvalidateCache(nsIFrame* aChild)
|
||||
{
|
||||
// we don't cache any information
|
||||
return NS_OK;
|
||||
return nsXULLeafFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -697,43 +592,6 @@ nsXULTextFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We can be a nsIBox
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsXULTextFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIBox))) {
|
||||
*aInstancePtr = (void*)(nsIBox*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* We are a frame and we do not maintain a ref count
|
||||
*/
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsXULTextFrame::AddRef(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsXULTextFrame::Release(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTextFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
|
|
|
@ -22,12 +22,11 @@
|
|||
#ifndef nsXULTextFrame_h___
|
||||
#define nsXULTextFrame_h___
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsIBox.h"
|
||||
#include "nsXULLeafFrame.h"
|
||||
|
||||
class nsAccessKeyInfo;
|
||||
|
||||
class nsXULTextFrame : public nsLeafFrame, public nsIBox
|
||||
class nsXULTextFrame : public nsXULLeafFrame
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -37,9 +36,6 @@ public:
|
|||
|
||||
// nsIBox frame interface
|
||||
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);
|
||||
NS_IMETHOD InvalidateCache(nsIFrame* aChild);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
@ -86,10 +82,6 @@ protected:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
const nsRect& aTextRect);
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
|
||||
nsXULTextFrame();
|
||||
|
||||
|
@ -105,4 +97,4 @@ private:
|
|||
nsAccessKeyInfo* mAccessKeyInfo;
|
||||
}; // class nsXULTextFrame
|
||||
|
||||
#endif /* nsTitledButtonFrame_h___ */
|
||||
#endif /* nsXULTextFrame_h___ */
|
||||
|
|
|
@ -104,6 +104,7 @@ XUL_ATOM(titledbox, "titledbox")
|
|||
XUL_ATOM(title, "title")
|
||||
XUL_ATOM(titledboxContentPseudo, ":titledbox-content")
|
||||
|
||||
XUL_ATOM(stack, "stack")
|
||||
XUL_ATOM(deck, "deck")
|
||||
XUL_ATOM(tabcontrol, "tabcontrol")
|
||||
XUL_ATOM(tab, "tab")
|
||||
|
@ -124,6 +125,7 @@ XUL_ATOM(collapse, "collapse")
|
|||
XUL_ATOM(resizebefore, "resizebefore")
|
||||
XUL_ATOM(resizeafter, "resizeafter")
|
||||
XUL_ATOM(state, "state")
|
||||
XUL_ATOM(debug, "debug")
|
||||
|
||||
// toolbar & toolbar d&d atoms
|
||||
XUL_ATOM(ddDropLocation, "dd-droplocation")
|
||||
|
|
|
@ -28,7 +28,7 @@ Contributor(s): ______________________________________. -->
|
|||
|
||||
<!DOCTYPE window SYSTEM "chrome://navigator/locale/navigator.dtd" >
|
||||
|
||||
<window debug="false" id="main-window" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
<window id="main-window" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()"
|
||||
|
|
|
@ -44,47 +44,6 @@ window.dialog {
|
|||
|
||||
/******** Box *********/
|
||||
|
||||
|
||||
/* Conditional debug
|
||||
|
||||
*[debug="true"]:-moz-horizontal-box-debug {
|
||||
border: 2px solid blue;
|
||||
border-top-width: 10px;
|
||||
color: white;
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
*[debug="true"]:-moz-vertical-box-debug {
|
||||
border: 2px solid red;
|
||||
border-left-width: 10px;
|
||||
color: white;
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
*[debug="true"] *:-moz-horizontal-box-debug {
|
||||
border: 2px solid blue;
|
||||
border-top-width: 10px;
|
||||
color: white;
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
*[debug="true"] *:-moz-vertical-box-debug {
|
||||
border: 2px solid red;
|
||||
border-left-width: 10px;
|
||||
color: white;
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* comment this in to make all boxes show their
|
||||
debug info automatically. Otherwise use debug="true"
|
||||
to show it and use the rules above. */
|
||||
|
||||
:-moz-horizontal-box-debug {
|
||||
border: 2px solid blue;
|
||||
border-top-width: 10px;
|
||||
|
@ -101,6 +60,9 @@ window.dialog {
|
|||
color: white;
|
||||
}
|
||||
|
||||
box {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче