зеркало из https://github.com/mozilla/pjs.git
updated for nsCOMPtr (no implicit construction from raw pointers) owners should check that they agree with my choices for |dont_QueryInterface|, |do_QueryInterface| and |dont_AddRef|
This commit is contained in:
Родитель
3a8879990b
Коммит
ab59e4df7a
|
@ -142,9 +142,7 @@ nsresult nsContentIterator::QueryInterface(const nsIID& aIID,
|
|||
******************************************************/
|
||||
|
||||
nsContentIterator::nsContentIterator() :
|
||||
mCurNode(nsnull),
|
||||
mFirst(nsnull),
|
||||
mLast(nsnull),
|
||||
// don't need to explicitly initialize |nsCOMPtr|s, they will automatically be NULL
|
||||
mIsDone(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -166,9 +164,9 @@ nsresult nsContentIterator::Init(nsIContent* aRoot)
|
|||
if (!aRoot)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIContent> root(aRoot);
|
||||
nsCOMPtr<nsIContent> root( dont_QueryInterface(aRoot) );
|
||||
mFirst = GetDeepFirstChild(root);
|
||||
mLast = aRoot;
|
||||
mLast = root;
|
||||
mCurNode = mFirst;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
|
|||
if (!outEndOffset)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> theDOMNode(aNode);
|
||||
nsCOMPtr<nsIDOMNode> theDOMNode( do_QueryInterface(aNode) );
|
||||
PRInt32 indx;
|
||||
theDOMNode->GetParentNode(getter_AddRefs(*outParent));
|
||||
|
||||
|
@ -217,7 +217,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
|
|||
// can't make a parent/offset pair to represent start or
|
||||
// end of the root node, becasue it has no parent.
|
||||
// so instead represent it by (node,0) and (node,numChildren)
|
||||
*outParent = aNode;
|
||||
*outParent = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
|
||||
if (!cN)
|
||||
return false;
|
||||
|
@ -880,7 +880,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
if (!aParent) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMNode>theParent(aParent);
|
||||
nsCOMPtr<nsIDOMNode>theParent( dont_QueryInterface(aParent) );
|
||||
|
||||
// must be in same document as endpoint, else
|
||||
// endpoint is collapsed to new start.
|
||||
|
@ -901,7 +901,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling);
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -910,7 +910,7 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
|
|||
|
||||
nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling) + 1;
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -923,7 +923,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
if (!aParent) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMNode>theParent(aParent);
|
||||
nsCOMPtr<nsIDOMNode>theParent( dont_QueryInterface(aParent) );
|
||||
|
||||
// must be in same document as startpoint, else
|
||||
// endpoint is collapsed to new end.
|
||||
|
@ -944,7 +944,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling);
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -953,7 +953,7 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
|
|||
|
||||
nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling) + 1;
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -984,7 +984,7 @@ nsresult nsRange::Unposition()
|
|||
nsresult nsRange::SelectNode(nsIDOMNode* aN)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsCOMPtr<nsIDOMNode> theNode(aN);
|
||||
nsCOMPtr<nsIDOMNode> theNode( dont_QueryInterface(aN) );
|
||||
|
||||
nsresult res = aN->GetParentNode(getter_AddRefs(parent));
|
||||
if (!NS_SUCCEEDED(res))
|
||||
|
@ -996,7 +996,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN)
|
|||
|
||||
nsresult nsRange::SelectNodeContents(nsIDOMNode* aN)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> theNode(aN);
|
||||
nsCOMPtr<nsIDOMNode> theNode( dont_QueryInterface(aN) );
|
||||
nsCOMPtr<nsIDOMNodeList> aChildNodes;
|
||||
|
||||
nsresult res = aN->GetChildNodes(getter_AddRefs(aChildNodes));
|
||||
|
@ -1120,7 +1120,7 @@ nsresult nsRange::DeleteContents()
|
|||
// remove the nodes on the delete list
|
||||
while (deleteList.Count())
|
||||
{
|
||||
cN = NS_STATIC_CAST(nsIContent*, deleteList.ElementAt(0));
|
||||
cN = do_QueryInterface(NS_STATIC_CAST(nsIContent*, deleteList.ElementAt(0)));
|
||||
res = cN->GetParent(*getter_AddRefs(cParent));
|
||||
res = cParent->IndexOf(cN,indx);
|
||||
res = cParent->RemoveChildAt(indx, PR_TRUE);
|
||||
|
@ -1502,7 +1502,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset)
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aParentNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
// quick return if no range list
|
||||
nsVoidArray *theRangeList;
|
||||
parent->GetRangeList(theRangeList);
|
||||
|
@ -1517,7 +1517,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset)
|
|||
if (NS_SUCCEEDED(res)) return res;
|
||||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
@ -1547,8 +1547,8 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aParentNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> removed(aRemovedNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
nsCOMPtr<nsIContent> removed( dont_QueryInterface(aRemovedNode) );
|
||||
// quick return if no range list
|
||||
nsVoidArray *theRangeList;
|
||||
parent->GetRangeList(theRangeList);
|
||||
|
@ -1564,7 +1564,7 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns
|
|||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// any ranges that are in the parentNode may need to have offsets updated
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
@ -1605,8 +1605,8 @@ nsresult nsRange::OwnerChildReplaced(nsIContent* aParentNode, PRInt32 aOffset, n
|
|||
// but we do need to pop out any range endpoints inside the subtree
|
||||
// rooted by aReplacedNode.
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> replaced(aReplacedNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
nsCOMPtr<nsIContent> replaced( dont_QueryInterface(aReplacedNode) );
|
||||
nsCOMPtr<nsIDOMNode> parentDomNode;
|
||||
nsresult res;
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aTextNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> textNode(aTextNode);
|
||||
nsCOMPtr<nsIContent> textNode( dont_QueryInterface(aTextNode) );
|
||||
nsVoidArray *theRangeList;
|
||||
aTextNode->GetRangeList(theRangeList);
|
||||
// the caller already checked to see if there was a range list
|
||||
|
@ -1640,7 +1640,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
|
|||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// any ranges that are in the textNode may need to have offsets updated
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
|
|
@ -2042,10 +2042,10 @@ void
|
|||
HTMLContentSink::ScrollToRef()
|
||||
{
|
||||
if (mNotAtRef && (nsnull != mRef) && (nsnull != mRefContent)) {
|
||||
// See if the ref content has been reflowed by finding it's frame
|
||||
// See if the ref content has been reflowed by finding its frame
|
||||
PRInt32 i, ns = mDocument->GetNumberOfShells();
|
||||
for (i = 0; i < ns; i++) {
|
||||
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
|
||||
nsCOMPtr<nsIPresShell> shell( dont_AddRef(mDocument->GetShellAt(i)) );
|
||||
if (shell) {
|
||||
nsIFrame* frame;
|
||||
shell->GetPrimaryFrameFor(mRefContent, &frame);
|
||||
|
|
|
@ -230,7 +230,7 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
|
|||
// XXX this is silly; who cares?
|
||||
PRInt32 i, ns = mDocument->GetNumberOfShells();
|
||||
for (i = 0; i < ns; i++) {
|
||||
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
|
||||
nsCOMPtr<nsIPresShell> shell( dont_AddRef(mDocument->GetShellAt(i)) );
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
|
|
|
@ -581,7 +581,7 @@ nsCSSFrameConstructor::ConstructTableGroupFrame(nsIPresContext* aPresContext,
|
|||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == styleDisplay->mDisplay)
|
||||
: (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == styleDisplay->mDisplay);
|
||||
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
nsCOMPtr<nsIStyleContext> parentStyleContext;
|
||||
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
|
||||
const nsStyleDisplay* parentDisplay =
|
||||
|
@ -720,7 +720,7 @@ nsCSSFrameConstructor::ConstructTableRowFrame(nsIPresContext* aPresContext,
|
|||
|
||||
// if groupStyleContext gets set, both it and styleContext need to be released
|
||||
nsCOMPtr<nsIStyleContext> groupStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
|
||||
const nsStyleDisplay* parentDisplay = GetDisplay(aParentFrame);
|
||||
if ((NS_STYLE_DISPLAY_TABLE_ROW_GROUP == parentDisplay->mDisplay) ||
|
||||
|
@ -875,7 +875,7 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresContext* aPresContext,
|
|||
const nsStyleDisplay* parentDisplay = (const nsStyleDisplay*)
|
||||
parentStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
PRBool wrapContent = PR_FALSE;
|
||||
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW == parentDisplay->mDisplay) {
|
||||
|
|
|
@ -142,9 +142,7 @@ nsresult nsContentIterator::QueryInterface(const nsIID& aIID,
|
|||
******************************************************/
|
||||
|
||||
nsContentIterator::nsContentIterator() :
|
||||
mCurNode(nsnull),
|
||||
mFirst(nsnull),
|
||||
mLast(nsnull),
|
||||
// don't need to explicitly initialize |nsCOMPtr|s, they will automatically be NULL
|
||||
mIsDone(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -166,9 +164,9 @@ nsresult nsContentIterator::Init(nsIContent* aRoot)
|
|||
if (!aRoot)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIContent> root(aRoot);
|
||||
nsCOMPtr<nsIContent> root( dont_QueryInterface(aRoot) );
|
||||
mFirst = GetDeepFirstChild(root);
|
||||
mLast = aRoot;
|
||||
mLast = root;
|
||||
mCurNode = mFirst;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
|
|||
if (!outEndOffset)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> theDOMNode(aNode);
|
||||
nsCOMPtr<nsIDOMNode> theDOMNode( do_QueryInterface(aNode) );
|
||||
PRInt32 indx;
|
||||
theDOMNode->GetParentNode(getter_AddRefs(*outParent));
|
||||
|
||||
|
@ -217,7 +217,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
|
|||
// can't make a parent/offset pair to represent start or
|
||||
// end of the root node, becasue it has no parent.
|
||||
// so instead represent it by (node,0) and (node,numChildren)
|
||||
*outParent = aNode;
|
||||
*outParent = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
|
||||
if (!cN)
|
||||
return false;
|
||||
|
@ -880,7 +880,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
if (!aParent) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMNode>theParent(aParent);
|
||||
nsCOMPtr<nsIDOMNode>theParent( dont_QueryInterface(aParent) );
|
||||
|
||||
// must be in same document as endpoint, else
|
||||
// endpoint is collapsed to new start.
|
||||
|
@ -901,7 +901,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling);
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -910,7 +910,7 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
|
|||
|
||||
nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling) + 1;
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -923,7 +923,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
if (!aParent) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMNode>theParent(aParent);
|
||||
nsCOMPtr<nsIDOMNode>theParent( dont_QueryInterface(aParent) );
|
||||
|
||||
// must be in same document as startpoint, else
|
||||
// endpoint is collapsed to new end.
|
||||
|
@ -944,7 +944,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
|
||||
nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling);
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -953,7 +953,7 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
|
|||
|
||||
nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode>theSibling(aSibling);
|
||||
nsCOMPtr<nsIDOMNode>theSibling( dont_QueryInterface(aSibling) );
|
||||
PRInt32 indx = IndexOf(theSibling) + 1;
|
||||
nsIDOMNode *nParent;
|
||||
theSibling->GetParentNode(&nParent);
|
||||
|
@ -984,7 +984,7 @@ nsresult nsRange::Unposition()
|
|||
nsresult nsRange::SelectNode(nsIDOMNode* aN)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsCOMPtr<nsIDOMNode> theNode(aN);
|
||||
nsCOMPtr<nsIDOMNode> theNode( dont_QueryInterface(aN) );
|
||||
|
||||
nsresult res = aN->GetParentNode(getter_AddRefs(parent));
|
||||
if (!NS_SUCCEEDED(res))
|
||||
|
@ -996,7 +996,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN)
|
|||
|
||||
nsresult nsRange::SelectNodeContents(nsIDOMNode* aN)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> theNode(aN);
|
||||
nsCOMPtr<nsIDOMNode> theNode( dont_QueryInterface(aN) );
|
||||
nsCOMPtr<nsIDOMNodeList> aChildNodes;
|
||||
|
||||
nsresult res = aN->GetChildNodes(getter_AddRefs(aChildNodes));
|
||||
|
@ -1120,7 +1120,7 @@ nsresult nsRange::DeleteContents()
|
|||
// remove the nodes on the delete list
|
||||
while (deleteList.Count())
|
||||
{
|
||||
cN = NS_STATIC_CAST(nsIContent*, deleteList.ElementAt(0));
|
||||
cN = do_QueryInterface(NS_STATIC_CAST(nsIContent*, deleteList.ElementAt(0)));
|
||||
res = cN->GetParent(*getter_AddRefs(cParent));
|
||||
res = cParent->IndexOf(cN,indx);
|
||||
res = cParent->RemoveChildAt(indx, PR_TRUE);
|
||||
|
@ -1502,7 +1502,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset)
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aParentNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
// quick return if no range list
|
||||
nsVoidArray *theRangeList;
|
||||
parent->GetRangeList(theRangeList);
|
||||
|
@ -1517,7 +1517,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset)
|
|||
if (NS_SUCCEEDED(res)) return res;
|
||||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
@ -1547,8 +1547,8 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aParentNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> removed(aRemovedNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
nsCOMPtr<nsIContent> removed( dont_QueryInterface(aRemovedNode) );
|
||||
// quick return if no range list
|
||||
nsVoidArray *theRangeList;
|
||||
parent->GetRangeList(theRangeList);
|
||||
|
@ -1564,7 +1564,7 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns
|
|||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// any ranges that are in the parentNode may need to have offsets updated
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
@ -1605,8 +1605,8 @@ nsresult nsRange::OwnerChildReplaced(nsIContent* aParentNode, PRInt32 aOffset, n
|
|||
// but we do need to pop out any range endpoints inside the subtree
|
||||
// rooted by aReplacedNode.
|
||||
|
||||
nsCOMPtr<nsIContent> parent(aParentNode);
|
||||
nsCOMPtr<nsIContent> replaced(aReplacedNode);
|
||||
nsCOMPtr<nsIContent> parent( dont_QueryInterface(aParentNode) );
|
||||
nsCOMPtr<nsIContent> replaced( dont_QueryInterface(aReplacedNode) );
|
||||
nsCOMPtr<nsIDOMNode> parentDomNode;
|
||||
nsresult res;
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
|
|||
// sanity check - null nodes shouldn't have enclosed ranges
|
||||
if (!aTextNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIContent> textNode(aTextNode);
|
||||
nsCOMPtr<nsIContent> textNode( dont_QueryInterface(aTextNode) );
|
||||
nsVoidArray *theRangeList;
|
||||
aTextNode->GetRangeList(theRangeList);
|
||||
// the caller already checked to see if there was a range list
|
||||
|
@ -1640,7 +1640,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
|
|||
if (!domNode) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// any ranges that are in the textNode may need to have offsets updated
|
||||
while (theRange = NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop))))
|
||||
while (theRange = do_QueryInterface(NS_STATIC_CAST(nsRange*, (theRangeList->ElementAt(loop)))))
|
||||
{
|
||||
// sanity check - do range and content agree over ownership?
|
||||
res = theRange->ContentOwnsUs(domNode);
|
||||
|
|
|
@ -421,7 +421,7 @@ PRInt32 nsRangeList::GetAnchorOffset()
|
|||
|
||||
void nsRangeList::setAnchor(nsIDOMNode* node, PRInt32 offset)
|
||||
{
|
||||
mAnchorNode = node;
|
||||
mAnchorNode = dont_QueryInterface(node);
|
||||
mAnchorOffset = offset;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ PRInt32 nsRangeList::GetFocusOffset()
|
|||
|
||||
void nsRangeList::setFocus(nsIDOMNode* node, PRInt32 offset)
|
||||
{
|
||||
mFocusNode = node;
|
||||
mFocusNode = dont_QueryInterface(node);
|
||||
mFocusOffset = offset;
|
||||
}
|
||||
|
||||
|
@ -713,8 +713,8 @@ nsRangeList::TakeFocus(nsIFocusTracker *aTracker, nsIFrame *aFrame, PRInt32 aOff
|
|||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(parent->GetParentNode(getter_AddRefs(parent2))) || !parent2)
|
||||
return NS_ERROR_FAILURE;
|
||||
parent = nsnull;//just force a release now even though we dont have to.
|
||||
parent2 = nsnull;
|
||||
parent = nsCOMPtr<nsIDOMNode>();//just force a release now even though we dont have to.
|
||||
parent2 = nsCOMPtr<nsIDOMNode>();
|
||||
|
||||
nsIFrame *frame;
|
||||
nsIFrame *anchor;
|
||||
|
@ -912,14 +912,14 @@ nsRangeList::ResetSelection(nsIFocusTracker *aTracker, nsIFrame *aStartFrame)
|
|||
nsCOMPtr<nsIContent> anchorContent;
|
||||
nsCOMPtr<nsIContent> frameContent;
|
||||
if (GetAnchorNode() && GetFocusNode()){
|
||||
anchorContent = GetAnchorNode();
|
||||
frameContent = GetFocusNode();
|
||||
anchorContent = do_QueryInterface(GetAnchorNode());
|
||||
frameContent = do_QueryInterface(GetFocusNode());
|
||||
}
|
||||
for (PRInt32 i =0; i<mRangeArray->Count(); i++){
|
||||
//end content and start content do NOT necessarily mean anchor and focus frame respectively
|
||||
PRInt32 anchorOffset = -1; //the frames themselves can talk to the presentation manager. we will tell them
|
||||
PRInt32 frameOffset = -1; // where we would "like" to have the anchor pt. actually we count on it.
|
||||
range = (nsISupports *)mRangeArray->ElementAt(i);
|
||||
range = do_QueryInterface((nsISupports *)mRangeArray->ElementAt(i));
|
||||
DEBUG_OUT_RANGE(range);
|
||||
range->GetStartParent(getter_AddRefs(startNode));
|
||||
range->GetStartOffset(&startOffset);
|
||||
|
@ -1000,7 +1000,7 @@ nsresult nsRangeList::NotifySelectionListeners()
|
|||
|
||||
for (PRInt32 i = 0; i < mSelectionListeners->Count();i++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> thisEntry(mSelectionListeners->ElementAt(i));
|
||||
nsCOMPtr<nsISupports> thisEntry(dont_QueryInterface(mSelectionListeners->ElementAt(i)));
|
||||
nsCOMPtr<nsIDOMSelectionListener> thisListener(do_QueryInterface(thisEntry));
|
||||
if (thisListener)
|
||||
thisListener->NotifySelectionChanged();
|
||||
|
@ -1099,7 +1099,7 @@ nsRangeList::IsCollapsed(PRBool* aIsCollapsed)
|
|||
*aIsCollapsed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsISupports> nsisup (mRangeArray->ElementAt(0));
|
||||
nsCOMPtr<nsISupports> nsisup (dont_QueryInterface(mRangeArray->ElementAt(0)));
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
if (!NS_SUCCEEDED(nsisup->QueryInterface(kIDOMRangeIID,
|
||||
getter_AddRefs(range))))
|
||||
|
@ -1149,7 +1149,7 @@ nsRangeList::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||
PRInt32 i;
|
||||
for (i = 0; i < mRangeArray->Count(); i++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range (mRangeArray->ElementAt(i));
|
||||
nsCOMPtr<nsIDOMRange> range (do_QueryInterface(mRangeArray->ElementAt(i)));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
PRInt32 endOffset;
|
||||
|
|
|
@ -1335,7 +1335,7 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetDocumentBase(const char* *result)
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
nsCOMPtr<nsIURL> docURL(doc->GetDocumentURL());
|
||||
nsCOMPtr<nsIURL> docURL( dont_AddRef(doc->GetDocumentURL()) );
|
||||
|
||||
nsresult rv = docURL->GetSpec(result);
|
||||
|
||||
|
|
|
@ -1335,7 +1335,7 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetDocumentBase(const char* *result)
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
nsCOMPtr<nsIURL> docURL(doc->GetDocumentURL());
|
||||
nsCOMPtr<nsIURL> docURL( dont_AddRef(doc->GetDocumentURL()) );
|
||||
|
||||
nsresult rv = docURL->GetSpec(result);
|
||||
|
||||
|
|
|
@ -2042,10 +2042,10 @@ void
|
|||
HTMLContentSink::ScrollToRef()
|
||||
{
|
||||
if (mNotAtRef && (nsnull != mRef) && (nsnull != mRefContent)) {
|
||||
// See if the ref content has been reflowed by finding it's frame
|
||||
// See if the ref content has been reflowed by finding its frame
|
||||
PRInt32 i, ns = mDocument->GetNumberOfShells();
|
||||
for (i = 0; i < ns; i++) {
|
||||
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
|
||||
nsCOMPtr<nsIPresShell> shell( dont_AddRef(mDocument->GetShellAt(i)) );
|
||||
if (shell) {
|
||||
nsIFrame* frame;
|
||||
shell->GetPrimaryFrameFor(mRefContent, &frame);
|
||||
|
|
|
@ -328,8 +328,8 @@ nsButtonControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
aDesiredLayoutSize.descent = 0;
|
||||
} else {
|
||||
#ifdef NS_GFX_RENDER_FORM_ELEMENTS
|
||||
nsCOMPtr<nsIStyleContext> outlineStyle(mStyleContext);
|
||||
nsCOMPtr<nsIAtom> sbAtom (NS_NewAtom(":button-outline"));
|
||||
nsCOMPtr<nsIStyleContext> outlineStyle( dont_QueryInterface(mStyleContext) );
|
||||
nsCOMPtr<nsIAtom> sbAtom ( dont_QueryInterface(NS_NewAtom(":button-outline")) );
|
||||
aPresContext->ProbePseudoStyleContextFor(mContent, sbAtom, mStyleContext, PR_FALSE, getter_AddRefs(outlineStyle));
|
||||
|
||||
const nsStyleSpacing* outline = (const nsStyleSpacing*)outlineStyle->GetStyleData(eStyleStruct_Spacing);
|
||||
|
@ -433,14 +433,14 @@ nsButtonControlFrame::PaintButton(nsIPresContext& aPresContext,
|
|||
|
||||
//nsIStyleContext* kidSC;
|
||||
|
||||
nsCOMPtr<nsIStyleContext> outlineStyle(mStyleContext);
|
||||
nsCOMPtr<nsIAtom> outlineAtom (NS_NewAtom(":button-outline"));
|
||||
nsCOMPtr<nsIStyleContext> outlineStyle( dont_QueryInterface(mStyleContext) );
|
||||
nsCOMPtr<nsIAtom> outlineAtom ( dont_QueryInterface(NS_NewAtom(":button-outline")) );
|
||||
aPresContext.ProbePseudoStyleContextFor(mContent, outlineAtom, mStyleContext,
|
||||
PR_FALSE,
|
||||
getter_AddRefs(outlineStyle));
|
||||
|
||||
nsCOMPtr<nsIStyleContext> focusStyle(mStyleContext);
|
||||
nsCOMPtr<nsIAtom> focusAtom (NS_NewAtom(":button-focus"));
|
||||
nsCOMPtr<nsIStyleContext> focusStyle( dont_QueryInterface(mStyleContext) );
|
||||
nsCOMPtr<nsIAtom> focusAtom ( dont_QueryInterface(NS_NewAtom(":button-focus")) );
|
||||
aPresContext.ProbePseudoStyleContextFor(mContent, focusAtom, mStyleContext,
|
||||
PR_FALSE,
|
||||
getter_AddRefs(focusStyle));
|
||||
|
|
|
@ -581,7 +581,7 @@ nsCSSFrameConstructor::ConstructTableGroupFrame(nsIPresContext* aPresContext,
|
|||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == styleDisplay->mDisplay)
|
||||
: (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == styleDisplay->mDisplay);
|
||||
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
nsCOMPtr<nsIStyleContext> parentStyleContext;
|
||||
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
|
||||
const nsStyleDisplay* parentDisplay =
|
||||
|
@ -720,7 +720,7 @@ nsCSSFrameConstructor::ConstructTableRowFrame(nsIPresContext* aPresContext,
|
|||
|
||||
// if groupStyleContext gets set, both it and styleContext need to be released
|
||||
nsCOMPtr<nsIStyleContext> groupStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
|
||||
const nsStyleDisplay* parentDisplay = GetDisplay(aParentFrame);
|
||||
if ((NS_STYLE_DISPLAY_TABLE_ROW_GROUP == parentDisplay->mDisplay) ||
|
||||
|
@ -875,7 +875,7 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresContext* aPresContext,
|
|||
const nsStyleDisplay* parentDisplay = (const nsStyleDisplay*)
|
||||
parentStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
nsCOMPtr<nsIStyleContext> styleContext(aStyleContext);
|
||||
nsCOMPtr<nsIStyleContext> styleContext( dont_QueryInterface(aStyleContext) );
|
||||
PRBool wrapContent = PR_FALSE;
|
||||
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW == parentDisplay->mDisplay) {
|
||||
|
|
|
@ -230,7 +230,7 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
|
|||
// XXX this is silly; who cares?
|
||||
PRInt32 i, ns = mDocument->GetNumberOfShells();
|
||||
for (i = 0; i < ns; i++) {
|
||||
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
|
||||
nsCOMPtr<nsIPresShell> shell( dont_AddRef(mDocument->GetShellAt(i)) );
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
|
|
|
@ -707,7 +707,7 @@ nsProgressMeterFrame :: RefreshStyleContext(nsIPresContext* aPresContext,
|
|||
PR_FALSE,
|
||||
&newStyleContext);
|
||||
if (newStyleContext != aCurrentStyle->get())
|
||||
*aCurrentStyle = newStyleContext;
|
||||
*aCurrentStyle = dont_QueryInterface(newStyleContext);
|
||||
|
||||
} // RefreshStyleContext
|
||||
|
||||
|
@ -720,7 +720,7 @@ nsProgressMeterFrame :: RefreshStyleContext(nsIPresContext* aPresContext,
|
|||
NS_IMETHODIMP
|
||||
nsProgressMeterFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> old ( mStyleContext );
|
||||
nsCOMPtr<nsIStyleContext> old ( dont_QueryInterface(mStyleContext) );
|
||||
|
||||
// this re-resolves |mStyleContext|, so it may change
|
||||
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext);
|
||||
|
|
|
@ -119,7 +119,7 @@ nsToolboxFrame :: RefreshStyleContext(nsIPresContext* aPresContext,
|
|||
PR_FALSE,
|
||||
&newStyleContext);
|
||||
if (newStyleContext != aCurrentStyle->get())
|
||||
*aCurrentStyle = newStyleContext;
|
||||
*aCurrentStyle = dont_QueryInterface(newStyleContext);
|
||||
|
||||
} // RefreshStyleContext
|
||||
|
||||
|
@ -132,7 +132,7 @@ nsToolboxFrame :: RefreshStyleContext(nsIPresContext* aPresContext,
|
|||
NS_IMETHODIMP
|
||||
nsToolboxFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> old ( mStyleContext );
|
||||
nsCOMPtr<nsIStyleContext> old ( dont_QueryInterface(mStyleContext) );
|
||||
|
||||
// this re-resolves |mStyleContext|, so it may change
|
||||
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext);
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
enum { kNoGrippyHilighted = -1 } ;
|
||||
|
||||
struct TabInfo {
|
||||
TabInfo ( ) : mToolbar(nsnull), mCollapsed(PR_TRUE) { };
|
||||
TabInfo ( ) : mCollapsed(PR_TRUE) { };
|
||||
|
||||
void SetProperties ( const nsRect & inBounds, const nsCOMPtr<nsIContent> & inContent,
|
||||
PRBool inCollapsed )
|
||||
|
|
Загрузка…
Ссылка в новой задаче