mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Fixed a problem in ConstructFrameByTag() where absolutely positioned elements
weren't handled properly
This commit is contained in:
parent
9ae6259485
commit
fa93923bcf
@ -1856,18 +1856,16 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
nsIAtom* aTag,
|
nsIAtom* aTag,
|
||||||
nsIStyleContext* aStyleContext,
|
nsIStyleContext* aStyleContext,
|
||||||
nsAbsoluteItems& aAbsoluteItems,
|
nsAbsoluteItems& aAbsoluteItems,
|
||||||
nsFrameItems& aFrameItems)
|
nsFrameItems& aFrameItems)
|
||||||
{
|
{
|
||||||
PRBool processChildren = PR_FALSE; // whether we should process child content
|
PRBool processChildren = PR_FALSE; // whether we should process child content
|
||||||
nsresult rv = NS_OK;
|
|
||||||
PRBool isAbsolutelyPositioned = PR_FALSE;
|
PRBool isAbsolutelyPositioned = PR_FALSE;
|
||||||
PRBool frameHasBeenInitialized = PR_FALSE;
|
PRBool frameHasBeenInitialized = PR_FALSE;
|
||||||
|
nsIFrame* newFrame = nsnull; // the frame we construct
|
||||||
// Initialize frame
|
nsresult rv = NS_OK;
|
||||||
nsIFrame* aNewFrame = nsnull;
|
|
||||||
|
|
||||||
if (nsLayoutAtoms::textTagName == aTag) {
|
if (nsLayoutAtoms::textTagName == aTag) {
|
||||||
rv = NS_NewTextFrame(aNewFrame);
|
rv = NS_NewTextFrame(newFrame);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsIHTMLContent *htmlContent;
|
nsIHTMLContent *htmlContent;
|
||||||
@ -1885,72 +1883,71 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// Create a frame based on the tag
|
// Create a frame based on the tag
|
||||||
if (nsHTMLAtoms::img == aTag) {
|
if (nsHTMLAtoms::img == aTag) {
|
||||||
rv = NS_NewImageFrame(aNewFrame);
|
rv = NS_NewImageFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::hr == aTag) {
|
else if (nsHTMLAtoms::hr == aTag) {
|
||||||
rv = NS_NewHRFrame(aNewFrame);
|
rv = NS_NewHRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::br == aTag) {
|
else if (nsHTMLAtoms::br == aTag) {
|
||||||
rv = NS_NewBRFrame(aNewFrame);
|
rv = NS_NewBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::wbr == aTag) {
|
else if (nsHTMLAtoms::wbr == aTag) {
|
||||||
rv = NS_NewWBRFrame(aNewFrame);
|
rv = NS_NewWBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::input == aTag) {
|
else if (nsHTMLAtoms::input == aTag) {
|
||||||
rv = CreateInputFrame(aContent, aNewFrame);
|
rv = CreateInputFrame(aContent, newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::textarea == aTag) {
|
else if (nsHTMLAtoms::textarea == aTag) {
|
||||||
rv = NS_NewTextControlFrame(aNewFrame);
|
rv = NS_NewTextControlFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::select == aTag) {
|
else if (nsHTMLAtoms::select == aTag) {
|
||||||
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
||||||
aTag, aStyleContext, aAbsoluteItems, aNewFrame,
|
aTag, aStyleContext, aAbsoluteItems, newFrame,
|
||||||
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::applet == aTag) {
|
else if (nsHTMLAtoms::applet == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::embed == aTag) {
|
else if (nsHTMLAtoms::embed == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::fieldset == aTag) {
|
else if (nsHTMLAtoms::fieldset == aTag) {
|
||||||
rv = NS_NewFieldSetFrame(aNewFrame);
|
rv = NS_NewFieldSetFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::legend == aTag) {
|
else if (nsHTMLAtoms::legend == aTag) {
|
||||||
rv = NS_NewLegendFrame(aNewFrame);
|
rv = NS_NewLegendFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::object == aTag) {
|
else if (nsHTMLAtoms::object == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
//rv = NS_NewObjectFrame(aContent, aParentFrame, aNewFrame);
|
|
||||||
nsIFrame *blockFrame;
|
nsIFrame *blockFrame;
|
||||||
NS_NewBlockFrame(blockFrame, 0);
|
NS_NewBlockFrame(blockFrame, 0);
|
||||||
blockFrame->Init(*aPresContext, aContent, aNewFrame, aStyleContext);
|
blockFrame->Init(*aPresContext, aContent, newFrame, aStyleContext);
|
||||||
aNewFrame = blockFrame;
|
newFrame = blockFrame;
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::form == aTag) {
|
else if (nsHTMLAtoms::form == aTag) {
|
||||||
rv = NS_NewFormFrame(aNewFrame);
|
rv = NS_NewFormFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::frameset == aTag) {
|
else if (nsHTMLAtoms::frameset == aTag) {
|
||||||
rv = NS_NewHTMLFramesetFrame(aNewFrame);
|
rv = NS_NewHTMLFramesetFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::iframe == aTag) {
|
else if (nsHTMLAtoms::iframe == aTag) {
|
||||||
rv = NS_NewHTMLFrameOuterFrame(aNewFrame);
|
rv = NS_NewHTMLFrameOuterFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::spacer == aTag) {
|
else if (nsHTMLAtoms::spacer == aTag) {
|
||||||
rv = NS_NewSpacerFrame(aNewFrame);
|
rv = NS_NewSpacerFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::button == aTag) {
|
else if (nsHTMLAtoms::button == aTag) {
|
||||||
rv = NS_NewHTMLButtonControlFrame(aNewFrame);
|
rv = NS_NewHTMLButtonControlFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::label == aTag) {
|
else if (nsHTMLAtoms::label == aTag) {
|
||||||
rv = NS_NewLabelFrame(aNewFrame);
|
rv = NS_NewLabelFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1958,44 +1955,44 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// If we succeeded in creating a frame then initialize it, process its
|
// If we succeeded in creating a frame then initialize it, process its
|
||||||
// children (if requested), and set the initial child list
|
// children (if requested), and set the initial child list
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||||
|
if (!frameHasBeenInitialized) {
|
||||||
// Add the frame to the list of items.
|
|
||||||
aFrameItems.AddChild(aNewFrame);
|
|
||||||
|
|
||||||
if (!frameHasBeenInitialized) {
|
|
||||||
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
||||||
aParentFrame;
|
aParentFrame;
|
||||||
aNewFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
newFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
||||||
|
|
||||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
|
||||||
aStyleContext, PR_FALSE);
|
aStyleContext, PR_FALSE);
|
||||||
|
|
||||||
// Process the child content if requested
|
// Process the child content if requested
|
||||||
nsFrameItems childItems;
|
nsFrameItems childItems;
|
||||||
if (processChildren) {
|
if (processChildren) {
|
||||||
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems,
|
rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
|
||||||
childItems);
|
childItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the frame's initial child list
|
// Set the frame's initial child list
|
||||||
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the frame is absolutely positioned then create a placeholder frame
|
// If the frame is absolutely positioned then create a placeholder frame
|
||||||
if (isAbsolutelyPositioned) {
|
if (isAbsolutelyPositioned) {
|
||||||
nsIFrame* placeholderFrame;
|
nsIFrame* placeholderFrame;
|
||||||
|
|
||||||
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext,
|
CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
|
||||||
aParentFrame, placeholderFrame);
|
aParentFrame, placeholderFrame);
|
||||||
|
|
||||||
// Add the absolutely positioned frame to its containing block's list
|
// Add the absolutely positioned frame to its containing block's list
|
||||||
// of child frames
|
// of child frames
|
||||||
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
|
aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
|
||||||
|
|
||||||
// Add the placeholder frame to the flow
|
// Add the placeholder frame to the flow
|
||||||
aFrameItems.AddChild(placeholderFrame);
|
aFrameItems.AddChild(placeholderFrame);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Add the newly constructed frame to the flow
|
||||||
|
aFrameItems.AddChild(newFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,18 +1856,16 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
nsIAtom* aTag,
|
nsIAtom* aTag,
|
||||||
nsIStyleContext* aStyleContext,
|
nsIStyleContext* aStyleContext,
|
||||||
nsAbsoluteItems& aAbsoluteItems,
|
nsAbsoluteItems& aAbsoluteItems,
|
||||||
nsFrameItems& aFrameItems)
|
nsFrameItems& aFrameItems)
|
||||||
{
|
{
|
||||||
PRBool processChildren = PR_FALSE; // whether we should process child content
|
PRBool processChildren = PR_FALSE; // whether we should process child content
|
||||||
nsresult rv = NS_OK;
|
|
||||||
PRBool isAbsolutelyPositioned = PR_FALSE;
|
PRBool isAbsolutelyPositioned = PR_FALSE;
|
||||||
PRBool frameHasBeenInitialized = PR_FALSE;
|
PRBool frameHasBeenInitialized = PR_FALSE;
|
||||||
|
nsIFrame* newFrame = nsnull; // the frame we construct
|
||||||
// Initialize frame
|
nsresult rv = NS_OK;
|
||||||
nsIFrame* aNewFrame = nsnull;
|
|
||||||
|
|
||||||
if (nsLayoutAtoms::textTagName == aTag) {
|
if (nsLayoutAtoms::textTagName == aTag) {
|
||||||
rv = NS_NewTextFrame(aNewFrame);
|
rv = NS_NewTextFrame(newFrame);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsIHTMLContent *htmlContent;
|
nsIHTMLContent *htmlContent;
|
||||||
@ -1885,72 +1883,71 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// Create a frame based on the tag
|
// Create a frame based on the tag
|
||||||
if (nsHTMLAtoms::img == aTag) {
|
if (nsHTMLAtoms::img == aTag) {
|
||||||
rv = NS_NewImageFrame(aNewFrame);
|
rv = NS_NewImageFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::hr == aTag) {
|
else if (nsHTMLAtoms::hr == aTag) {
|
||||||
rv = NS_NewHRFrame(aNewFrame);
|
rv = NS_NewHRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::br == aTag) {
|
else if (nsHTMLAtoms::br == aTag) {
|
||||||
rv = NS_NewBRFrame(aNewFrame);
|
rv = NS_NewBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::wbr == aTag) {
|
else if (nsHTMLAtoms::wbr == aTag) {
|
||||||
rv = NS_NewWBRFrame(aNewFrame);
|
rv = NS_NewWBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::input == aTag) {
|
else if (nsHTMLAtoms::input == aTag) {
|
||||||
rv = CreateInputFrame(aContent, aNewFrame);
|
rv = CreateInputFrame(aContent, newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::textarea == aTag) {
|
else if (nsHTMLAtoms::textarea == aTag) {
|
||||||
rv = NS_NewTextControlFrame(aNewFrame);
|
rv = NS_NewTextControlFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::select == aTag) {
|
else if (nsHTMLAtoms::select == aTag) {
|
||||||
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
||||||
aTag, aStyleContext, aAbsoluteItems, aNewFrame,
|
aTag, aStyleContext, aAbsoluteItems, newFrame,
|
||||||
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::applet == aTag) {
|
else if (nsHTMLAtoms::applet == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::embed == aTag) {
|
else if (nsHTMLAtoms::embed == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::fieldset == aTag) {
|
else if (nsHTMLAtoms::fieldset == aTag) {
|
||||||
rv = NS_NewFieldSetFrame(aNewFrame);
|
rv = NS_NewFieldSetFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::legend == aTag) {
|
else if (nsHTMLAtoms::legend == aTag) {
|
||||||
rv = NS_NewLegendFrame(aNewFrame);
|
rv = NS_NewLegendFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::object == aTag) {
|
else if (nsHTMLAtoms::object == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
//rv = NS_NewObjectFrame(aContent, aParentFrame, aNewFrame);
|
|
||||||
nsIFrame *blockFrame;
|
nsIFrame *blockFrame;
|
||||||
NS_NewBlockFrame(blockFrame, 0);
|
NS_NewBlockFrame(blockFrame, 0);
|
||||||
blockFrame->Init(*aPresContext, aContent, aNewFrame, aStyleContext);
|
blockFrame->Init(*aPresContext, aContent, newFrame, aStyleContext);
|
||||||
aNewFrame = blockFrame;
|
newFrame = blockFrame;
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::form == aTag) {
|
else if (nsHTMLAtoms::form == aTag) {
|
||||||
rv = NS_NewFormFrame(aNewFrame);
|
rv = NS_NewFormFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::frameset == aTag) {
|
else if (nsHTMLAtoms::frameset == aTag) {
|
||||||
rv = NS_NewHTMLFramesetFrame(aNewFrame);
|
rv = NS_NewHTMLFramesetFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::iframe == aTag) {
|
else if (nsHTMLAtoms::iframe == aTag) {
|
||||||
rv = NS_NewHTMLFrameOuterFrame(aNewFrame);
|
rv = NS_NewHTMLFrameOuterFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::spacer == aTag) {
|
else if (nsHTMLAtoms::spacer == aTag) {
|
||||||
rv = NS_NewSpacerFrame(aNewFrame);
|
rv = NS_NewSpacerFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::button == aTag) {
|
else if (nsHTMLAtoms::button == aTag) {
|
||||||
rv = NS_NewHTMLButtonControlFrame(aNewFrame);
|
rv = NS_NewHTMLButtonControlFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::label == aTag) {
|
else if (nsHTMLAtoms::label == aTag) {
|
||||||
rv = NS_NewLabelFrame(aNewFrame);
|
rv = NS_NewLabelFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1958,44 +1955,44 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// If we succeeded in creating a frame then initialize it, process its
|
// If we succeeded in creating a frame then initialize it, process its
|
||||||
// children (if requested), and set the initial child list
|
// children (if requested), and set the initial child list
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||||
|
if (!frameHasBeenInitialized) {
|
||||||
// Add the frame to the list of items.
|
|
||||||
aFrameItems.AddChild(aNewFrame);
|
|
||||||
|
|
||||||
if (!frameHasBeenInitialized) {
|
|
||||||
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
||||||
aParentFrame;
|
aParentFrame;
|
||||||
aNewFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
newFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
||||||
|
|
||||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
|
||||||
aStyleContext, PR_FALSE);
|
aStyleContext, PR_FALSE);
|
||||||
|
|
||||||
// Process the child content if requested
|
// Process the child content if requested
|
||||||
nsFrameItems childItems;
|
nsFrameItems childItems;
|
||||||
if (processChildren) {
|
if (processChildren) {
|
||||||
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems,
|
rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
|
||||||
childItems);
|
childItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the frame's initial child list
|
// Set the frame's initial child list
|
||||||
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the frame is absolutely positioned then create a placeholder frame
|
// If the frame is absolutely positioned then create a placeholder frame
|
||||||
if (isAbsolutelyPositioned) {
|
if (isAbsolutelyPositioned) {
|
||||||
nsIFrame* placeholderFrame;
|
nsIFrame* placeholderFrame;
|
||||||
|
|
||||||
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext,
|
CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
|
||||||
aParentFrame, placeholderFrame);
|
aParentFrame, placeholderFrame);
|
||||||
|
|
||||||
// Add the absolutely positioned frame to its containing block's list
|
// Add the absolutely positioned frame to its containing block's list
|
||||||
// of child frames
|
// of child frames
|
||||||
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
|
aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
|
||||||
|
|
||||||
// Add the placeholder frame to the flow
|
// Add the placeholder frame to the flow
|
||||||
aFrameItems.AddChild(placeholderFrame);
|
aFrameItems.AddChild(placeholderFrame);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Add the newly constructed frame to the flow
|
||||||
|
aFrameItems.AddChild(newFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,18 +1856,16 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
nsIAtom* aTag,
|
nsIAtom* aTag,
|
||||||
nsIStyleContext* aStyleContext,
|
nsIStyleContext* aStyleContext,
|
||||||
nsAbsoluteItems& aAbsoluteItems,
|
nsAbsoluteItems& aAbsoluteItems,
|
||||||
nsFrameItems& aFrameItems)
|
nsFrameItems& aFrameItems)
|
||||||
{
|
{
|
||||||
PRBool processChildren = PR_FALSE; // whether we should process child content
|
PRBool processChildren = PR_FALSE; // whether we should process child content
|
||||||
nsresult rv = NS_OK;
|
|
||||||
PRBool isAbsolutelyPositioned = PR_FALSE;
|
PRBool isAbsolutelyPositioned = PR_FALSE;
|
||||||
PRBool frameHasBeenInitialized = PR_FALSE;
|
PRBool frameHasBeenInitialized = PR_FALSE;
|
||||||
|
nsIFrame* newFrame = nsnull; // the frame we construct
|
||||||
// Initialize frame
|
nsresult rv = NS_OK;
|
||||||
nsIFrame* aNewFrame = nsnull;
|
|
||||||
|
|
||||||
if (nsLayoutAtoms::textTagName == aTag) {
|
if (nsLayoutAtoms::textTagName == aTag) {
|
||||||
rv = NS_NewTextFrame(aNewFrame);
|
rv = NS_NewTextFrame(newFrame);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsIHTMLContent *htmlContent;
|
nsIHTMLContent *htmlContent;
|
||||||
@ -1885,72 +1883,71 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// Create a frame based on the tag
|
// Create a frame based on the tag
|
||||||
if (nsHTMLAtoms::img == aTag) {
|
if (nsHTMLAtoms::img == aTag) {
|
||||||
rv = NS_NewImageFrame(aNewFrame);
|
rv = NS_NewImageFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::hr == aTag) {
|
else if (nsHTMLAtoms::hr == aTag) {
|
||||||
rv = NS_NewHRFrame(aNewFrame);
|
rv = NS_NewHRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::br == aTag) {
|
else if (nsHTMLAtoms::br == aTag) {
|
||||||
rv = NS_NewBRFrame(aNewFrame);
|
rv = NS_NewBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::wbr == aTag) {
|
else if (nsHTMLAtoms::wbr == aTag) {
|
||||||
rv = NS_NewWBRFrame(aNewFrame);
|
rv = NS_NewWBRFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::input == aTag) {
|
else if (nsHTMLAtoms::input == aTag) {
|
||||||
rv = CreateInputFrame(aContent, aNewFrame);
|
rv = CreateInputFrame(aContent, newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::textarea == aTag) {
|
else if (nsHTMLAtoms::textarea == aTag) {
|
||||||
rv = NS_NewTextControlFrame(aNewFrame);
|
rv = NS_NewTextControlFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::select == aTag) {
|
else if (nsHTMLAtoms::select == aTag) {
|
||||||
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,
|
||||||
aTag, aStyleContext, aAbsoluteItems, aNewFrame,
|
aTag, aStyleContext, aAbsoluteItems, newFrame,
|
||||||
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::applet == aTag) {
|
else if (nsHTMLAtoms::applet == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::embed == aTag) {
|
else if (nsHTMLAtoms::embed == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::fieldset == aTag) {
|
else if (nsHTMLAtoms::fieldset == aTag) {
|
||||||
rv = NS_NewFieldSetFrame(aNewFrame);
|
rv = NS_NewFieldSetFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::legend == aTag) {
|
else if (nsHTMLAtoms::legend == aTag) {
|
||||||
rv = NS_NewLegendFrame(aNewFrame);
|
rv = NS_NewLegendFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::object == aTag) {
|
else if (nsHTMLAtoms::object == aTag) {
|
||||||
rv = NS_NewObjectFrame(aNewFrame);
|
rv = NS_NewObjectFrame(newFrame);
|
||||||
//rv = NS_NewObjectFrame(aContent, aParentFrame, aNewFrame);
|
|
||||||
nsIFrame *blockFrame;
|
nsIFrame *blockFrame;
|
||||||
NS_NewBlockFrame(blockFrame, 0);
|
NS_NewBlockFrame(blockFrame, 0);
|
||||||
blockFrame->Init(*aPresContext, aContent, aNewFrame, aStyleContext);
|
blockFrame->Init(*aPresContext, aContent, newFrame, aStyleContext);
|
||||||
aNewFrame = blockFrame;
|
newFrame = blockFrame;
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::form == aTag) {
|
else if (nsHTMLAtoms::form == aTag) {
|
||||||
rv = NS_NewFormFrame(aNewFrame);
|
rv = NS_NewFormFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::frameset == aTag) {
|
else if (nsHTMLAtoms::frameset == aTag) {
|
||||||
rv = NS_NewHTMLFramesetFrame(aNewFrame);
|
rv = NS_NewHTMLFramesetFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::iframe == aTag) {
|
else if (nsHTMLAtoms::iframe == aTag) {
|
||||||
rv = NS_NewHTMLFrameOuterFrame(aNewFrame);
|
rv = NS_NewHTMLFrameOuterFrame(newFrame);
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::spacer == aTag) {
|
else if (nsHTMLAtoms::spacer == aTag) {
|
||||||
rv = NS_NewSpacerFrame(aNewFrame);
|
rv = NS_NewSpacerFrame(newFrame);
|
||||||
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
isAbsolutelyPositioned = PR_FALSE; // don't absolutely position
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::button == aTag) {
|
else if (nsHTMLAtoms::button == aTag) {
|
||||||
rv = NS_NewHTMLButtonControlFrame(aNewFrame);
|
rv = NS_NewHTMLButtonControlFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::label == aTag) {
|
else if (nsHTMLAtoms::label == aTag) {
|
||||||
rv = NS_NewLabelFrame(aNewFrame);
|
rv = NS_NewLabelFrame(newFrame);
|
||||||
processChildren = PR_TRUE;
|
processChildren = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1958,44 +1955,44 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
// If we succeeded in creating a frame then initialize it, process its
|
// If we succeeded in creating a frame then initialize it, process its
|
||||||
// children (if requested), and set the initial child list
|
// children (if requested), and set the initial child list
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
|
||||||
|
if (!frameHasBeenInitialized) {
|
||||||
// Add the frame to the list of items.
|
|
||||||
aFrameItems.AddChild(aNewFrame);
|
|
||||||
|
|
||||||
if (!frameHasBeenInitialized) {
|
|
||||||
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
|
||||||
aParentFrame;
|
aParentFrame;
|
||||||
aNewFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
newFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);
|
||||||
|
|
||||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
|
||||||
aStyleContext, PR_FALSE);
|
aStyleContext, PR_FALSE);
|
||||||
|
|
||||||
// Process the child content if requested
|
// Process the child content if requested
|
||||||
nsFrameItems childItems;
|
nsFrameItems childItems;
|
||||||
if (processChildren) {
|
if (processChildren) {
|
||||||
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems,
|
rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
|
||||||
childItems);
|
childItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the frame's initial child list
|
// Set the frame's initial child list
|
||||||
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the frame is absolutely positioned then create a placeholder frame
|
// If the frame is absolutely positioned then create a placeholder frame
|
||||||
if (isAbsolutelyPositioned) {
|
if (isAbsolutelyPositioned) {
|
||||||
nsIFrame* placeholderFrame;
|
nsIFrame* placeholderFrame;
|
||||||
|
|
||||||
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext,
|
CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
|
||||||
aParentFrame, placeholderFrame);
|
aParentFrame, placeholderFrame);
|
||||||
|
|
||||||
// Add the absolutely positioned frame to its containing block's list
|
// Add the absolutely positioned frame to its containing block's list
|
||||||
// of child frames
|
// of child frames
|
||||||
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
|
aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
|
||||||
|
|
||||||
// Add the placeholder frame to the flow
|
// Add the placeholder frame to the flow
|
||||||
aFrameItems.AddChild(placeholderFrame);
|
aFrameItems.AddChild(placeholderFrame);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Add the newly constructed frame to the flow
|
||||||
|
aFrameItems.AddChild(newFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user