зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 230840. DeCOMtaminating nsIDocumentObserver, nsIAttribute, nsIContentList, and nsIContentIterator, and doing some other cleanup. r=jonas@sicking.cc, sr=bryner@brianryner.com
This commit is contained in:
Родитель
f6c5136445
Коммит
8bf02835a0
|
@ -1,3 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -642,16 +643,16 @@ NS_IMPL_NSIDOCUMENTOBSERVER_REFLOW_STUB(inDOMView)
|
|||
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(inDOMView)
|
||||
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(inDOMView)
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute, PRInt32 aModType)
|
||||
{
|
||||
if (!mTree) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mWhatToShow & nsIDOMNodeFilter::SHOW_ATTRIBUTE)) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// get the dom attribute node, if there is any
|
||||
|
@ -678,11 +679,11 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt3
|
|||
PRInt32 contentRow;
|
||||
PRInt32 attrRow;
|
||||
if (NS_FAILED(NodeToRow(content, &contentRow))) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
RowToNode(contentRow, &contentNode);
|
||||
if (!contentRow || !contentNode->isOpen) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
if (mRootNode == content) {
|
||||
// if this view has a root node but is not displaying it,
|
||||
|
@ -721,7 +722,7 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt3
|
|||
contentRow = -1;
|
||||
baseLevel = -1;
|
||||
} else
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the attribute node that was removed
|
||||
|
@ -748,37 +749,35 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt3
|
|||
}
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
inDOMView::ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
if (!mTree) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIContent *child = aContainer->GetChildAt(aNewIndexInContainer);
|
||||
|
||||
return ContentInserted(aDocument, aContainer, child,
|
||||
aNewIndexInContainer);
|
||||
ContentInserted(aDocument, aContainer, child, aNewIndexInContainer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
inDOMView::ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
|
||||
void
|
||||
inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
nsIContent* aChild, PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (!mTree)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> childDOMNode(do_QueryInterface(aChild));
|
||||
|
@ -786,7 +785,7 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
if (!mDOMUtils) {
|
||||
mDOMUtils = do_GetService("@mozilla.org/inspector/dom-utils;1");
|
||||
if (!mDOMUtils) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
mDOMUtils->GetParentForNode(childDOMNode, mShowAnonymous,
|
||||
|
@ -795,10 +794,10 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
// find the inDOMViewNode for the parent of the inserted content
|
||||
PRInt32 parentRow = 0;
|
||||
if (NS_FAILED(rv = NodeToRow(parent, &parentRow)))
|
||||
return rv;
|
||||
return;
|
||||
inDOMViewNode* parentNode = nsnull;
|
||||
if (NS_FAILED(rv = RowToNode(parentRow, &parentNode)))
|
||||
return rv;
|
||||
return;
|
||||
|
||||
// get the previous sibling of the inserted content
|
||||
nsCOMPtr<nsIDOMNode> previous;
|
||||
|
@ -810,9 +809,9 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
// find the inDOMViewNode for the previous sibling of the inserted content
|
||||
PRInt32 previousRow = 0;
|
||||
if (NS_FAILED(rv = NodeToRow(previous, &previousRow)))
|
||||
return rv;
|
||||
return;
|
||||
if (NS_FAILED(rv = RowToNode(previousRow, &previousNode)))
|
||||
return rv;
|
||||
return;
|
||||
|
||||
// get the last descendant of the previous row, which is the row
|
||||
// after which to insert this new row
|
||||
|
@ -840,15 +839,13 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
InsertNode(newNode, row);
|
||||
|
||||
mTree->RowCountChanged(row, 1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
inDOMView::ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aOldChild, nsIContent* aNewChild, PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (!mTree)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -857,10 +854,10 @@ inDOMView::ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
nsCOMPtr<nsIDOMNode> newDOMNode(do_QueryInterface(aNewChild));
|
||||
PRInt32 row = 0;
|
||||
if (NS_FAILED(rv = NodeToRow(oldDOMNode, &row)))
|
||||
return rv;
|
||||
return;
|
||||
inDOMViewNode* oldNode;
|
||||
if (NS_FAILED(rv = RowToNode(row, &oldNode)))
|
||||
return rv;
|
||||
return;
|
||||
|
||||
PRInt32 oldRowCount = GetRowCount();
|
||||
if (oldNode->isOpen)
|
||||
|
@ -873,15 +870,13 @@ inDOMView::ContentReplaced(nsIDocument *aDocument, nsIContent* aContainer, nsICo
|
|||
|
||||
// XXX can this go into ReplaceNode?
|
||||
mTree->InvalidateRange(row, oldRowCount-1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsIContent* aChild, PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (!mTree)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -889,10 +884,10 @@ inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsICon
|
|||
nsCOMPtr<nsIDOMNode> oldDOMNode(do_QueryInterface(aChild));
|
||||
PRInt32 row = 0;
|
||||
if (NS_FAILED(rv = NodeToRow(oldDOMNode, &row)))
|
||||
return rv;
|
||||
return;
|
||||
inDOMViewNode* oldNode;
|
||||
if (NS_FAILED(rv = RowToNode(row, &oldNode)))
|
||||
return rv;
|
||||
return;
|
||||
|
||||
if (oldNode->isOpen)
|
||||
CollapseNode(row);
|
||||
|
@ -901,8 +896,6 @@ inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsICon
|
|||
RemoveNode(row);
|
||||
|
||||
mTree->RowCountChanged(row, -1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче