Cleaned up the way construction of the root frame happens for XML documents.

We no longer create a pseudo root element
This commit is contained in:
troy%netscape.com 1998-11-12 23:03:35 +00:00
Родитель 1e2f6b530f
Коммит 2b86b49c95
31 изменённых файлов: 370 добавлений и 234 удалений

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

@ -239,6 +239,7 @@ nsIAtom* nsHTMLAtoms::vspace;
nsIAtom* nsHTMLAtoms::wbr;
nsIAtom* nsHTMLAtoms::width;
nsIAtom* nsHTMLAtoms::wrap;
nsIAtom* nsHTMLAtoms::xmlRootPseudo;
nsIAtom* nsHTMLAtoms::zindex;
@ -466,6 +467,7 @@ void nsHTMLAtoms::AddrefAtoms()
wbr = NS_NewAtom("WBR");
width = NS_NewAtom("WIDTH");
wrap = NS_NewAtom("WRAP");
xmlRootPseudo = NS_NewAtom(":XML-ROOT");
zindex = NS_NewAtom("ZINDEX");
}
++gRefCnt;
@ -684,6 +686,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(wbr);
NS_RELEASE(width);
NS_RELEASE(wrap);
NS_RELEASE(xmlRootPseudo);
NS_RELEASE(zindex);
}
}

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

@ -278,6 +278,8 @@ public:
static nsIAtom* width;
static nsIAtom* wrap;
static nsIAtom* xmlRootPseudo;
static nsIAtom* zindex;
};

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

@ -300,10 +300,10 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -1210,13 +1210,17 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
}
nsresult
HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
HTMLStyleSheetImpl::ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
{
// Create the root frame
nsresult rv = NS_NewHTMLFrame(aContent, nsnull, aNewFrame);
// Create the root frame. It gets a special pseudo element style
nsIStyleContext* rootPseudoStyle;
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
nsHTMLAtoms::xmlRootPseudo, nsnull);
nsresult rv = NS_NewHTMLFrame(nsnull, nsnull, aNewFrame);
if (NS_SUCCEEDED(rv)) {
// Bind root frame to root view (and root window)
@ -1230,33 +1234,38 @@ HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
NS_RELEASE(viewManager);
// Set the style context
aNewFrame->SetStyleContext(aPresContext, aStyleContext);
aNewFrame->SetStyleContext(aPresContext, rootPseudoStyle);
// Wrap the document element in a scroll frame
nsIFrame* scrollFrame;
if (NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame))) {
if (NS_SUCCEEDED(NS_NewScrollFrame(nsnull, aNewFrame, scrollFrame))) {
// The scroll frame gets the original style context, and the scrolled
// frame gets a SCROLLED-CONTENT pseudo element style context.
scrollFrame->SetStyleContext(aPresContext, aStyleContext);
scrollFrame->SetStyleContext(aPresContext, rootPseudoStyle);
nsIStyleContext* scrolledPseudoStyle;
nsIFrame* wrapperFrame;
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
(aContent,
nsHTMLAtoms::scrolledContentPseudo,
aStyleContext);
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
rootPseudoStyle);
// Create a body frame to wrap the document element
NS_NewBodyFrame(aContent, scrollFrame,
wrapperFrame, NS_BODY_SHRINK_WRAP);
NS_NewBodyFrame(nsnull, scrollFrame, wrapperFrame, NS_BODY_SHRINK_WRAP);
wrapperFrame->SetStyleContext(aPresContext, scrolledPseudoStyle);
// Construct a frame for the document element
nsIFrame* docElementFrame;
ConstructFrame(aPresContext, aContent, wrapperFrame, docElementFrame);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
#if 0
// Process the child content, and set the frame's initial child list
nsIFrame* childList;
rv = ProcessChildren(aPresContext, wrapperFrame, aContent, childList);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, childList);
#endif
// Set the scroll frame's initial child list
scrollFrame->SetInitialChildList(*aPresContext, nsnull, wrapperFrame);
@ -1631,8 +1640,8 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
else {
// Construct the root frame object for XML
rv = ConstructXMLRootFrames(aPresContext, aContent, styleContext,
aFrameSubTree);
rv = ConstructXMLRootFrame(aPresContext, aContent, styleContext,
aFrameSubTree);
NS_RELEASE(xmlDocument);
}
NS_RELEASE(document);

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

@ -278,6 +278,8 @@ public:
static nsIAtom* width;
static nsIAtom* wrap;
static nsIAtom* xmlRootPseudo;
static nsIAtom* zindex;
};

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

@ -239,6 +239,7 @@ nsIAtom* nsHTMLAtoms::vspace;
nsIAtom* nsHTMLAtoms::wbr;
nsIAtom* nsHTMLAtoms::width;
nsIAtom* nsHTMLAtoms::wrap;
nsIAtom* nsHTMLAtoms::xmlRootPseudo;
nsIAtom* nsHTMLAtoms::zindex;
@ -466,6 +467,7 @@ void nsHTMLAtoms::AddrefAtoms()
wbr = NS_NewAtom("WBR");
width = NS_NewAtom("WIDTH");
wrap = NS_NewAtom("WRAP");
xmlRootPseudo = NS_NewAtom(":XML-ROOT");
zindex = NS_NewAtom("ZINDEX");
}
++gRefCnt;
@ -684,6 +686,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(wbr);
NS_RELEASE(width);
NS_RELEASE(wrap);
NS_RELEASE(xmlRootPseudo);
NS_RELEASE(zindex);
}
}

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

@ -54,6 +54,8 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
#define XML_PSEUDO_ELEMENT 0
nsresult
NS_NewXMLContentSink(nsIXMLContentSink** aResult,
nsIDocument* aDoc,
@ -159,6 +161,7 @@ nsXMLContentSink::WillBuildModel(void)
mDocument->BeginLoad();
nsresult result = NS_OK;
#if XML_PSEUDO_ELEMENT
// XXX Create a pseudo root element. This is a parent of the
// document element. For now, it will be seen in the document
// hierarchy. In the future we might want to get rid of it
@ -179,6 +182,7 @@ nsXMLContentSink::WillBuildModel(void)
mDocument->SetRootContent(mRootElement);
}
#endif
return result;
}
@ -200,8 +204,12 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
}
}
#if XML_PSEUDO_ELEMENT
// Pop the pseudo root content
PopContent();
#else
mDocument->SetRootContent(mDocElement);
#endif
StartLayout();
@ -496,10 +504,11 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
mDocElement = content;
NS_ADDREF(mDocElement);
}
else {
nsIContent *parent = GetCurrentContent();
nsIContent *parent = GetCurrentContent();
parent->AppendChildTo(content, PR_FALSE);
parent->AppendChildTo(content, PR_FALSE);
}
PushContent(content);
}
}

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

@ -910,7 +910,7 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
return aFrame;
}
}
NS_RELEASE(frameContent);
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, aFrame);
while (aFrame) {

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -698,11 +698,16 @@ void nsContainerFrame::AppendChildren(nsIFrame* aChild, PRBool aSetParent)
NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
tag->ToString(tagString);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRBool outputMe = (PRBool)((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString)));
if (PR_TRUE==outputMe)
{

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

@ -235,7 +235,7 @@ void* nsFrame::operator new(size_t size)
nsFrame::nsFrame(nsIContent* aContent, nsIFrame* aParent)
: mContent(aContent), mContentParent(aParent), mGeometricParent(aParent)
{
NS_ADDREF(mContent);
NS_IF_ADDREF(mContent);
mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW;
}
@ -344,9 +344,7 @@ nsFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
NS_IMETHODIMP nsFrame::GetContent(nsIContent*& aContent) const
{
if (nsnull != mContent) {
NS_ADDREF(mContent);
}
NS_IF_ADDREF(mContent);
aContent = mContent;
return NS_OK;
}
@ -1511,14 +1509,16 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
if ((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString)))
{
// Indent
@ -1542,13 +1542,15 @@ NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
// Output the frame's tag
NS_IMETHODIMP nsFrame::ListTag(FILE* out) const
{
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
}
}
fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
@ -1653,7 +1655,7 @@ void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent)
if (frameContent == aContent) {
ForceDrawFrame((nsFrame *)aFrame);
}
NS_RELEASE(frameContent);
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, aFrame);
while (aFrame) {
@ -1915,6 +1917,15 @@ void addRangeToSelectionTrackers(nsIContent * aStartContent, nsIContent * aEndCo
while (contentPtr != aEndContent) {
contentList[inx++] = contentPtr;
contentPtr = gDoc->GetNextContent(contentPtr); // This does an AddRef
if (nsnull == contentPtr) {
// XXX We didn't find the end content...
if (aType == kInsertInRemoveList) {
fTrackerRemoveListMax = inx;
} else { // kInsertInAddList
fTrackerAddListMax = inx;
}
return;
}
}
contentList[inx++] = aEndContent;

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

@ -60,7 +60,7 @@ nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
{
// Probe for a JS onPaint event handler
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) {
if (mContent && NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) {
nsHTMLValue val;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::onpaint, val)) {
@ -135,16 +135,18 @@ nsHTMLContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
// Get child's cursor, if any
nsContainerFrame::GetCursorAndContentAt(aPresContext, aPoint, aFrame, aContent, aCursor);
if (aCursor != NS_STYLE_CURSOR_INHERIT) {
nsIAtom* tag;
mContent->GetTag(tag);
if (nsHTMLAtoms::a == tag) {
// Anchor tags override their child cursors in some cases.
if ((NS_STYLE_CURSOR_TEXT == aCursor) &&
(NS_STYLE_CURSOR_INHERIT != myCursor)) {
aCursor = myCursor;
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (nsHTMLAtoms::a == tag) {
// Anchor tags override their child cursors in some cases.
if ((NS_STYLE_CURSOR_TEXT == aCursor) &&
(NS_STYLE_CURSOR_INHERIT != myCursor)) {
aCursor = myCursor;
}
}
NS_RELEASE(tag);
}
NS_RELEASE(tag);
return NS_OK;
}

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

@ -185,7 +185,9 @@ RootFrame::HandleEvent(nsIPresContext& aPresContext,
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus)
{
mContent->HandleDOMEvent(aPresContext, (nsEvent*)aEvent, nsnull, DOM_EVENT_INIT, aEventStatus);
if (nsnull != mContent) {
mContent->HandleDOMEvent(aPresContext, (nsEvent*)aEvent, nsnull, DOM_EVENT_INIT, aEventStatus);
}
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP ||
aEvent->message == NS_MOUSE_MIDDLE_BUTTON_UP ||

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -1677,6 +1677,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
return NS_OK;
}
// XXX Get rid of this...
PRBool
nsBlockFrame::IsPseudoFrame() const
{
@ -1689,7 +1690,7 @@ nsBlockFrame::IsPseudoFrame() const
if (parentContent == mContent) {
result = PR_TRUE;
}
NS_RELEASE(parentContent);
NS_IF_RELEASE(parentContent);
}
return result;
@ -1726,12 +1727,14 @@ nsBlockFrame::ListTag(FILE* out) const
fprintf(out, "*");
}
fprintf(out, "Block<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
@ -1741,13 +1744,14 @@ NS_METHOD
nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRInt32 i;
@ -2008,7 +2012,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
// Setup initial list ordinal value
PRInt32 ordinal = 1;
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
if (mContent && (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc))) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::start, value)) {

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

@ -806,11 +806,13 @@ nsBodyFrame::HandleEvent(nsIPresContext& aPresContext,
mLastContent->HandleDOMEvent(aPresContext, &mEvent, nsnull, DOM_EVENT_INIT, mStatus);
}
//fire mouseover
nsEventStatus mStatus = nsEventStatus_eIgnore;
nsMouseEvent mEvent;
mEvent.eventStructType = NS_MOUSE_EVENT;
mEvent.message = NS_MOUSE_ENTER;
mTargetContent->HandleDOMEvent(aPresContext, &mEvent, nsnull, DOM_EVENT_INIT, mStatus);
if (nsnull != mTargetContent) {
nsEventStatus mStatus = nsEventStatus_eIgnore;
nsMouseEvent mEvent;
mEvent.eventStructType = NS_MOUSE_EVENT;
mEvent.message = NS_MOUSE_ENTER;
mTargetContent->HandleDOMEvent(aPresContext, &mEvent, nsnull, DOM_EVENT_INIT, mStatus);
}
mStateManager->SetLastMouseOverContent(mTargetContent);
}
NS_RELEASE(mStateManager);
@ -1250,12 +1252,14 @@ NS_IMETHODIMP
nsBodyFrame::ListTag(FILE* out) const
{
fprintf(out, "Body<");
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;

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

@ -698,11 +698,16 @@ void nsContainerFrame::AppendChildren(nsIFrame* aChild, PRBool aSetParent)
NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
tag->ToString(tagString);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
PRBool outputMe = (PRBool)((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString)));
if (PR_TRUE==outputMe)
{

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

@ -235,7 +235,7 @@ void* nsFrame::operator new(size_t size)
nsFrame::nsFrame(nsIContent* aContent, nsIFrame* aParent)
: mContent(aContent), mContentParent(aParent), mGeometricParent(aParent)
{
NS_ADDREF(mContent);
NS_IF_ADDREF(mContent);
mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW;
}
@ -344,9 +344,7 @@ nsFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
NS_IMETHODIMP nsFrame::GetContent(nsIContent*& aContent) const
{
if (nsnull != mContent) {
NS_ADDREF(mContent);
}
NS_IF_ADDREF(mContent);
aContent = mContent;
return NS_OK;
}
@ -1511,14 +1509,16 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
// if a filter is present, only output this frame if the filter says we should
nsIAtom* tag;
nsAutoString tagString;
mContent->GetTag(tag);
if (tag != nsnull)
{
tag->ToString(tagString);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
tag->ToString(tagString);
NS_RELEASE(tag);
}
}
if ((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString)))
{
// Indent
@ -1542,13 +1542,15 @@ NS_IMETHODIMP nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
// Output the frame's tag
NS_IMETHODIMP nsFrame::ListTag(FILE* out) const
{
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
}
}
fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
@ -1653,7 +1655,7 @@ void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent)
if (frameContent == aContent) {
ForceDrawFrame((nsFrame *)aFrame);
}
NS_RELEASE(frameContent);
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, aFrame);
while (aFrame) {
@ -1915,6 +1917,15 @@ void addRangeToSelectionTrackers(nsIContent * aStartContent, nsIContent * aEndCo
while (contentPtr != aEndContent) {
contentList[inx++] = contentPtr;
contentPtr = gDoc->GetNextContent(contentPtr); // This does an AddRef
if (nsnull == contentPtr) {
// XXX We didn't find the end content...
if (aType == kInsertInRemoveList) {
fTrackerRemoveListMax = inx;
} else { // kInsertInAddList
fTrackerAddListMax = inx;
}
return;
}
}
contentList[inx++] = aEndContent;

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

@ -239,6 +239,7 @@ nsIAtom* nsHTMLAtoms::vspace;
nsIAtom* nsHTMLAtoms::wbr;
nsIAtom* nsHTMLAtoms::width;
nsIAtom* nsHTMLAtoms::wrap;
nsIAtom* nsHTMLAtoms::xmlRootPseudo;
nsIAtom* nsHTMLAtoms::zindex;
@ -466,6 +467,7 @@ void nsHTMLAtoms::AddrefAtoms()
wbr = NS_NewAtom("WBR");
width = NS_NewAtom("WIDTH");
wrap = NS_NewAtom("WRAP");
xmlRootPseudo = NS_NewAtom(":XML-ROOT");
zindex = NS_NewAtom("ZINDEX");
}
++gRefCnt;
@ -684,6 +686,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(wbr);
NS_RELEASE(width);
NS_RELEASE(wrap);
NS_RELEASE(xmlRootPseudo);
NS_RELEASE(zindex);
}
}

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

@ -278,6 +278,8 @@ public:
static nsIAtom* width;
static nsIAtom* wrap;
static nsIAtom* xmlRootPseudo;
static nsIAtom* zindex;
};

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

@ -60,7 +60,7 @@ nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
{
// Probe for a JS onPaint event handler
nsIHTMLContent* hc;
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) {
if (mContent && NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**)&hc)) {
nsHTMLValue val;
if (NS_CONTENT_ATTR_HAS_VALUE ==
hc->GetAttribute(nsHTMLAtoms::onpaint, val)) {
@ -135,16 +135,18 @@ nsHTMLContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
// Get child's cursor, if any
nsContainerFrame::GetCursorAndContentAt(aPresContext, aPoint, aFrame, aContent, aCursor);
if (aCursor != NS_STYLE_CURSOR_INHERIT) {
nsIAtom* tag;
mContent->GetTag(tag);
if (nsHTMLAtoms::a == tag) {
// Anchor tags override their child cursors in some cases.
if ((NS_STYLE_CURSOR_TEXT == aCursor) &&
(NS_STYLE_CURSOR_INHERIT != myCursor)) {
aCursor = myCursor;
if (nsnull != mContent) {
nsIAtom* tag;
mContent->GetTag(tag);
if (nsHTMLAtoms::a == tag) {
// Anchor tags override their child cursors in some cases.
if ((NS_STYLE_CURSOR_TEXT == aCursor) &&
(NS_STYLE_CURSOR_INHERIT != myCursor)) {
aCursor = myCursor;
}
}
NS_RELEASE(tag);
}
NS_RELEASE(tag);
return NS_OK;
}

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

@ -185,7 +185,9 @@ RootFrame::HandleEvent(nsIPresContext& aPresContext,
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus)
{
mContent->HandleDOMEvent(aPresContext, (nsEvent*)aEvent, nsnull, DOM_EVENT_INIT, aEventStatus);
if (nsnull != mContent) {
mContent->HandleDOMEvent(aPresContext, (nsEvent*)aEvent, nsnull, DOM_EVENT_INIT, aEventStatus);
}
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP ||
aEvent->message == NS_MOUSE_MIDDLE_BUTTON_UP ||

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

@ -910,7 +910,7 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
return aFrame;
}
}
NS_RELEASE(frameContent);
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, aFrame);
while (aFrame) {

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

@ -437,13 +437,15 @@ NS_IMETHODIMP
nsScrollFrame::ListTag(FILE* out) const
{
fputs("*ScrollFrame<", out);
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
NS_RELEASE(atom);
if (nsnull != mContent) {
nsIAtom* atom;
mContent->GetTag(atom);
if (nsnull != atom) {
nsAutoString tmp;
atom->ToString(tmp);
fputs(tmp, out);
NS_RELEASE(atom);
}
}
fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;

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

@ -503,3 +503,6 @@ NOFRAMES {
display: inherit;
}
:XML-ROOT {
background-color: inherit;
}

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

@ -300,10 +300,10 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -1210,13 +1210,17 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
}
nsresult
HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
HTMLStyleSheetImpl::ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
{
// Create the root frame
nsresult rv = NS_NewHTMLFrame(aContent, nsnull, aNewFrame);
// Create the root frame. It gets a special pseudo element style
nsIStyleContext* rootPseudoStyle;
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
nsHTMLAtoms::xmlRootPseudo, nsnull);
nsresult rv = NS_NewHTMLFrame(nsnull, nsnull, aNewFrame);
if (NS_SUCCEEDED(rv)) {
// Bind root frame to root view (and root window)
@ -1230,33 +1234,38 @@ HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
NS_RELEASE(viewManager);
// Set the style context
aNewFrame->SetStyleContext(aPresContext, aStyleContext);
aNewFrame->SetStyleContext(aPresContext, rootPseudoStyle);
// Wrap the document element in a scroll frame
nsIFrame* scrollFrame;
if (NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame))) {
if (NS_SUCCEEDED(NS_NewScrollFrame(nsnull, aNewFrame, scrollFrame))) {
// The scroll frame gets the original style context, and the scrolled
// frame gets a SCROLLED-CONTENT pseudo element style context.
scrollFrame->SetStyleContext(aPresContext, aStyleContext);
scrollFrame->SetStyleContext(aPresContext, rootPseudoStyle);
nsIStyleContext* scrolledPseudoStyle;
nsIFrame* wrapperFrame;
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
(aContent,
nsHTMLAtoms::scrolledContentPseudo,
aStyleContext);
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
rootPseudoStyle);
// Create a body frame to wrap the document element
NS_NewBodyFrame(aContent, scrollFrame,
wrapperFrame, NS_BODY_SHRINK_WRAP);
NS_NewBodyFrame(nsnull, scrollFrame, wrapperFrame, NS_BODY_SHRINK_WRAP);
wrapperFrame->SetStyleContext(aPresContext, scrolledPseudoStyle);
// Construct a frame for the document element
nsIFrame* docElementFrame;
ConstructFrame(aPresContext, aContent, wrapperFrame, docElementFrame);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
#if 0
// Process the child content, and set the frame's initial child list
nsIFrame* childList;
rv = ProcessChildren(aPresContext, wrapperFrame, aContent, childList);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, childList);
#endif
// Set the scroll frame's initial child list
scrollFrame->SetInitialChildList(*aPresContext, nsnull, wrapperFrame);
@ -1631,8 +1640,8 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
else {
// Construct the root frame object for XML
rv = ConstructXMLRootFrames(aPresContext, aContent, styleContext,
aFrameSubTree);
rv = ConstructXMLRootFrame(aPresContext, aContent, styleContext,
aFrameSubTree);
NS_RELEASE(xmlDocument);
}
NS_RELEASE(document);

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

@ -300,10 +300,10 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -1210,13 +1210,17 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
}
nsresult
HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
HTMLStyleSheetImpl::ConstructXMLRootFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame*& aNewFrame)
{
// Create the root frame
nsresult rv = NS_NewHTMLFrame(aContent, nsnull, aNewFrame);
// Create the root frame. It gets a special pseudo element style
nsIStyleContext* rootPseudoStyle;
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
nsHTMLAtoms::xmlRootPseudo, nsnull);
nsresult rv = NS_NewHTMLFrame(nsnull, nsnull, aNewFrame);
if (NS_SUCCEEDED(rv)) {
// Bind root frame to root view (and root window)
@ -1230,33 +1234,38 @@ HTMLStyleSheetImpl::ConstructXMLRootFrames(nsIPresContext* aPresContext,
NS_RELEASE(viewManager);
// Set the style context
aNewFrame->SetStyleContext(aPresContext, aStyleContext);
aNewFrame->SetStyleContext(aPresContext, rootPseudoStyle);
// Wrap the document element in a scroll frame
nsIFrame* scrollFrame;
if (NS_SUCCEEDED(NS_NewScrollFrame(aContent, aNewFrame, scrollFrame))) {
if (NS_SUCCEEDED(NS_NewScrollFrame(nsnull, aNewFrame, scrollFrame))) {
// The scroll frame gets the original style context, and the scrolled
// frame gets a SCROLLED-CONTENT pseudo element style context.
scrollFrame->SetStyleContext(aPresContext, aStyleContext);
scrollFrame->SetStyleContext(aPresContext, rootPseudoStyle);
nsIStyleContext* scrolledPseudoStyle;
nsIFrame* wrapperFrame;
scrolledPseudoStyle = aPresContext->ResolvePseudoStyleContextFor
(aContent,
nsHTMLAtoms::scrolledContentPseudo,
aStyleContext);
(nsnull, nsHTMLAtoms::scrolledContentPseudo,
rootPseudoStyle);
// Create a body frame to wrap the document element
NS_NewBodyFrame(aContent, scrollFrame,
wrapperFrame, NS_BODY_SHRINK_WRAP);
NS_NewBodyFrame(nsnull, scrollFrame, wrapperFrame, NS_BODY_SHRINK_WRAP);
wrapperFrame->SetStyleContext(aPresContext, scrolledPseudoStyle);
// Construct a frame for the document element
nsIFrame* docElementFrame;
ConstructFrame(aPresContext, aContent, wrapperFrame, docElementFrame);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, docElementFrame);
#if 0
// Process the child content, and set the frame's initial child list
nsIFrame* childList;
rv = ProcessChildren(aPresContext, wrapperFrame, aContent, childList);
wrapperFrame->SetInitialChildList(*aPresContext, nsnull, childList);
#endif
// Set the scroll frame's initial child list
scrollFrame->SetInitialChildList(*aPresContext, nsnull, wrapperFrame);
@ -1631,8 +1640,8 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
else {
// Construct the root frame object for XML
rv = ConstructXMLRootFrames(aPresContext, aContent, styleContext,
aFrameSubTree);
rv = ConstructXMLRootFrame(aPresContext, aContent, styleContext,
aFrameSubTree);
NS_RELEASE(xmlDocument);
}
NS_RELEASE(document);

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

@ -503,3 +503,6 @@ NOFRAMES {
display: inherit;
}
:XML-ROOT {
background-color: inherit;
}

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

@ -54,6 +54,8 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
#define XML_PSEUDO_ELEMENT 0
nsresult
NS_NewXMLContentSink(nsIXMLContentSink** aResult,
nsIDocument* aDoc,
@ -159,6 +161,7 @@ nsXMLContentSink::WillBuildModel(void)
mDocument->BeginLoad();
nsresult result = NS_OK;
#if XML_PSEUDO_ELEMENT
// XXX Create a pseudo root element. This is a parent of the
// document element. For now, it will be seen in the document
// hierarchy. In the future we might want to get rid of it
@ -179,6 +182,7 @@ nsXMLContentSink::WillBuildModel(void)
mDocument->SetRootContent(mRootElement);
}
#endif
return result;
}
@ -200,8 +204,12 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
}
}
#if XML_PSEUDO_ELEMENT
// Pop the pseudo root content
PopContent();
#else
mDocument->SetRootContent(mDocElement);
#endif
StartLayout();
@ -496,10 +504,11 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
mDocElement = content;
NS_ADDREF(mDocElement);
}
else {
nsIContent *parent = GetCurrentContent();
nsIContent *parent = GetCurrentContent();
parent->AppendChildTo(content, PR_FALSE);
parent->AppendChildTo(content, PR_FALSE);
}
PushContent(content);
}
}