зеркало из https://github.com/mozilla/pjs.git
Changed view creation to occur when frame initialization occurs
This commit is contained in:
Родитель
ca7d6e5f44
Коммит
80545a3bd4
|
@ -42,6 +42,7 @@
|
|||
#include "nsTableOuterFrame.h"
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLStyleSheetIID, NS_IHTML_STYLE_SHEET_IID);
|
||||
static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID);
|
||||
|
@ -1088,7 +1089,12 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
// Create an anonymous table outer frame which holds the caption and the
|
||||
// table frame
|
||||
NS_NewTableOuterFrame(aNewFrame);
|
||||
|
||||
// Init the table outer frame and see if we need to create a view, e.g.
|
||||
// the frame is absolutely positioned
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Create the inner table frame
|
||||
NS_NewTableFrame(innerFrame);
|
||||
|
@ -1358,7 +1364,7 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
nsIFrame* scrollFrame;
|
||||
nsIFrame* pageSequenceFrame;
|
||||
|
||||
// XXX This isn't the correct style context pseudo element to use...
|
||||
// XXX This isn't the correct pseudo element style context to use...
|
||||
nsIStyleContext* pseudoStyle;
|
||||
pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsHTMLAtoms::columnPseudo, aStyleContext);
|
||||
|
@ -1374,9 +1380,11 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIFrame* childList;
|
||||
|
||||
// Initialize the frame
|
||||
// Initialize the frame and force it to have a view
|
||||
pageSequenceFrame->Init(*aPresContext, aContent, scrollFrame, pseudoStyle);
|
||||
NS_RELEASE(pseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||
pseudoStyle, PR_TRUE);
|
||||
|
||||
// Process the child content, and set the page sequence frame's initial
|
||||
// child list
|
||||
|
@ -1422,13 +1430,13 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
rv = NS_NewScrollFrame(scrollFrame);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
// XXX We should probably use a different pseudo style context...
|
||||
// Initialize the scroll frame
|
||||
scrollFrame->Init(*aPresContext, nsnull, aParentFrame, aRootPseudoStyle);
|
||||
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
nsIStyleContext* scrolledPseudoStyle;
|
||||
nsIFrame* wrapperFrame;
|
||||
nsIFrame* wrapperFrame;
|
||||
|
||||
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
|
||||
|
@ -1436,7 +1444,11 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
|
||||
// Create a body frame to wrap the document element
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_THE_BODY|NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize it and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, nsnull, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// Construct a frame for the document element and process its children
|
||||
nsIFrame* docElementFrame;
|
||||
|
@ -1601,6 +1613,10 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1716,6 +1732,10 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1923,11 +1943,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
|||
aContent->CanContainChildren(isContainer);
|
||||
if (isContainer && (tag != nsHTMLAtoms::body)) {
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize the frame and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, aContent, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// The wrapped frame also gets a pseudo style context, but it doesn't
|
||||
// inherit any background properties. It does inherit the 'display'
|
||||
// property (very important that it does)
|
||||
// property (it's very important that it does)
|
||||
nsIStyleContext* wrappedPseudoStyle;
|
||||
wrappedPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(aContent, nsHTMLAtoms::wrappedFramePseudo,
|
||||
|
|
|
@ -402,6 +402,16 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// See if the frame is a scrolled frame
|
||||
if (!aForce) {
|
||||
nsIAtom* pseudoTag;
|
||||
aStyleContext->GetPseudoType(pseudoTag);
|
||||
if (pseudoTag == nsHTMLAtoms::scrolledContentPseudo) {
|
||||
aForce = PR_TRUE;
|
||||
}
|
||||
NS_IF_RELEASE(pseudoTag);
|
||||
}
|
||||
|
||||
if (aForce) {
|
||||
// Create a view
|
||||
nsIFrame* parent;
|
||||
|
|
|
@ -402,6 +402,16 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// See if the frame is a scrolled frame
|
||||
if (!aForce) {
|
||||
nsIAtom* pseudoTag;
|
||||
aStyleContext->GetPseudoType(pseudoTag);
|
||||
if (pseudoTag == nsHTMLAtoms::scrolledContentPseudo) {
|
||||
aForce = PR_TRUE;
|
||||
}
|
||||
NS_IF_RELEASE(pseudoTag);
|
||||
}
|
||||
|
||||
if (aForce) {
|
||||
// Create a view
|
||||
nsIFrame* parent;
|
||||
|
|
|
@ -46,6 +46,15 @@ static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
|||
*/
|
||||
class nsScrollFrame : public nsHTMLContainerFrame {
|
||||
public:
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext);
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
|
@ -67,6 +76,78 @@ private:
|
|||
nsresult CreateScrollingView();
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aStyleContext)
|
||||
{
|
||||
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent,
|
||||
aParent, aStyleContext);
|
||||
|
||||
// Create the scrolling view
|
||||
CreateScrollingView();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName,
|
||||
aChildList);
|
||||
|
||||
// Get our view
|
||||
nsIView* myView;
|
||||
nsIViewManager* viewManager;
|
||||
|
||||
GetView(myView);
|
||||
NS_ASSERTION(nsnull != myView, "no view");
|
||||
myView->GetViewManager(viewManager);
|
||||
|
||||
// Get the scrolled frame's view. Note that it must already have a view
|
||||
nsIView* scrolledView;
|
||||
|
||||
mFirstChild->GetView(scrolledView);
|
||||
NS_ASSERTION(nsnull != scrolledView, "no view");
|
||||
|
||||
// If the scrolled view is currently inserted in the view hierarchy then
|
||||
// remove it. We'll add it to the scrolling view below
|
||||
nsIView* parentView;
|
||||
scrolledView->GetParent(parentView);
|
||||
if (nsnull != parentView) {
|
||||
viewManager->RemoveChild(parentView, scrolledView);
|
||||
}
|
||||
|
||||
// Set it as the scrolling view's scrolled view
|
||||
nsIScrollableView* scrollingView;
|
||||
myView->QueryInterface(kScrollViewIID, (void**)&scrollingView);
|
||||
scrollingView->SetScrolledView(scrolledView);
|
||||
|
||||
// Get the color style info
|
||||
const nsStyleColor* color;
|
||||
mFirstChild->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color);
|
||||
|
||||
// If the background is transparent then inform the view manager
|
||||
if (NS_STYLE_BG_COLOR_TRANSPARENT & color->mBackgroundFlags) {
|
||||
viewManager->SetViewContentTransparency(scrolledView, PR_TRUE);
|
||||
}
|
||||
|
||||
// Set the opacity
|
||||
viewManager->SetViewOpacity(scrolledView, color->mOpacity);
|
||||
|
||||
// We need to allow the view's position to be different than the
|
||||
// frame's position
|
||||
nsFrameState state;
|
||||
mFirstChild->GetFrameState(state);
|
||||
state &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
|
||||
mFirstChild->SetFrameState(state);
|
||||
|
||||
NS_RELEASE(viewManager);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScrollFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
|
@ -148,11 +229,9 @@ nsScrollFrame::CreateScrollingView()
|
|||
// Set the view's opacity
|
||||
viewManager->SetViewOpacity(view, color->mOpacity);
|
||||
|
||||
// If the background is transparent then inform the view manager
|
||||
PRBool isTransparent = (NS_STYLE_BG_COLOR_TRANSPARENT & color->mBackgroundFlags);
|
||||
if (isTransparent) {
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
}
|
||||
// Because we only paintg the border and we don't paint a background,
|
||||
// inform the view manager that we have transparent content
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
|
||||
// Get the nsIScrollableView interface
|
||||
nsIScrollableView* scrollingView;
|
||||
|
@ -176,35 +255,6 @@ nsScrollFrame::CreateScrollingView()
|
|||
|
||||
// Remember our view
|
||||
SetView(view);
|
||||
|
||||
// Create a view for the scroll view frame
|
||||
nsIView* scrolledView;
|
||||
rv = nsRepository::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&scrolledView);
|
||||
if (NS_OK == rv) {
|
||||
// Bind the view to the frame
|
||||
mFirstChild->SetView(scrolledView);
|
||||
|
||||
// Initialize the view
|
||||
scrolledView->Init(viewManager, nsRect(0, 0, 0, 0), parentView);
|
||||
|
||||
// Set it as the scrolling view's scrolled view
|
||||
scrollingView->SetScrolledView(scrolledView);
|
||||
|
||||
// If the background is transparent then inform the view manager
|
||||
if (isTransparent) {
|
||||
viewManager->SetViewContentTransparency(scrolledView, PR_TRUE);
|
||||
}
|
||||
|
||||
// Set the opacity
|
||||
viewManager->SetViewOpacity(scrolledView, color->mOpacity);
|
||||
|
||||
// We need to allow the view's position to be different than the
|
||||
// frame's position
|
||||
nsFrameState state;
|
||||
mFirstChild->GetFrameState(state);
|
||||
state &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
|
||||
mFirstChild->SetFrameState(state);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(viewManager);
|
||||
|
@ -225,14 +275,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nsIFrame* targetFrame;
|
||||
nsIFrame* nextFrame;
|
||||
|
||||
// Special handling for initial reflow and incremental reflow
|
||||
switch (aReflowState.reason) {
|
||||
case eReflowReason_Initial:
|
||||
// Create the scrolling view and the scrolled view
|
||||
CreateScrollingView();
|
||||
break;
|
||||
|
||||
case eReflowReason_Incremental:
|
||||
// Special handling for incremental reflow
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
// See whether we're the target of the reflow command
|
||||
aReflowState.reflowCommand->GetTarget(targetFrame);
|
||||
if (this == targetFrame) {
|
||||
|
@ -255,7 +299,6 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
// child frame
|
||||
aReflowState.reflowCommand->GetNext(nextFrame);
|
||||
NS_ASSERTION(nextFrame == mFirstChild, "unexpected reflow command next-frame");
|
||||
break;
|
||||
}
|
||||
|
||||
// Calculate the amount of space needed for borders
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsTableOuterFrame.h"
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLStyleSheetIID, NS_IHTML_STYLE_SHEET_IID);
|
||||
static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID);
|
||||
|
@ -1088,7 +1089,12 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
// Create an anonymous table outer frame which holds the caption and the
|
||||
// table frame
|
||||
NS_NewTableOuterFrame(aNewFrame);
|
||||
|
||||
// Init the table outer frame and see if we need to create a view, e.g.
|
||||
// the frame is absolutely positioned
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Create the inner table frame
|
||||
NS_NewTableFrame(innerFrame);
|
||||
|
@ -1358,7 +1364,7 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
nsIFrame* scrollFrame;
|
||||
nsIFrame* pageSequenceFrame;
|
||||
|
||||
// XXX This isn't the correct style context pseudo element to use...
|
||||
// XXX This isn't the correct pseudo element style context to use...
|
||||
nsIStyleContext* pseudoStyle;
|
||||
pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsHTMLAtoms::columnPseudo, aStyleContext);
|
||||
|
@ -1374,9 +1380,11 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIFrame* childList;
|
||||
|
||||
// Initialize the frame
|
||||
// Initialize the frame and force it to have a view
|
||||
pageSequenceFrame->Init(*aPresContext, aContent, scrollFrame, pseudoStyle);
|
||||
NS_RELEASE(pseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||
pseudoStyle, PR_TRUE);
|
||||
|
||||
// Process the child content, and set the page sequence frame's initial
|
||||
// child list
|
||||
|
@ -1422,13 +1430,13 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
rv = NS_NewScrollFrame(scrollFrame);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
// XXX We should probably use a different pseudo style context...
|
||||
// Initialize the scroll frame
|
||||
scrollFrame->Init(*aPresContext, nsnull, aParentFrame, aRootPseudoStyle);
|
||||
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
nsIStyleContext* scrolledPseudoStyle;
|
||||
nsIFrame* wrapperFrame;
|
||||
nsIFrame* wrapperFrame;
|
||||
|
||||
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
|
||||
|
@ -1436,7 +1444,11 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
|
||||
// Create a body frame to wrap the document element
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_THE_BODY|NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize it and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, nsnull, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// Construct a frame for the document element and process its children
|
||||
nsIFrame* docElementFrame;
|
||||
|
@ -1601,6 +1613,10 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1716,6 +1732,10 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1923,11 +1943,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
|||
aContent->CanContainChildren(isContainer);
|
||||
if (isContainer && (tag != nsHTMLAtoms::body)) {
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize the frame and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, aContent, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// The wrapped frame also gets a pseudo style context, but it doesn't
|
||||
// inherit any background properties. It does inherit the 'display'
|
||||
// property (very important that it does)
|
||||
// property (it's very important that it does)
|
||||
nsIStyleContext* wrappedPseudoStyle;
|
||||
wrappedPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(aContent, nsHTMLAtoms::wrappedFramePseudo,
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsTableOuterFrame.h"
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLStyleSheetIID, NS_IHTML_STYLE_SHEET_IID);
|
||||
static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID);
|
||||
|
@ -1088,7 +1089,12 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
// Create an anonymous table outer frame which holds the caption and the
|
||||
// table frame
|
||||
NS_NewTableOuterFrame(aNewFrame);
|
||||
|
||||
// Init the table outer frame and see if we need to create a view, e.g.
|
||||
// the frame is absolutely positioned
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Create the inner table frame
|
||||
NS_NewTableFrame(innerFrame);
|
||||
|
@ -1358,7 +1364,7 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
nsIFrame* scrollFrame;
|
||||
nsIFrame* pageSequenceFrame;
|
||||
|
||||
// XXX This isn't the correct style context pseudo element to use...
|
||||
// XXX This isn't the correct pseudo element style context to use...
|
||||
nsIStyleContext* pseudoStyle;
|
||||
pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsHTMLAtoms::columnPseudo, aStyleContext);
|
||||
|
@ -1374,9 +1380,11 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIFrame* childList;
|
||||
|
||||
// Initialize the frame
|
||||
// Initialize the frame and force it to have a view
|
||||
pageSequenceFrame->Init(*aPresContext, aContent, scrollFrame, pseudoStyle);
|
||||
NS_RELEASE(pseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageSequenceFrame,
|
||||
pseudoStyle, PR_TRUE);
|
||||
|
||||
// Process the child content, and set the page sequence frame's initial
|
||||
// child list
|
||||
|
@ -1422,13 +1430,13 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
rv = NS_NewScrollFrame(scrollFrame);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
// XXX We should probably use a different pseudo style context...
|
||||
// Initialize the scroll frame
|
||||
scrollFrame->Init(*aPresContext, nsnull, aParentFrame, aRootPseudoStyle);
|
||||
|
||||
// The scroll frame gets the root pseudo style context, and the scrolled
|
||||
// frame gets a SCROLLED-CONTENT pseudo element style context.
|
||||
nsIStyleContext* scrolledPseudoStyle;
|
||||
nsIFrame* wrapperFrame;
|
||||
nsIFrame* wrapperFrame;
|
||||
|
||||
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
|
||||
|
@ -1436,7 +1444,11 @@ HTMLStyleSheetImpl::ConstructXMLRootDescendants(nsIPresContext* aPresContext,
|
|||
|
||||
// Create a body frame to wrap the document element
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_THE_BODY|NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize it and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, nsnull, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// Construct a frame for the document element and process its children
|
||||
nsIFrame* docElementFrame;
|
||||
|
@ -1601,6 +1613,10 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1716,6 +1732,10 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
|
|||
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) {
|
||||
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
|
||||
|
||||
// See if we need to create a view, e.g. the frame is absolutely positioned
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame,
|
||||
aStyleContext, PR_FALSE);
|
||||
|
||||
// Process the child content if requested
|
||||
nsIFrame* childList = nsnull;
|
||||
if (processChildren) {
|
||||
|
@ -1923,11 +1943,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
|
|||
aContent->CanContainChildren(isContainer);
|
||||
if (isContainer && (tag != nsHTMLAtoms::body)) {
|
||||
NS_NewBodyFrame(wrapperFrame, NS_BODY_SHRINK_WRAP);
|
||||
|
||||
// Initialize the frame and force it to have a view
|
||||
wrapperFrame->Init(*aPresContext, aContent, scrollFrame, scrolledPseudoStyle);
|
||||
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, wrapperFrame,
|
||||
scrolledPseudoStyle, PR_TRUE);
|
||||
|
||||
// The wrapped frame also gets a pseudo style context, but it doesn't
|
||||
// inherit any background properties. It does inherit the 'display'
|
||||
// property (very important that it does)
|
||||
// property (it's very important that it does)
|
||||
nsIStyleContext* wrappedPseudoStyle;
|
||||
wrappedPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
|
||||
(aContent, nsHTMLAtoms::wrappedFramePseudo,
|
||||
|
|
Загрузка…
Ссылка в новой задаче