mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-14 12:04:03 +00:00
Fix for bug 183999 (Modernize content). r=caillon, sr=bz.
This commit is contained in:
parent
976d27bd73
commit
d96051a4a2
@ -1048,9 +1048,9 @@ nsContentAreaDragDrop::GetImageFrame(nsIContent* aContent, nsIDocument *aDocumen
|
||||
if (NS_SUCCEEDED(rv) && frame) {
|
||||
nsCOMPtr<nsIAtom> type;
|
||||
frame->GetFrameType(getter_AddRefs(type));
|
||||
if (type.get() == nsLayoutAtoms::imageFrame) {
|
||||
if (type == nsLayoutAtoms::imageFrame) {
|
||||
nsIImageFrame* imageFrame;
|
||||
rv = frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
|
||||
rv = CallQueryInterface(frame, &imageFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Should not happen - frame is not image frame even though type is nsLayoutAtoms::imageFrame");
|
||||
return rv;
|
||||
@ -1108,10 +1108,11 @@ nsContentAreaDragDrop::GetImageFromDOMNode(nsIDOMNode* inNode, nsIImage**outImag
|
||||
if (imgContainer) {
|
||||
nsCOMPtr<gfxIImageFrame> imgFrame;
|
||||
imgContainer->GetFrameAt(0, getter_AddRefs(imgFrame));
|
||||
if ( imgFrame ) {
|
||||
if (imgFrame) {
|
||||
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(imgFrame);
|
||||
if ( ir )
|
||||
rv = ir->GetInterface(NS_GET_IID(nsIImage), (void**)outImage); // will addreff
|
||||
if (ir) {
|
||||
rv = CallGetInterface(ir.get(), outImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,18 +284,22 @@ public:
|
||||
nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult)
|
||||
{
|
||||
nsContentIterator * iter = new nsContentIterator();
|
||||
if (iter)
|
||||
return iter->QueryInterface(NS_GET_IID(nsIContentIterator), (void**) aInstancePtrResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!iter) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(iter, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_NewPreContentIterator(nsIContentIterator** aInstancePtrResult)
|
||||
{
|
||||
nsContentIterator * iter = new nsPreContentIterator();
|
||||
if (iter)
|
||||
return iter->QueryInterface(NS_GET_IID(nsIContentIterator), (void**) aInstancePtrResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!iter) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(iter, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
@ -1218,11 +1222,11 @@ nsresult nsContentIterator::PositionAt(nsIContent* aCurNode)
|
||||
|
||||
nsresult nsContentIterator::CurrentNode(nsIContent **aNode)
|
||||
{
|
||||
if (!mCurNode)
|
||||
if (!mCurNode || mIsDone) {
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mIsDone)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mCurNode->QueryInterface(NS_GET_IID(nsIContent), (void**) aNode);
|
||||
}
|
||||
|
||||
return CallQueryInterface(mCurNode, aNode);
|
||||
}
|
||||
|
||||
|
||||
@ -1298,9 +1302,11 @@ nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aInstancePtrResult);
|
||||
nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aInstancePtrResult)
|
||||
{
|
||||
nsContentIterator * iter = new nsContentSubtreeIterator();
|
||||
if (iter)
|
||||
return iter->QueryInterface(NS_GET_IID(nsIContentIterator), (void**) aInstancePtrResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!iter) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(iter, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,9 +396,7 @@ nsContentUtils::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
|
||||
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
NS_GET_IID(nsIDOMScriptObjectFactory),
|
||||
(nsISupports **)&sDOMScriptObjectFactory);
|
||||
CallGetService(kDOMScriptObjectFactoryCID, &sDOMScriptObjectFactory);
|
||||
|
||||
if (!sDOMScriptObjectFactory) {
|
||||
return nsnull;
|
||||
|
@ -190,8 +190,7 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
||||
|
||||
if (mContent) {
|
||||
return mContent->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||
(void **)aOwnerElement);
|
||||
return CallQueryInterface(mContent, aOwnerElement);
|
||||
}
|
||||
|
||||
*aOwnerElement = nsnull;
|
||||
@ -292,13 +291,13 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
nsCOMPtr<nsITextContent> content;
|
||||
|
||||
result = NS_NewTextNode(getter_AddRefs(content));
|
||||
if (NS_OK != result) {
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
result = content->QueryInterface(NS_GET_IID(nsIDOMText), (void**)&mChild);
|
||||
result = CallQueryInterface(content, &mChild);
|
||||
}
|
||||
mChild->SetData(value);
|
||||
result = mChild->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aFirstChild);
|
||||
result = CallQueryInterface(mChild, aFirstChild);
|
||||
}
|
||||
else {
|
||||
*aFirstChild = nsnull;
|
||||
@ -387,7 +386,7 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return newAttr->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
return CallQueryInterface(newAttr, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -395,11 +394,9 @@ nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (mContent) {
|
||||
nsIDOMNode* node;
|
||||
result = mContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent, &result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = node->GetOwnerDocument(aOwnerDocument);
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -434,7 +431,7 @@ nsDOMAttribute::SetPrefix(const nsAString& aPrefix)
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!aPrefix.IsEmpty() && !DOMStringIsNull(aPrefix))
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
|
||||
rv = mNodeInfo->PrefixChanged(prefix, *getter_AddRefs(newNodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -104,8 +104,7 @@ nsDOMAttributeMap::GetNamedItem(const nsAString& aAttrName,
|
||||
domAttribute = new nsDOMAttribute(mContent, ni, value);
|
||||
NS_ENSURE_TRUE(domAttribute, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aAttribute);
|
||||
rv = CallQueryInterface(domAttribute, aAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,8 +158,7 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
}
|
||||
|
||||
attribute->GetValue(value);
|
||||
@ -204,8 +202,7 @@ nsDOMAttributeMap::RemoveNamedItem(const nsAString& aName,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
} else {
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
@ -247,8 +244,7 @@ nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
nsDOMAttribute* domAttribute = new nsDOMAttribute(mContent, ni, value);
|
||||
NS_ENSURE_TRUE(domAttribute, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
@ -284,7 +280,7 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (mContent) {
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
PRInt32 nameSpaceID = kNameSpaceID_None;
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
@ -318,8 +314,7 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
||||
domAttribute = new nsDOMAttribute(mContent, ni, value);
|
||||
NS_ENSURE_TRUE(domAttribute, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,8 +372,7 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
}
|
||||
|
||||
attribute->GetValue(value);
|
||||
@ -400,7 +394,7 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mContent) {
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
PRInt32 nameSpaceID = kNameSpaceID_None;
|
||||
nsCOMPtr<nsIDOMNode> attribute;
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
@ -436,8 +430,7 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = domAttribute->QueryInterface(NS_GET_IID(nsIDOMAttr),
|
||||
(void **)aReturn);
|
||||
rv = CallQueryInterface(domAttribute, aReturn);
|
||||
} else {
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
|
@ -198,10 +198,11 @@ nsDOMDocumentType::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
mPublicId,
|
||||
mSystemId,
|
||||
mInternalSubset);
|
||||
if (nsnull == it) {
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aReturn);
|
||||
|
||||
return CallQueryInterface(it, aReturn);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -319,9 +319,11 @@ NS_EXPORT nsresult
|
||||
NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult)
|
||||
{
|
||||
nsDOMImplementation* domImpl = new nsDOMImplementation();
|
||||
if (domImpl == nsnull)
|
||||
if (!domImpl) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return domImpl->QueryInterface(NS_GET_IID(nsIDOMDOMImplementation), (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
return CallQueryInterface(domImpl, aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsDOMImplementation::nsDOMImplementation(nsIURI* aBaseURI)
|
||||
@ -448,14 +450,14 @@ nsDocumentChildNodes::GetLength(PRUint32* aLength)
|
||||
NS_IMETHODIMP
|
||||
nsDocumentChildNodes::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
|
||||
*aReturn = nsnull;
|
||||
if (nsnull != mDocument) {
|
||||
|
||||
nsresult result = NS_OK;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
result = mDocument->ChildAt(aIndex, *getter_AddRefs(content));
|
||||
if ((NS_OK == result) && (nsnull != content)) {
|
||||
result = content->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
if (NS_SUCCEEDED(result) && content) {
|
||||
result = CallQueryInterface(content, aReturn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,9 +518,7 @@ nsDocument::nsDocument() : mSubDocuments(nsnull),
|
||||
mInDestructor = PR_FALSE;
|
||||
mHeaderData = nsnull;
|
||||
mChildNodes = nsnull;
|
||||
mModCount = 0;
|
||||
mNextContentID = NS_CONTENT_ID_COUNTER_BASE;
|
||||
mDTD = 0;
|
||||
mBoxObjectTable = nsnull;
|
||||
mNumCapturers = 0;
|
||||
#ifdef IBMBIDI
|
||||
@ -615,8 +615,6 @@ nsDocument::~nsDocument()
|
||||
mHeaderData = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mDTD);
|
||||
|
||||
delete mBoxObjectTable;
|
||||
|
||||
if (mNodeInfoManager) {
|
||||
@ -2285,8 +2283,7 @@ nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype)
|
||||
node->GetNodeType(&nodeType);
|
||||
|
||||
if (nodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) {
|
||||
return node->QueryInterface(NS_GET_IID(nsIDOMDocumentType),
|
||||
(void **)aDoctype);
|
||||
return CallQueryInterface(node, aDoctype);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2300,11 +2297,11 @@ nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
|
||||
// For now, create a new implementation every time. This shouldn't
|
||||
// be a high bandwidth operation
|
||||
nsDOMImplementation* impl = new nsDOMImplementation(mDocumentURL);
|
||||
if (nsnull == impl) {
|
||||
if (!impl) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return impl->QueryInterface(NS_GET_IID(nsIDOMDOMImplementation), (void**)aImplementation);
|
||||
return CallQueryInterface(impl, aImplementation);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2352,7 +2349,7 @@ nsDocument::CreateTextNode(const nsAString& aData, nsIDOMText** aReturn)
|
||||
nsresult rv = NS_NewTextNode(getter_AddRefs(text));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**)aReturn);
|
||||
rv = CallQueryInterface(text, aReturn);
|
||||
(*aReturn)->AppendData(aData);
|
||||
}
|
||||
|
||||
@ -2371,8 +2368,8 @@ nsDocument::CreateComment(const nsAString& aData, nsIDOMComment** aReturn)
|
||||
nsCOMPtr<nsIContent> comment;
|
||||
nsresult rv = NS_NewCommentNode(getter_AddRefs(comment));
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = comment->QueryInterface(NS_GET_IID(nsIDOMComment), (void**)aReturn);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = CallQueryInterface(comment, aReturn);
|
||||
(*aReturn)->AppendData(aData);
|
||||
}
|
||||
|
||||
@ -2413,7 +2410,7 @@ nsDocument::CreateAttribute(const nsAString& aName,
|
||||
attribute = new nsDOMAttribute(nsnull, nodeInfo, value);
|
||||
NS_ENSURE_TRUE(attribute, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return attribute->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**)aReturn);
|
||||
return CallQueryInterface(attribute, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2437,7 +2434,7 @@ NS_IMETHODIMP
|
||||
nsDocument::GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aTagname)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aTagname);
|
||||
|
||||
nsCOMPtr<nsIContentList> list;
|
||||
NS_GetContentList(this, nameAtom, kNameSpaceID_Unknown, nsnull,
|
||||
@ -2470,7 +2467,7 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
}
|
||||
|
||||
if (!list) {
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
NS_GetContentList(this, nameAtom, nameSpaceId, nsnull,
|
||||
getter_AddRefs(list));
|
||||
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
|
||||
@ -2614,7 +2611,7 @@ GetElementByAttribute(nsIContent* aContent,
|
||||
nsresult rv = aContent->GetAttr(kNameSpaceID_None, aAttrName, value);
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
if (aUniversalMatch || value.Equals(aAttrValue))
|
||||
return aContent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aResult);
|
||||
return CallQueryInterface(aContent, aResult);
|
||||
}
|
||||
|
||||
PRInt32 childCount;
|
||||
@ -2647,7 +2644,7 @@ nsDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement,
|
||||
if (!nodeList)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAtom> attribute = getter_AddRefs(NS_NewAtom(aAttrName));
|
||||
nsCOMPtr<nsIAtom> attribute = do_GetAtom(aAttrName);
|
||||
|
||||
PRUint32 length;
|
||||
nodeList->GetLength(&length);
|
||||
@ -2737,15 +2734,10 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
||||
rv = ctx->GetContainer(getter_AddRefs(container));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && container, rv);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> ifrq(do_QueryInterface(container));
|
||||
NS_ENSURE_TRUE(ifrq, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> window;
|
||||
ifrq->GetInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(window));
|
||||
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(container);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
window->QueryInterface(NS_GET_IID(nsIDOMAbstractView),
|
||||
(void **)aDefaultView);
|
||||
CallQueryInterface(window, aDefaultView);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3022,15 +3014,15 @@ nsDocument::GetParentNode(nsIDOMNode** aParentNode)
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
if (nsnull == mChildNodes) {
|
||||
if (!mChildNodes) {
|
||||
mChildNodes = new nsDocumentChildNodes(this);
|
||||
if (nsnull == mChildNodes) {
|
||||
if (!mChildNodes) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mChildNodes);
|
||||
}
|
||||
|
||||
return mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void**)aChildNodes);
|
||||
return CallQueryInterface(mChildNodes, aChildNodes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3461,7 +3453,7 @@ nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
nsresult nsDocument::GetListenerManager(nsIEventListenerManager **aInstancePtrResult)
|
||||
{
|
||||
if (nsnull != mListenerManager) {
|
||||
return mListenerManager->QueryInterface(NS_GET_IID(nsIEventListenerManager), (void**) aInstancePtrResult);
|
||||
return CallQueryInterface(mListenerManager, aInstancePtrResult);
|
||||
}
|
||||
if (NS_OK == NS_NewEventListenerManager(aInstancePtrResult)) {
|
||||
mListenerManager = *aInstancePtrResult;
|
||||
@ -3539,12 +3531,12 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsrefcnt rc;
|
||||
NS_RELEASE2(*aDOMEvent, rc);
|
||||
if (0 != rc) {
|
||||
//Okay, so someone in the DOM loop (a listener, JS object) still has a ref to the DOM Event but
|
||||
//the internal data hasn't been malloc'd. Force a copy of the data here so the DOM Event is still valid.
|
||||
nsIPrivateDOMEvent *mPrivateEvent;
|
||||
if (NS_OK == (*aDOMEvent)->QueryInterface(NS_GET_IID(nsIPrivateDOMEvent), (void**)&mPrivateEvent)) {
|
||||
mPrivateEvent->DuplicatePrivateData();
|
||||
NS_RELEASE(mPrivateEvent);
|
||||
// Okay, so someone in the DOM loop (a listener, JS object) still has
|
||||
// a ref to the DOM Event but the internal data hasn't been malloc'd.
|
||||
// Force a copy of the data here so the DOM Event is still valid.
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (privateEvent) {
|
||||
privateEvent->DuplicatePrivateData();
|
||||
}
|
||||
}
|
||||
aDOMEvent = nsnull;
|
||||
|
@ -657,14 +657,8 @@ protected:
|
||||
PRBool mBidiEnabled;
|
||||
#endif // IBMBIDI
|
||||
|
||||
// disk file members
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
PRInt32 mModCount;
|
||||
|
||||
nsIDTD* mDTD;
|
||||
|
||||
nsCOMPtr<nsIBindingManager> mBindingManager;
|
||||
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // OWNER
|
||||
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
|
||||
|
||||
PRBool mIsGoingAway; // True if the document is being destroyed.
|
||||
|
||||
|
@ -527,7 +527,7 @@ static nsresult ChildAt(nsIDOMNode* aNode, PRInt32 aIndex, nsIDOMNode*& aChild)
|
||||
node->ChildAt(aIndex, *getter_AddRefs(child));
|
||||
|
||||
if (child)
|
||||
child->QueryInterface(NS_GET_IID(nsIDOMNode), (void **)&aChild);
|
||||
return CallQueryInterface(child, &aChild);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -345,8 +345,7 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return mOwnerDocument->QueryInterface(NS_GET_IID(nsIDOMDocument),
|
||||
(void **)aOwnerDocument);
|
||||
return CallQueryInterface(mOwnerDocument, aOwnerDocument);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1785,7 +1785,7 @@ DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent,
|
||||
|
||||
// do a breadth search across all siblings
|
||||
PRInt32 inx;
|
||||
for (inx=0;inx<numChildren;inx++) {
|
||||
for (inx = 0; inx < numChildren; ++inx) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
if (NS_SUCCEEDED(aParentContent->ChildAt(inx, *getter_AddRefs(child))) && child) {
|
||||
nsCOMPtr<nsISupports> temp;
|
||||
@ -1869,7 +1869,7 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
nsISupports* data = (nsISupports*)clientData;
|
||||
|
||||
if (data) {
|
||||
data->QueryInterface(NS_GET_IID(nsIView), (void **)&containerView);
|
||||
CallQueryInterface(data, &containerView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,9 +188,11 @@ private:
|
||||
nsresult NS_NewGenRegularIterator(nsIContentIterator ** aInstancePtrResult)
|
||||
{
|
||||
nsGeneratedContentIterator * iter = new nsGeneratedContentIterator();
|
||||
if (iter)
|
||||
return iter->QueryInterface(NS_GET_IID(nsIContentIterator), (void**) aInstancePtrResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!iter) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(iter, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
@ -825,13 +827,15 @@ nsresult nsGeneratedContentIterator::PositionAt(nsIContent* aCurNode)
|
||||
|
||||
nsresult nsGeneratedContentIterator::CurrentNode(nsIContent **aNode)
|
||||
{
|
||||
if (!mCurNode)
|
||||
if (!mCurNode || mIsDone) {
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mIsDone)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (mGenIter)
|
||||
}
|
||||
|
||||
if (mGenIter) {
|
||||
return mGenIter->CurrentNode(aNode);
|
||||
return mCurNode->QueryInterface(NS_GET_IID(nsIContent), (void**) aNode);
|
||||
}
|
||||
|
||||
return CallQueryInterface(mCurNode, aNode);
|
||||
}
|
||||
|
||||
|
||||
@ -893,9 +897,11 @@ nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
|
||||
nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult)
|
||||
{
|
||||
nsGeneratedSubtreeIterator * iter = new nsGeneratedSubtreeIterator();
|
||||
if (iter)
|
||||
return iter->QueryInterface(NS_GET_IID(nsIContentIterator), (void**) aInstancePtrResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!iter) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(iter, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1146,7 +1146,7 @@ nsGenericDOMDataNode::SplitText(PRUint32 aOffset, nsIDOMText** aReturn)
|
||||
}
|
||||
}
|
||||
|
||||
return newNode->QueryInterface(NS_GET_IID(nsIDOMText), (void**)aReturn);
|
||||
return CallQueryInterface(newNode, aReturn);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -1221,7 +1221,7 @@ nsGenericDOMDataNode::SetText(const PRUnichar* aBuffer,
|
||||
// XXX Handle the setting of prevValue!
|
||||
nsAutoString newVal(aBuffer);
|
||||
if (!newVal.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(newVal));
|
||||
mutation.mNewAttrValue = do_GetAtom(newVal);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(nsnull, &mutation, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
@ -1263,7 +1263,7 @@ nsGenericDOMDataNode::SetText(const char* aBuffer, PRInt32 aLength,
|
||||
// XXX Handle the setting of prevValue!
|
||||
nsAutoString newVal; newVal.AssignWithConversion(aBuffer);
|
||||
if (!newVal.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(newVal));
|
||||
mutation.mNewAttrValue = do_GetAtom(newVal);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(nsnull, &mutation, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
@ -1302,7 +1302,7 @@ nsGenericDOMDataNode::SetText(const nsAString& aStr,
|
||||
// XXX Handle the setting of prevValue!
|
||||
nsAutoString newVal(aStr);
|
||||
if (!newVal.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(newVal));
|
||||
mutation.mNewAttrValue = do_GetAtom(newVal);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(nsnull, &mutation, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
@ -147,22 +147,17 @@ nsChildContentList::GetLength(PRUint32* aLength)
|
||||
NS_IMETHODIMP
|
||||
nsChildContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsIContent *content;
|
||||
nsresult res = NS_OK;
|
||||
*aReturn = nsnull;
|
||||
|
||||
if (nsnull != mContent) {
|
||||
mContent->ChildAt(aIndex, content);
|
||||
if (nsnull != content) {
|
||||
res = content->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
NS_RELEASE(content);
|
||||
} else {
|
||||
*aReturn = nsnull;
|
||||
if (mContent) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mContent->ChildAt(aIndex, *getter_AddRefs(content));
|
||||
if (content) {
|
||||
return CallQueryInterface(content, aReturn);
|
||||
}
|
||||
} else {
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
|
||||
return res;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -380,7 +375,7 @@ nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
|
||||
nsCOMPtr<nsIAtom> name;
|
||||
|
||||
if (!aNamespacePrefix.IsEmpty()) {
|
||||
name = dont_AddRef(NS_NewAtom(aNamespacePrefix));
|
||||
name = do_GetAtom(aNamespacePrefix);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
name = nsLayoutAtoms::xmlnsNameSpace;
|
||||
@ -968,14 +963,14 @@ nsGenericElement::GetParentNode(nsIDOMNode** aParentNode)
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::GetPreviousSibling(nsIDOMNode** aPrevSibling)
|
||||
{
|
||||
nsIContent* sibling = nsnull;
|
||||
nsresult result = NS_OK;
|
||||
*aPrevSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> sibling;
|
||||
if (mParent) {
|
||||
PRInt32 pos;
|
||||
mParent->IndexOf(this, pos);
|
||||
if (pos > 0 ) {
|
||||
mParent->ChildAt(--pos, sibling);
|
||||
mParent->ChildAt(--pos, *getter_AddRefs(sibling));
|
||||
}
|
||||
} else if (mDocument) {
|
||||
// Nodes that are just below the document (their parent is the
|
||||
@ -983,17 +978,14 @@ nsGenericElement::GetPreviousSibling(nsIDOMNode** aPrevSibling)
|
||||
PRInt32 pos;
|
||||
mDocument->IndexOf(this, pos);
|
||||
if (pos > 0 ) {
|
||||
mDocument->ChildAt(--pos, sibling);
|
||||
mDocument->ChildAt(--pos, *getter_AddRefs(sibling));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult result = NS_OK;
|
||||
if (sibling) {
|
||||
result = sibling->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aPrevSibling);
|
||||
NS_ASSERTION(NS_OK == result, "Must be a DOM Node");
|
||||
NS_RELEASE(sibling); // balance the AddRef in ChildAt()
|
||||
} else {
|
||||
*aPrevSibling = nsnull;
|
||||
result = CallQueryInterface(sibling, aPrevSibling);
|
||||
NS_ASSERTION(*aPrevSibling, "Must be a DOM Node");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1002,14 +994,14 @@ nsGenericElement::GetPreviousSibling(nsIDOMNode** aPrevSibling)
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
{
|
||||
nsIContent* sibling = nsnull;
|
||||
nsresult result = NS_OK;
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> sibling;
|
||||
if (mParent) {
|
||||
PRInt32 pos;
|
||||
mParent->IndexOf(this, pos);
|
||||
if (pos > -1 ) {
|
||||
mParent->ChildAt(++pos, sibling);
|
||||
mParent->ChildAt(++pos, *getter_AddRefs(sibling));
|
||||
}
|
||||
} else if (mDocument) {
|
||||
// Nodes that are just below the document (their parent is the
|
||||
@ -1017,17 +1009,14 @@ nsGenericElement::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
PRInt32 pos;
|
||||
mDocument->IndexOf(this, pos);
|
||||
if (pos > -1 ) {
|
||||
mDocument->ChildAt(++pos, sibling);
|
||||
mDocument->ChildAt(++pos, *getter_AddRefs(sibling));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult result = NS_OK;
|
||||
if (sibling) {
|
||||
result = sibling->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNextSibling);
|
||||
NS_ASSERTION(NS_OK == result, "Must be a DOM Node");
|
||||
NS_RELEASE(sibling); // balance the AddRef in ChildAt()
|
||||
} else {
|
||||
*aNextSibling = nsnull;
|
||||
result = CallQueryInterface(sibling, aNextSibling);
|
||||
NS_ASSERTION(*aNextSibling, "Must be a DOM Node");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1076,7 +1065,7 @@ nsGenericElement::SetPrefix(const nsAString& aPrefix)
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty() && !DOMStringIsNull(aPrefix)) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -1338,7 +1327,7 @@ nsGenericElement::GetElementsByTagName(const nsAString& aTagname,
|
||||
{
|
||||
nsCOMPtr<nsIAtom> nameAtom;
|
||||
|
||||
nameAtom = dont_AddRef(NS_NewAtom(aTagname));
|
||||
nameAtom = do_GetAtom(aTagname);
|
||||
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsIContentList> list;
|
||||
@ -1357,7 +1346,7 @@ nsGenericElement::GetAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
|
||||
PRInt32 nsid;
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
@ -1396,7 +1385,7 @@ nsresult
|
||||
nsGenericElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
|
||||
PRInt32 nsid;
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
@ -1465,7 +1454,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRInt32 nameSpaceId = kNameSpaceID_Unknown;
|
||||
@ -1519,7 +1508,7 @@ nsGenericElement::HasAttributeNS(const nsAString& aNamespaceURI,
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
|
||||
PRInt32 nsid;
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
@ -2880,8 +2869,7 @@ nsGenericElement::doReplaceChild(nsIDOMNode* aNewChild,
|
||||
}
|
||||
}
|
||||
|
||||
return replacedChild->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void **)aReturn);
|
||||
return CallQueryInterface(replacedChild, aReturn);
|
||||
}
|
||||
|
||||
|
||||
@ -3045,8 +3033,8 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsCOMPtr<nsIScriptContext> context = nsnull;
|
||||
nsCOMPtr<nsIScriptGlobalObject> global = nsnull;
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
JSContext* cx = nsnull;
|
||||
|
||||
//Try to get context from doc
|
||||
@ -3212,25 +3200,20 @@ nsGenericContainerElement::CopyInnerTo(nsIContent* aSrcContent,
|
||||
PRInt32 count = mChildren.Count();
|
||||
for (index = 0; index < count; index++) {
|
||||
nsIContent* child = (nsIContent*)mChildren.ElementAt(index);
|
||||
if (nsnull != child) {
|
||||
nsIDOMNode* node;
|
||||
result = child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
||||
if (NS_OK == result) {
|
||||
nsIDOMNode* newNode;
|
||||
if (child) {
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(child, &result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
|
||||
result = node->CloneNode(aDeep, &newNode);
|
||||
if (NS_OK == result) {
|
||||
nsIContent* newContent;
|
||||
result = node->CloneNode(aDeep, getter_AddRefs(newNode));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIContent> newContent = do_QueryInterface(newNode,
|
||||
&result);
|
||||
|
||||
result = newNode->QueryInterface(NS_GET_IID(nsIContent),
|
||||
(void**)&newContent);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = aDst->AppendChildTo(newContent, PR_FALSE, PR_FALSE);
|
||||
NS_RELEASE(newContent);
|
||||
}
|
||||
NS_RELEASE(newNode);
|
||||
}
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
|
||||
if (NS_OK != result) {
|
||||
@ -3274,13 +3257,15 @@ nsresult
|
||||
nsGenericContainerElement::GetFirstChild(nsIDOMNode** aNode)
|
||||
{
|
||||
nsIContent *child = (nsIContent *)mChildren.SafeElementAt(0);
|
||||
if (nsnull != child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
if (child) {
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
*aNode = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3289,14 +3274,16 @@ nsGenericContainerElement::GetLastChild(nsIDOMNode** aNode)
|
||||
{
|
||||
if (mChildren.Count() != 0) {
|
||||
nsIContent *child = (nsIContent *)mChildren.ElementAt(mChildren.Count()-1);
|
||||
if (nsnull != child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
if (child) {
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
*aNode = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3462,11 +3449,11 @@ nsGenericContainerElement::SetAttr(nsINodeInfo* aNodeInfo,
|
||||
|
||||
mutation.mAttrName = name;
|
||||
if (!oldValue.IsEmpty()) {
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(oldValue);
|
||||
}
|
||||
|
||||
if (!aValue.IsEmpty()) {
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||
mutation.mNewAttrValue = do_GetAtom(aValue);
|
||||
}
|
||||
|
||||
if (modification) {
|
||||
@ -3607,7 +3594,7 @@ nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID,
|
||||
|
||||
mutation.mAttrName = aName;
|
||||
if (!attr->mValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(attr->mValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(attr->mValue);
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -75,7 +75,7 @@ nsresult NS_NewHTMLContentSerializer(nsIContentSerializer** aSerializer)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIContentSerializer), (void**)aSerializer);
|
||||
return CallQueryInterface(it, aSerializer);
|
||||
}
|
||||
|
||||
nsHTMLContentSerializer::nsHTMLContentSerializer()
|
||||
|
@ -226,7 +226,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
||||
{
|
||||
NS_ENSURE_ARG(!aName.IsEmpty());
|
||||
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return GetNodeInfo(name, aPrefix, aNamespaceID, aNodeInfo);
|
||||
@ -240,13 +240,13 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName,
|
||||
{
|
||||
NS_ENSURE_ARG(!aName.IsEmpty());
|
||||
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -262,13 +262,13 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName,
|
||||
{
|
||||
NS_ENSURE_ARG(!aName.IsEmpty());
|
||||
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -295,13 +295,13 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aQualifiedName,
|
||||
name.Cut(0, nsoffset+1);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(name)));
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(name);
|
||||
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsIAtom> prefixAtom;
|
||||
|
||||
if (!prefix.IsEmpty()) {
|
||||
prefixAtom = dont_AddRef(NS_NewAtom(prefix));
|
||||
prefixAtom = do_GetAtom(prefix);
|
||||
NS_ENSURE_TRUE(prefixAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,7 @@ nsresult NS_NewPlainTextSerializer(nsIContentSerializer** aSerializer)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIContentSerializer),
|
||||
(void**)aSerializer);
|
||||
return CallQueryInterface(it, aSerializer);
|
||||
}
|
||||
|
||||
nsPlainTextSerializer::nsPlainTextSerializer()
|
||||
|
@ -4788,19 +4788,18 @@ int RemoveFilesInDir(const char * aDir)
|
||||
*/
|
||||
static void RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
if((nsnull == aPresContext) || (nsnull == out))
|
||||
if (!aPresContext || !out)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (nsnull != shell) {
|
||||
if (shell) {
|
||||
nsIFrame* frame;
|
||||
shell->GetRootFrame(&frame);
|
||||
if(nsnull != frame) {
|
||||
if (frame) {
|
||||
nsIFrameDebug* debugFrame;
|
||||
nsresult rv;
|
||||
rv = frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&debugFrame);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
nsresult rv = CallQueryInterface(frame, &debugFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
debugFrame->List(aPresContext, out, aIndent);
|
||||
}
|
||||
}
|
||||
|
@ -306,14 +306,14 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
|
||||
nsresult
|
||||
NS_NewRangeUtils(nsIRangeUtils** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsRangeUtils* rangeUtil = new nsRangeUtils();
|
||||
if (rangeUtil)
|
||||
return rangeUtil->QueryInterface(NS_GET_IID(nsIRangeUtils), (void**) aResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!rangeUtil) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(rangeUtil, aResult);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@ -400,15 +400,16 @@ nsRangeUtils::CompareNodeToRange(nsIContent* aNode,
|
||||
nsresult
|
||||
NS_NewRange(nsIDOMRange** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsRange * range = new nsRange();
|
||||
if (range)
|
||||
return range->QueryInterface(NS_GET_IID(nsIDOMRange), (void**) aResult);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!range) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(range, aResult);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* constructor/destructor
|
||||
******************************************************/
|
||||
@ -608,10 +609,9 @@ nsresult nsRange::AddToListOf(nsIDOMNode* aNode)
|
||||
{
|
||||
if (!aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIContent> cN;
|
||||
|
||||
nsresult res = aNode->QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(cN));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIContent> cN = do_QueryInterface(aNode, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
@ -624,10 +624,9 @@ nsresult nsRange::RemoveFromListOf(nsIDOMNode* aNode)
|
||||
{
|
||||
if (!aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIContent> cN;
|
||||
|
||||
nsresult res = aNode->QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(cN));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIContent> cN = do_QueryInterface(aNode, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
@ -836,29 +835,26 @@ PRBool nsRange::IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOffset,
|
||||
|
||||
PRInt32 nsRange::IndexOf(nsIDOMNode* aChildNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
nsCOMPtr<nsIContent> contentChild;
|
||||
nsCOMPtr<nsIContent> contentParent;
|
||||
PRInt32 theIndex = nsnull;
|
||||
|
||||
if (!aChildNode)
|
||||
return 0;
|
||||
|
||||
// get the parent node
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
nsresult res = aChildNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (NS_FAILED(res))
|
||||
return 0;
|
||||
|
||||
// convert node and parent to nsIContent, so that we can find the child index
|
||||
res = parentNode->QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(contentParent));
|
||||
nsCOMPtr<nsIContent> contentParent = do_QueryInterface(parentNode, &res);
|
||||
if (NS_FAILED(res))
|
||||
return 0;
|
||||
|
||||
res = aChildNode->QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(contentChild));
|
||||
nsCOMPtr<nsIContent> contentChild = do_QueryInterface(aChildNode, &res);
|
||||
if (NS_FAILED(res))
|
||||
return 0;
|
||||
|
||||
// finally we get the index
|
||||
PRInt32 theIndex = 0;
|
||||
res = contentParent->IndexOf(contentChild,theIndex);
|
||||
if (NS_FAILED(res))
|
||||
return 0;
|
||||
@ -2585,168 +2581,155 @@ NS_IMETHODIMP
|
||||
nsRange::CreateContextualFragment(const nsAString& aFragment,
|
||||
nsIDOMDocumentFragment** aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
nsVoidArray tagStack;
|
||||
|
||||
if (!mIsPositioned) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Create a new parser for this entire operation
|
||||
result = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIParser),
|
||||
(void **)getter_AddRefs(parser));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID, &result);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mStartParent, &result));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mStartParent, &result);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
|
||||
result = content->GetDocument(*getter_AddRefs(document));
|
||||
if (document && NS_SUCCEEDED(result)) {
|
||||
domDocument = do_QueryInterface(document, &result);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
|
||||
result = content->GetDocument(*getter_AddRefs(document));
|
||||
domDocument = do_QueryInterface(document, &result);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsVoidArray tagStack;
|
||||
nsCOMPtr<nsIDOMNode> parent = mStartParent;
|
||||
while (parent &&
|
||||
(parent != domDocument) &&
|
||||
NS_SUCCEEDED(result)) {
|
||||
PRUint16 nodeType;
|
||||
|
||||
parent->GetNodeType(&nodeType);
|
||||
if (nsIDOMNode::ELEMENT_NODE == nodeType) {
|
||||
nsAutoString tagName;
|
||||
parent->GetNodeName(tagName);
|
||||
// XXX Wish we didn't have to allocate here
|
||||
PRUnichar* name = ToNewUnicode(tagName);
|
||||
if (name) {
|
||||
tagStack.AppendElement(name);
|
||||
nsCOMPtr<nsIDOMNode> temp = parent;
|
||||
result = temp->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
|
||||
parent = mStartParent;
|
||||
while (parent &&
|
||||
(parent != domDocument) &&
|
||||
NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString tagName;
|
||||
PRUnichar* name = nsnull;
|
||||
PRUint16 nodeType;
|
||||
|
||||
parent->GetNodeType(&nodeType);
|
||||
if (nsIDOMNode::ELEMENT_NODE == nodeType) {
|
||||
parent->GetNodeName(tagName);
|
||||
// XXX Wish we didn't have to allocate here
|
||||
name = ToNewUnicode(tagName);
|
||||
if (name) {
|
||||
tagStack.AppendElement(name);
|
||||
temp = parent;
|
||||
result = temp->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
temp = parent;
|
||||
result = temp->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCAutoString contentType;
|
||||
nsIHTMLFragmentContentSink* sink;
|
||||
|
||||
result = NS_NewHTMLFragmentContentSink(&sink);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
parser->SetContentSink(sink);
|
||||
nsCOMPtr<nsIDOMNSDocument> domnsDocument(do_QueryInterface(document));
|
||||
if (domnsDocument) {
|
||||
nsAutoString buf;
|
||||
domnsDocument->GetContentType(buf);
|
||||
CopyUCS2toASCII(buf, contentType);
|
||||
}
|
||||
else {
|
||||
// Who're we kidding. This only works for html.
|
||||
contentType = NS_LITERAL_CSTRING("text/html");
|
||||
}
|
||||
|
||||
// If there's no JS or system JS running,
|
||||
// push the current document's context on the JS context stack
|
||||
// so that event handlers in the fragment do not get
|
||||
// compiled with the system principal.
|
||||
nsCOMPtr<nsIJSContextStack> ContextStack;
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &result);
|
||||
if (document && NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPrincipal> sysPrin;
|
||||
nsCOMPtr<nsIPrincipal> subjectPrin;
|
||||
|
||||
// Just to compare, not to use!
|
||||
result = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin));
|
||||
if (NS_SUCCEEDED(result))
|
||||
result = secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrin));
|
||||
// If there's no subject principal, there's no JS running, so we're in system code.
|
||||
// (just in case...null subject principal will probably never happen)
|
||||
if (NS_SUCCEEDED(result) &&
|
||||
(!subjectPrin || sysPrin.get() == subjectPrin.get())) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj;
|
||||
result = document->GetScriptGlobalObject(getter_AddRefs(globalObj));
|
||||
|
||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
||||
if (NS_SUCCEEDED(result) && globalObj) {
|
||||
result = globalObj->GetContext(getter_AddRefs(scriptContext));
|
||||
}
|
||||
|
||||
JSContext* cx = nsnull;
|
||||
if (NS_SUCCEEDED(result) && scriptContext) {
|
||||
cx = (JSContext*)scriptContext->GetNativeContext();
|
||||
}
|
||||
|
||||
if(cx) {
|
||||
ContextStack = do_GetService("@mozilla.org/js/xpc/ContextStack;1", &result);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
result = ContextStack->Push(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsDTDMode mode = eDTDMode_autodetect;
|
||||
nsCOMPtr<nsIDOMDocument> ownerDoc;
|
||||
mStartParent->GetOwnerDocument(getter_AddRefs(ownerDoc));
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(ownerDoc));
|
||||
if (htmlDoc) {
|
||||
nsCompatibility compatMode;
|
||||
htmlDoc->GetCompatibilityMode(compatMode);
|
||||
switch (compatMode) {
|
||||
case eCompatibility_NavQuirks:
|
||||
mode = eDTDMode_quirks;
|
||||
break;
|
||||
case eCompatibility_AlmostStandards:
|
||||
mode = eDTDMode_almost_standards;
|
||||
break;
|
||||
case eCompatibility_FullStandards:
|
||||
mode = eDTDMode_full_standards;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("unknown mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = parser->ParseFragment(aFragment, (void*)0,
|
||||
tagStack,
|
||||
0, contentType, mode);
|
||||
|
||||
if (ContextStack) {
|
||||
JSContext *notused;
|
||||
ContextStack->Pop(¬used);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
sink->GetFragment(aReturn);
|
||||
}
|
||||
|
||||
NS_RELEASE(sink);
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Ick! Delete strings we allocated above.
|
||||
PRInt32 count = tagStack.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
PRUnichar* str = (PRUnichar*)tagStack.ElementAt(i);
|
||||
if (str) {
|
||||
nsCRT::free(str);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMNode> temp = parent;
|
||||
result = temp->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCAutoString contentType;
|
||||
nsCOMPtr<nsIHTMLFragmentContentSink> sink;
|
||||
|
||||
result = NS_NewHTMLFragmentContentSink(getter_AddRefs(sink));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
parser->SetContentSink(sink);
|
||||
nsCOMPtr<nsIDOMNSDocument> domnsDocument(do_QueryInterface(document));
|
||||
if (domnsDocument) {
|
||||
nsAutoString buf;
|
||||
domnsDocument->GetContentType(buf);
|
||||
CopyUCS2toASCII(buf, contentType);
|
||||
}
|
||||
else {
|
||||
// Who're we kidding. This only works for html.
|
||||
contentType = NS_LITERAL_CSTRING("text/html");
|
||||
}
|
||||
|
||||
// If there's no JS or system JS running,
|
||||
// push the current document's context on the JS context stack
|
||||
// so that event handlers in the fragment do not get
|
||||
// compiled with the system principal.
|
||||
nsCOMPtr<nsIJSContextStack> ContextStack;
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &result);
|
||||
if (document && NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIPrincipal> sysPrin;
|
||||
nsCOMPtr<nsIPrincipal> subjectPrin;
|
||||
|
||||
// Just to compare, not to use!
|
||||
result = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin));
|
||||
if (NS_SUCCEEDED(result))
|
||||
result = secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrin));
|
||||
// If there's no subject principal, there's no JS running, so we're in system code.
|
||||
// (just in case...null subject principal will probably never happen)
|
||||
if (NS_SUCCEEDED(result) &&
|
||||
(!subjectPrin || sysPrin.get() == subjectPrin.get())) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj;
|
||||
result = document->GetScriptGlobalObject(getter_AddRefs(globalObj));
|
||||
|
||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
||||
if (NS_SUCCEEDED(result) && globalObj) {
|
||||
result = globalObj->GetContext(getter_AddRefs(scriptContext));
|
||||
}
|
||||
|
||||
JSContext* cx = nsnull;
|
||||
if (NS_SUCCEEDED(result) && scriptContext) {
|
||||
cx = (JSContext*)scriptContext->GetNativeContext();
|
||||
}
|
||||
|
||||
if(cx) {
|
||||
ContextStack = do_GetService("@mozilla.org/js/xpc/ContextStack;1", &result);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
result = ContextStack->Push(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsDTDMode mode = eDTDMode_autodetect;
|
||||
nsCOMPtr<nsIDOMDocument> ownerDoc;
|
||||
mStartParent->GetOwnerDocument(getter_AddRefs(ownerDoc));
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(ownerDoc));
|
||||
if (htmlDoc) {
|
||||
nsCompatibility compatMode;
|
||||
htmlDoc->GetCompatibilityMode(compatMode);
|
||||
switch (compatMode) {
|
||||
case eCompatibility_NavQuirks:
|
||||
mode = eDTDMode_quirks;
|
||||
break;
|
||||
case eCompatibility_AlmostStandards:
|
||||
mode = eDTDMode_almost_standards;
|
||||
break;
|
||||
case eCompatibility_FullStandards:
|
||||
mode = eDTDMode_full_standards;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("unknown mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = parser->ParseFragment(aFragment, (void*)0,
|
||||
tagStack,
|
||||
0, contentType, mode);
|
||||
|
||||
if (ContextStack) {
|
||||
JSContext *notused;
|
||||
ContextStack->Pop(¬used);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
sink->GetFragment(aReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Ick! Delete strings we allocated above.
|
||||
PRInt32 count = tagStack.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
PRUnichar* str = (PRUnichar*)tagStack.ElementAt(i);
|
||||
if (str) {
|
||||
nsCRT::free(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,11 +101,12 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
//nodtifications
|
||||
// notifications
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsISelectionController.h"//for the enums
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
#define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;}
|
||||
|
||||
@ -532,12 +533,6 @@ private:
|
||||
PRPackedBool mMouseDoubleDownState; //has the doubleclick down happened
|
||||
PRPackedBool mDesiredXSet;
|
||||
short mReason; //reason for notifications of selection changing
|
||||
public:
|
||||
static nsIAtom *sTableAtom;
|
||||
static nsIAtom *sRowAtom;
|
||||
static nsIAtom *sCellAtom;
|
||||
static nsIAtom *sTbodyAtom;
|
||||
static PRInt32 sInstanceCount;
|
||||
};
|
||||
|
||||
class nsSelectionIterator : public nsIBidirectionalEnumerator
|
||||
@ -715,13 +710,6 @@ nsresult NS_NewDomSelection(nsISelection **aDomSelection)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//Horrible statics but no choice
|
||||
nsIAtom *nsSelection::sTableAtom = 0;
|
||||
nsIAtom *nsSelection::sRowAtom = 0;
|
||||
nsIAtom *nsSelection::sCellAtom = 0;
|
||||
nsIAtom *nsSelection::sTbodyAtom = 0;
|
||||
PRInt32 nsSelection::sInstanceCount = 0;
|
||||
|
||||
static PRInt8
|
||||
GetIndexFromSelectionType(SelectionType aType)
|
||||
{
|
||||
@ -978,15 +966,7 @@ nsSelection::nsSelection()
|
||||
|
||||
mMouseDoubleDownState = PR_FALSE;
|
||||
|
||||
if (sInstanceCount <= 0)
|
||||
{
|
||||
sTableAtom = NS_NewAtom("table");
|
||||
sRowAtom = NS_NewAtom("tr");
|
||||
sCellAtom = NS_NewAtom("td");
|
||||
sTbodyAtom = NS_NewAtom("tbody");
|
||||
}
|
||||
mHint = HINTLEFT;
|
||||
sInstanceCount ++;
|
||||
mDragSelectingCells = PR_FALSE;
|
||||
mSelectingTableCellMode = 0;
|
||||
mSelectedCellIndex = 0;
|
||||
@ -1024,19 +1004,11 @@ nsSelection::nsSelection()
|
||||
|
||||
nsSelection::~nsSelection()
|
||||
{
|
||||
if (sInstanceCount <= 1)
|
||||
{
|
||||
NS_IF_RELEASE(sTableAtom);
|
||||
NS_IF_RELEASE(sRowAtom);
|
||||
NS_IF_RELEASE(sCellAtom);
|
||||
NS_IF_RELEASE(sTbodyAtom);
|
||||
}
|
||||
PRInt32 i;
|
||||
for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){
|
||||
if (mDomSelections[i])
|
||||
NS_IF_RELEASE(mDomSelections[i]);
|
||||
}
|
||||
sInstanceCount--;
|
||||
}
|
||||
|
||||
|
||||
@ -1445,8 +1417,7 @@ ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset)
|
||||
if (!aNode || !aParent || !aChildOffset)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
result = aNode->QueryInterface(NS_GET_IID(nsIContent),getter_AddRefs(content));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode, &result);
|
||||
if (NS_SUCCEEDED(result) && content)
|
||||
{
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
@ -1454,8 +1425,9 @@ ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset)
|
||||
if (NS_SUCCEEDED(result) && parent)
|
||||
{
|
||||
result = parent->IndexOf(content, *aChildOffset);
|
||||
if (NS_SUCCEEDED(result))
|
||||
result = parent->QueryInterface(NS_GET_IID(nsIDOMNode),(void **)aParent);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = CallQueryInterface(parent, aParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -1474,7 +1446,7 @@ GetCellParent(nsIDOMNode *aDomNode)
|
||||
while(current)
|
||||
{
|
||||
tag = GetTag(current);
|
||||
if (tag == nsSelection::sCellAtom)
|
||||
if (tag == nsHTMLAtoms::td)
|
||||
return current;
|
||||
if (NS_FAILED(ParentOffset(current,getter_AddRefs(parent),&childOffset)) || !parent)
|
||||
return 0;
|
||||
@ -1892,11 +1864,12 @@ nsresult FindLineContaining(nsIFrame* aFrame, nsIFrame** aBlock, PRInt32* aLine)
|
||||
{
|
||||
thisBlock = blockFrame;
|
||||
result = blockFrame->GetParent(&blockFrame);
|
||||
if (NS_SUCCEEDED(result) && blockFrame){
|
||||
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
|
||||
if (NS_SUCCEEDED(result) && blockFrame) {
|
||||
it = do_QueryInterface(blockFrame, &result);
|
||||
}
|
||||
else
|
||||
else {
|
||||
blockFrame = nsnull;
|
||||
}
|
||||
}
|
||||
if (!blockFrame || !it)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2345,11 +2318,12 @@ nsSelection::GetPrevNextBidiLevels(nsIPresContext *aPresContext,
|
||||
{
|
||||
thisBlock = blockFrame;
|
||||
result = blockFrame->GetParent(&blockFrame);
|
||||
if (NS_SUCCEEDED(result) && blockFrame){
|
||||
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
|
||||
if (NS_SUCCEEDED(result) && blockFrame) {
|
||||
it = do_QueryInterface(blockFrame, &result);
|
||||
}
|
||||
else
|
||||
else {
|
||||
blockFrame = nsnull;
|
||||
}
|
||||
}
|
||||
if (!blockFrame || !it)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -3416,19 +3390,21 @@ static PRBool IsCell(nsIContent *aContent)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
aContent->GetTag(*getter_AddRefs(tag));
|
||||
return (tag != 0 && tag.get() == nsSelection::sCellAtom);
|
||||
return (tag == nsHTMLAtoms::td);
|
||||
}
|
||||
|
||||
nsITableCellLayout*
|
||||
nsSelection::GetCellLayout(nsIContent *aCellContent)
|
||||
{
|
||||
// Get frame for cell
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
nsresult result = GetTracker()->GetPrimaryFrameFor(aCellContent, &cellFrame);
|
||||
if (!cellFrame) return nsnull;
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
GetTracker()->GetPrimaryFrameFor(aCellContent, &cellFrame);
|
||||
if (!cellFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableCellLayout *cellLayoutObject = nsnull;
|
||||
result = cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void**)(&cellLayoutObject));
|
||||
if (NS_FAILED(result)) return nsnull;
|
||||
CallQueryInterface(cellFrame, &cellLayoutObject);
|
||||
|
||||
return cellLayoutObject;
|
||||
}
|
||||
|
||||
@ -3436,12 +3412,14 @@ nsITableLayout*
|
||||
nsSelection::GetTableLayout(nsIContent *aTableContent)
|
||||
{
|
||||
// Get frame for table
|
||||
nsIFrame *tableFrame = nsnull;
|
||||
nsresult result = GetTracker()->GetPrimaryFrameFor(aTableContent, &tableFrame);
|
||||
if (!tableFrame) return nsnull;
|
||||
nsIFrame *tableFrame = nsnull;
|
||||
GetTracker()->GetPrimaryFrameFor(aTableContent, &tableFrame);
|
||||
if (!tableFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableLayout *tableLayoutObject = nsnull;
|
||||
result = tableFrame->QueryInterface(NS_GET_IID(nsITableLayout), (void**)(&tableLayoutObject));
|
||||
if (NS_FAILED(result)) return nsnull;
|
||||
CallQueryInterface(tableFrame, &tableLayoutObject);
|
||||
|
||||
return tableLayoutObject;
|
||||
}
|
||||
|
||||
@ -4180,7 +4158,7 @@ nsSelection::GetParentTable(nsIContent *aCell, nsIContent **aTable)
|
||||
{
|
||||
nsIAtom *tag;
|
||||
parent->GetTag(tag);
|
||||
if (tag && tag == nsSelection::sTableAtom)
|
||||
if (tag == nsHTMLAtoms::table)
|
||||
{
|
||||
*aTable = parent;
|
||||
NS_ADDREF(*aTable);
|
||||
@ -4381,7 +4359,7 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
if (!atom) return NS_ERROR_FAILURE;
|
||||
|
||||
if (atom.get() == nsSelection::sRowAtom)
|
||||
if (atom == nsHTMLAtoms::tr)
|
||||
{
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||
}
|
||||
@ -4395,9 +4373,9 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
||||
child->GetTag(*getter_AddRefs(atom));
|
||||
if (!atom) return NS_ERROR_FAILURE;
|
||||
|
||||
if (atom.get() == nsSelection::sTableAtom)
|
||||
if (atom == nsHTMLAtoms::table)
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
||||
else if (atom.get() == nsSelection::sRowAtom)
|
||||
else if (atom == nsHTMLAtoms::tr)
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||
}
|
||||
return result;
|
||||
@ -5119,8 +5097,9 @@ nsTypedSelection::selectFrames(nsIPresContext* aPresContext,
|
||||
mFrameSelection->GetTableCellSelection(&tablesel);
|
||||
if (tablesel)
|
||||
{
|
||||
nsITableCellLayout *tcl;
|
||||
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITableCellLayout),(void **)&tcl)) && tcl)
|
||||
nsITableCellLayout *tcl = nsnull;
|
||||
CallQueryInterface(frame, &tcl);
|
||||
if (tcl)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -5181,28 +5160,25 @@ nsTypedSelection::selectFrames(nsIPresContext* aPresContext, nsIDOMRange *aRange
|
||||
return NS_OK;//nothing to do
|
||||
if (!aRange || !aPresContext)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIContentIterator> iter;
|
||||
nsCOMPtr<nsIContentIterator> inneriter;
|
||||
nsresult result = nsComponentManager::CreateInstance(
|
||||
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIContentIterator> iter = do_CreateInstance(
|
||||
#ifdef USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
kCGenSubtreeIteratorCID,
|
||||
#else
|
||||
kCSubtreeIteratorCID,
|
||||
#endif // USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
nsnull,
|
||||
NS_GET_IID(nsIContentIterator),
|
||||
getter_AddRefs(iter));
|
||||
&result);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
result = nsComponentManager::CreateInstance(
|
||||
|
||||
nsCOMPtr<nsIContentIterator> inneriter = do_CreateInstance(
|
||||
#ifdef USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
kCGenContentIteratorCID,
|
||||
#else
|
||||
kCContentIteratorCID,
|
||||
#endif // USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
nsnull,
|
||||
NS_GET_IID(nsIContentIterator),
|
||||
getter_AddRefs(inneriter));
|
||||
&result);
|
||||
|
||||
if ((NS_SUCCEEDED(result)) && iter && inneriter)
|
||||
{
|
||||
@ -5504,11 +5480,10 @@ nsTypedSelection::GetClosestScrollableView(nsIView *aView, nsIScrollableView **a
|
||||
|
||||
while (!*aScrollableView && aView)
|
||||
{
|
||||
nsresult result = aView->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)aScrollableView);
|
||||
|
||||
CallQueryInterface(aView, aScrollableView);
|
||||
if (!*aScrollableView)
|
||||
{
|
||||
result = aView->GetParent(aView);
|
||||
nsresult result = aView->GetParent(aView);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
@ -5759,7 +5734,7 @@ nsTypedSelection::ScrollPointIntoView(nsIPresContext *aPresContext, nsIView *aVi
|
||||
nsIView *scrolledView = 0;
|
||||
nsIView *view = 0;
|
||||
|
||||
result = scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view);
|
||||
CallQueryInterface(scrollableView, &view);
|
||||
|
||||
if (view)
|
||||
{
|
||||
@ -5819,13 +5794,11 @@ nsTypedSelection::ScrollPointIntoView(nsIPresContext *aPresContext, nsIView *aVi
|
||||
//
|
||||
|
||||
view = 0;
|
||||
result = scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
result = CallQueryInterface(scrollableView, &view);
|
||||
if (!view)
|
||||
return result;
|
||||
|
||||
if (view)
|
||||
view->GetParent(view);
|
||||
view->GetParent(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6290,7 +6263,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
// if end node is a tbody then all bets are off we cannot select "rows"
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
atom = GetTag(endNode);
|
||||
if (atom.get() == nsSelection::sTbodyAtom)
|
||||
if (atom == nsHTMLAtoms::tbody)
|
||||
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
||||
|
||||
//get common parent
|
||||
@ -6336,7 +6309,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
while (tempNode != parent)
|
||||
{
|
||||
atom = GetTag(tempNode);
|
||||
if (atom.get() == nsSelection::sTableAtom) //select whole table if in cell mode, wait for cell
|
||||
if (atom == nsHTMLAtoms::table) //select whole table if in cell mode, wait for cell
|
||||
{
|
||||
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
|
||||
if (NS_FAILED(result))
|
||||
@ -6346,7 +6319,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
dirtystart = PR_TRUE;
|
||||
cellMode = PR_FALSE;
|
||||
}
|
||||
else if (atom.get() == nsSelection::sCellAtom) //you are in "cell" mode put selection to end of cell
|
||||
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
|
||||
{
|
||||
cellMode = PR_TRUE;
|
||||
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
|
||||
@ -6373,7 +6346,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
while (tempNode != parent)
|
||||
{
|
||||
atom = GetTag(tempNode);
|
||||
if (atom.get() == nsSelection::sTableAtom) //select whole table if in cell mode, wait for cell
|
||||
if (atom == nsHTMLAtoms::table) //select whole table if in cell mode, wait for cell
|
||||
{
|
||||
if (!cellMode)
|
||||
{
|
||||
@ -6387,7 +6360,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
else
|
||||
found = PR_FALSE; //didnt find the right cell yet
|
||||
}
|
||||
else if (atom.get() == nsSelection::sCellAtom) //you are in "cell" mode put selection to end of cell
|
||||
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
|
||||
{
|
||||
result = ParentOffset(tempNode, getter_AddRefs(endNode), &endOffset);
|
||||
if (NS_FAILED(result))
|
||||
@ -7141,7 +7114,7 @@ nsTypedSelection::GetFrameToScrolledViewOffsets(nsIScrollableView *aScrollableVi
|
||||
|
||||
// XXX Deal with the case where there is a scrolled element, e.g., a
|
||||
// DIV in the middle...
|
||||
while ((closestView != nsnull) && (closestView != scrolledView)) {
|
||||
while (closestView && closestView != scrolledView) {
|
||||
nscoord dx, dy;
|
||||
|
||||
// Update the offset
|
||||
@ -7610,14 +7583,9 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView,
|
||||
//
|
||||
|
||||
nsIView *view = 0;
|
||||
|
||||
rv = aScrollableView->QueryInterface(NS_GET_IID(nsIView), (void **)&view);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = CallQueryInterface(aScrollableView, &view);
|
||||
if (!view)
|
||||
return NS_ERROR_FAILURE;
|
||||
return rv;
|
||||
|
||||
rv = view->GetParent(view);
|
||||
|
||||
|
@ -864,7 +864,7 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent)
|
||||
******************************************************************************/
|
||||
void nsStyleContext::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
{
|
||||
NS_ASSERTION(aSizeOfHandler != nsnull, "SizeOf handler cannot be null");
|
||||
NS_ASSERTION(aSizeOfHandler, "SizeOf handler cannot be null");
|
||||
|
||||
// first get the unique items collection
|
||||
UNIQUE_STYLE_ITEMS(uniqueItems);
|
||||
@ -878,7 +878,7 @@ void nsStyleContext::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
|
||||
// get or create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsStyleContext"));
|
||||
tag = do_GetAtom("nsStyleContext");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
// add in the size of the member mPseudoTag
|
||||
@ -1191,9 +1191,10 @@ NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
|
||||
|
||||
nsStyleContext* context = new (aPresContext) nsStyleContext(aParentContext, aPseudoTag,
|
||||
aRuleNode, aPresContext);
|
||||
if (nsnull == context) {
|
||||
if (!context) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return context->QueryInterface(NS_GET_IID(nsIStyleContext), (void **) aInstancePtrResult);
|
||||
|
||||
return CallQueryInterface(context, aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
@ -905,8 +905,7 @@ NS_IMETHODIMP StyleSetImpl::EnableQuirkStyleSheet(PRBool aEnable)
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
sheet = getter_AddRefs(GetAgentStyleSheetAt(i));
|
||||
if (sheet) {
|
||||
nsCOMPtr<nsICSSStyleSheet> cssSheet;
|
||||
sheet->QueryInterface(NS_GET_IID(nsICSSStyleSheet), getter_AddRefs(cssSheet));
|
||||
nsCOMPtr<nsICSSStyleSheet> cssSheet = do_QueryInterface(sheet);
|
||||
if (cssSheet) {
|
||||
nsCOMPtr<nsIStyleSheet> quirkSheet;
|
||||
PRBool bHasSheet = PR_FALSE;
|
||||
@ -1774,17 +1773,16 @@ void StyleSetImpl::ListContexts(nsIStyleContext* aRootContext, FILE* out, PRInt3
|
||||
NS_EXPORT nsresult
|
||||
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult)
|
||||
{
|
||||
if (aInstancePtrResult == nsnull) {
|
||||
if (!aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
StyleSetImpl *it = new StyleSetImpl();
|
||||
|
||||
if (nsnull == it) {
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIStyleSet), (void **) aInstancePtrResult);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
||||
// nsITimeRecorder implementation
|
||||
@ -1822,17 +1820,18 @@ StyleSetImpl::DisableTimer(PRUint32 aTimerID)
|
||||
NS_IMETHODIMP
|
||||
StyleSetImpl::IsTimerEnabled(PRBool *aIsEnabled, PRUint32 aTimerID)
|
||||
{
|
||||
NS_ASSERTION(aIsEnabled != nsnull, "aIsEnabled paramter cannot be null" );
|
||||
NS_ASSERTION(aIsEnabled, "aIsEnabled parameter cannot be null" );
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (NS_TIMER_STYLE_RESOLUTION == aTimerID) {
|
||||
if (*aIsEnabled != nsnull) {
|
||||
if (*aIsEnabled) {
|
||||
*aIsEnabled = mTimerEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1987,7 +1986,7 @@ StyleSetImpl::AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
******************************************************************************/
|
||||
void StyleSetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
{
|
||||
NS_ASSERTION(aSizeOfHandler != nsnull, "SizeOf handler cannot be null");
|
||||
NS_ASSERTION(aSizeOfHandler, "SizeOf handler cannot be null");
|
||||
|
||||
// first get the unique items collection
|
||||
UNIQUE_STYLE_ITEMS(uniqueItems);
|
||||
@ -1998,8 +1997,7 @@ void StyleSetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
return;
|
||||
}
|
||||
// get or create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("StyleSet"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("StyleSet");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(StyleSetImpl);
|
||||
|
||||
|
@ -298,7 +298,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
|
||||
nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(document);
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
|
||||
|
||||
nsWeakPtr requestWeak = getter_AddRefs(NS_GetWeakReference(NS_STATIC_CAST(nsIDOMLoadListener*, this)));
|
||||
nsWeakPtr requestWeak = do_GetWeakReference(NS_STATIC_CAST(nsIDOMLoadListener*, this));
|
||||
txLoadListenerProxy* proxy = new txLoadListenerProxy(requestWeak);
|
||||
NS_ENSURE_TRUE(proxy, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -71,9 +71,8 @@ NS_NewTreeWalker(nsIDOMNode *aRoot,
|
||||
aFilter,
|
||||
aEntityReferenceExpansion);
|
||||
NS_ENSURE_TRUE(walker, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return walker->QueryInterface(NS_GET_IID(nsIDOMTreeWalker),
|
||||
(void**) aInstancePtrResult);
|
||||
|
||||
return CallQueryInterface(walker, aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsTreeWalker::nsTreeWalker(nsIDOMNode *aRoot,
|
||||
|
@ -71,7 +71,7 @@ nsresult NS_NewXMLContentSerializer(nsIContentSerializer** aSerializer)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIContentSerializer), (void**)aSerializer);
|
||||
return CallQueryInterface(it, aSerializer);
|
||||
}
|
||||
|
||||
nsXMLContentSerializer::nsXMLContentSerializer()
|
||||
|
@ -146,7 +146,8 @@ NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult)
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsIDocumentLoaderFactory), (void**)aResult);
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsContentDLF::nsContentDLF()
|
||||
@ -415,9 +416,7 @@ nsContentDLF::CreateDocument(const char* aCommand,
|
||||
nsCOMPtr<nsIDocumentViewer> docv;
|
||||
do {
|
||||
// Create the document
|
||||
rv = nsComponentManager::CreateInstance(aDocumentCID, nsnull,
|
||||
NS_GET_IID(nsIDocument),
|
||||
getter_AddRefs(doc));
|
||||
doc = do_CreateInstance(aDocumentCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
@ -482,9 +481,7 @@ nsContentDLF::CreateRDFDocument(nsISupports* aExtraInfo,
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// Create the XUL document
|
||||
rv = nsComponentManager::CreateInstance(kXULDocumentCID, nsnull,
|
||||
NS_GET_IID(nsIDocument),
|
||||
getter_AddRefs(*doc));
|
||||
*doc = do_CreateInstance(kXULDocumentCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Create the image content viewer...
|
||||
|
@ -276,8 +276,7 @@ nsDOMEvent::~nsDOMEvent()
|
||||
PR_DELETE(mEvent);
|
||||
}
|
||||
|
||||
if (mText!=nsnull)
|
||||
delete mText;
|
||||
delete mText;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMEvent)
|
||||
@ -333,8 +332,9 @@ NS_METHOD nsDOMEvent::GetTarget(nsIDOMEventTarget** aTarget)
|
||||
manager->GetEventTargetContent(mEvent, getter_AddRefs(targetContent));
|
||||
}
|
||||
|
||||
if (targetContent) {
|
||||
if (NS_OK == targetContent->QueryInterface(NS_GET_IID(nsIDOMEventTarget), (void**)&mTarget)) {
|
||||
if (targetContent) {
|
||||
CallQueryInterface(targetContent, &mTarget);
|
||||
if (mTarget) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(*aTarget);
|
||||
}
|
||||
@ -342,14 +342,15 @@ NS_METHOD nsDOMEvent::GetTarget(nsIDOMEventTarget** aTarget)
|
||||
else {
|
||||
//Always want a target. Use document if nothing else.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if (mPresContext && NS_SUCCEEDED(mPresContext->GetShell(getter_AddRefs(presShell))) && presShell) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if (mPresContext && NS_SUCCEEDED(mPresContext->GetShell(getter_AddRefs(presShell))) && presShell) {
|
||||
if (NS_SUCCEEDED(presShell->GetDocument(getter_AddRefs(doc))) && doc) {
|
||||
if (NS_SUCCEEDED(doc->QueryInterface(NS_GET_IID(nsIDOMEventTarget), (void**)&mTarget))) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(mTarget);
|
||||
}
|
||||
}
|
||||
CallQueryInterface(doc, &mTarget);
|
||||
if (mTarget) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(*aTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,14 +484,10 @@ nsDOMEvent::GetView(nsIDOMAbstractView** aView)
|
||||
rv = mPresContext->GetContainer(getter_AddRefs(container));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && container, rv);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> ifrq(do_QueryInterface(container));
|
||||
NS_ENSURE_TRUE(ifrq, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> window;
|
||||
ifrq->GetInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(window));
|
||||
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(container);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
window->QueryInterface(NS_GET_IID(nsIDOMAbstractView), (void **)aView);
|
||||
|
||||
CallQueryInterface(container, aView);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -866,25 +863,25 @@ NS_METHOD nsDOMEvent::GetButton(PRUint16* aButton)
|
||||
|
||||
NS_METHOD nsDOMEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
||||
{
|
||||
nsIEventStateManager *manager;
|
||||
nsIContent *relatedContent = nsnull;
|
||||
nsresult ret = NS_OK;
|
||||
*aRelatedTarget = nsnull;
|
||||
|
||||
if (mPresContext &&
|
||||
(NS_OK == mPresContext->GetEventStateManager(&manager))) {
|
||||
manager->GetEventRelatedContent(&relatedContent);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
if (relatedContent) {
|
||||
ret = relatedContent->QueryInterface(NS_GET_IID(nsIDOMEventTarget), (void**)aRelatedTarget);
|
||||
NS_RELEASE(relatedContent);
|
||||
}
|
||||
else {
|
||||
*aRelatedTarget = nsnull;
|
||||
if (!mPresContext) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
nsCOMPtr<nsIEventStateManager> manager;
|
||||
mPresContext->GetEventStateManager(getter_AddRefs(manager));
|
||||
if (!manager) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> relatedContent;
|
||||
manager->GetEventRelatedContent(getter_AddRefs(relatedContent));
|
||||
if (!relatedContent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(relatedContent, aRelatedTarget);
|
||||
}
|
||||
|
||||
// nsINSEventInterface
|
||||
@ -1027,32 +1024,31 @@ NS_METHOD nsDOMEvent::GetWhich(PRUint32* aWhich)
|
||||
NS_METHOD nsDOMEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
{
|
||||
nsIFrame* targetFrame = nsnull;
|
||||
nsIEventStateManager* manager;
|
||||
nsCOMPtr<nsIEventStateManager> manager;
|
||||
|
||||
if (mPresContext &&
|
||||
(NS_OK == mPresContext->GetEventStateManager(&manager))) {
|
||||
(NS_OK == mPresContext->GetEventStateManager(getter_AddRefs(manager)))) {
|
||||
manager->GetEventTarget(&targetFrame);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
*aRangeParent = nsnull;
|
||||
|
||||
if (targetFrame) {
|
||||
nsIContent* parent = nsnull;
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
PRInt32 offset, endOffset;
|
||||
PRBool beginOfContent;
|
||||
if (NS_SUCCEEDED(targetFrame->GetContentAndOffsetsFromPoint(mPresContext,
|
||||
mEvent->point,
|
||||
&parent,
|
||||
getter_AddRefs(parent),
|
||||
offset,
|
||||
endOffset,
|
||||
beginOfContent))) {
|
||||
if (parent && NS_SUCCEEDED(parent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aRangeParent))) {
|
||||
NS_RELEASE(parent);
|
||||
return NS_OK;
|
||||
if (parent) {
|
||||
return CallQueryInterface(parent, aRangeParent);
|
||||
}
|
||||
NS_IF_RELEASE(parent);
|
||||
}
|
||||
}
|
||||
*aRangeParent = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1143,7 +1139,7 @@ NS_METHOD nsDOMEvent::GetPreventDefault(PRBool* aReturn)
|
||||
nsresult
|
||||
nsDOMEvent::SetEventType(const nsAString& aEventTypeArg)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom(dont_AddRef(NS_NewAtom(NS_LITERAL_STRING("on") + aEventTypeArg)));
|
||||
nsCOMPtr<nsIAtom> atom= do_GetAtom(NS_LITERAL_STRING("on") + aEventTypeArg);
|
||||
|
||||
if (atom == nsLayoutAtoms::onmousedown && mEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
mEvent->message = NS_MOUSE_LEFT_BUTTON_DOWN;
|
||||
@ -1521,8 +1517,8 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIDOMEvent), (void **) aInstancePtrResult);
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent)
|
||||
|
@ -158,11 +158,11 @@ nsDOMMutationEvent::InitMutationEvent(const nsAString& aTypeArg, PRBool aCanBubb
|
||||
if (mutation) {
|
||||
mutation->mRelatedNode = aRelatedNodeArg;
|
||||
if (!aPrevValueArg.IsEmpty())
|
||||
mutation->mPrevAttrValue = getter_AddRefs(NS_NewAtom(aPrevValueArg));
|
||||
mutation->mPrevAttrValue = do_GetAtom(aPrevValueArg);
|
||||
if (!aNewValueArg.IsEmpty())
|
||||
mutation->mNewAttrValue = getter_AddRefs(NS_NewAtom(aNewValueArg));
|
||||
mutation->mNewAttrValue = do_GetAtom(aNewValueArg);
|
||||
if (!aAttrNameArg.IsEmpty()) {
|
||||
mutation->mAttrName = getter_AddRefs(NS_NewAtom(aAttrNameArg));
|
||||
mutation->mAttrName = do_GetAtom(aAttrNameArg);
|
||||
}
|
||||
mutation->mAttrChange = aAttrChangeArg;
|
||||
}
|
||||
@ -178,6 +178,6 @@ nsresult NS_NewDOMMutationEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIDOMEvent), (void **) aInstancePtrResult);
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ GenericListenersHashEnum(nsHashKey *aKey, void *aData, void* closure)
|
||||
PRBool* scriptOnly = NS_STATIC_CAST(PRBool*, closure);
|
||||
for (i = count-1; i >= 0; --i) {
|
||||
ls = (nsListenerStruct*)listeners->ElementAt(i);
|
||||
if (ls != nsnull) {
|
||||
if (ls) {
|
||||
if (*scriptOnly) {
|
||||
if (ls->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) {
|
||||
NS_RELEASE(ls->mListener);
|
||||
@ -375,7 +375,7 @@ void nsEventListenerManager::ReleaseListeners(nsVoidArray** aListeners, PRBool a
|
||||
nsListenerStruct *ls;
|
||||
for (i = 0; i < count; i++) {
|
||||
ls = (nsListenerStruct*)(*aListeners)->ElementAt(i);
|
||||
if (ls != nsnull) {
|
||||
if (ls) {
|
||||
if (aScriptOnly) {
|
||||
if (ls->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) {
|
||||
NS_RELEASE(ls->mListener);
|
||||
@ -801,8 +801,7 @@ nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
{
|
||||
PRInt32 subType;
|
||||
EventArrayType arrayType;
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
dont_AddRef(NS_NewAtom(NS_LITERAL_STRING("on") + aType));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aType);
|
||||
|
||||
if (NS_OK == GetIdentifiersForType(atom, &arrayType, &subType)) {
|
||||
AddEventListener(aListener, arrayType, subType, nsnull, aFlags, aEvtGrp);
|
||||
@ -824,8 +823,7 @@ nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener
|
||||
{
|
||||
PRInt32 subType;
|
||||
EventArrayType arrayType;
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
dont_AddRef(NS_NewAtom(NS_LITERAL_STRING("on") + aType));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aType);
|
||||
|
||||
if (NS_OK == GetIdentifiersForType(atom, &arrayType, &subType)) {
|
||||
RemoveEventListener(aListener, arrayType, subType, nsnull, aFlags, aEvtGrp);
|
||||
@ -1199,7 +1197,7 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsAutoString eventString;
|
||||
if (NS_SUCCEEDED(aDOMEvent->GetType(eventString))) {
|
||||
nsCOMPtr<nsIAtom> atom = dont_AddRef(NS_NewAtom(NS_LITERAL_STRING("on") + eventString));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + eventString);
|
||||
|
||||
result = CompileEventHandlerInternal(scriptCX, target, atom,
|
||||
aListenerStruct, aSubType);
|
||||
|
@ -1630,7 +1630,7 @@ nsEventStateManager::DoWheelScroll(nsIPresContext* aPresContext,
|
||||
if (svp) {
|
||||
svp->GetScrollableView(&sv);
|
||||
if (sv)
|
||||
sv->QueryInterface(NS_GET_IID(nsIView), (void**) &focusView);
|
||||
CallQueryInterface(sv, &focusView);
|
||||
} else {
|
||||
focusFrame->GetView(aPresContext, &focusView);
|
||||
if (!focusView) {
|
||||
@ -2228,16 +2228,16 @@ nsEventStateManager::ClearFrameRefs(nsIFrame* aFrame)
|
||||
nsIScrollableView*
|
||||
nsEventStateManager::GetNearestScrollingView(nsIView* aView)
|
||||
{
|
||||
nsIScrollableView* sv;
|
||||
if (NS_OK == aView->QueryInterface(NS_GET_IID(nsIScrollableView),
|
||||
(void**)&sv)) {
|
||||
nsIScrollableView* sv = nsnull;
|
||||
CallQueryInterface(aView, &sv);
|
||||
if (sv) {
|
||||
return sv;
|
||||
}
|
||||
|
||||
nsIView* parent;
|
||||
aView->GetParent(parent);
|
||||
|
||||
if (nsnull != parent) {
|
||||
if (parent) {
|
||||
return GetNearestScrollingView(parent);
|
||||
}
|
||||
|
||||
@ -4544,8 +4544,7 @@ nsresult NS_NewEventStateManager(nsIEventStateManager** aInstancePtrResult)
|
||||
if (nsnull == manager) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
rv = manager->QueryInterface(NS_GET_IID(nsIEventStateManager),
|
||||
(void **) aInstancePtrResult);
|
||||
rv = CallQueryInterface(manager, aInstancePtrResult);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return manager->Init();
|
||||
|
@ -42,11 +42,9 @@
|
||||
|
||||
GenericElementCollection::GenericElementCollection(nsIContent *aParent,
|
||||
nsIAtom *aTag)
|
||||
: nsGenericDOMHTMLCollection()
|
||||
: mParent(aParent),
|
||||
mTag(aTag)
|
||||
{
|
||||
mParent = aParent;
|
||||
mTag = aTag;
|
||||
NS_IF_ADDREF(aTag);
|
||||
}
|
||||
|
||||
GenericElementCollection::~GenericElementCollection()
|
||||
@ -55,88 +53,74 @@ GenericElementCollection::~GenericElementCollection()
|
||||
// release it! this is to avoid circular references. The
|
||||
// instantiator who provided mParent is responsible for managing our
|
||||
// reference for us.
|
||||
|
||||
// Release reference on the tag
|
||||
NS_IF_RELEASE(mTag);
|
||||
}
|
||||
|
||||
// we re-count every call. A better implementation would be to set ourselves up as
|
||||
// an observer of contentAppended, contentInserted, and contentDeleted
|
||||
// we re-count every call. A better implementation would be to set ourselves
|
||||
// up as an observer of contentAppended, contentInserted, and contentDeleted.
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::GetLength(PRUint32* aLength)
|
||||
{
|
||||
if (nsnull==aLength)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aLength=0;
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
nsIContent *child=nsnull;
|
||||
PRUint32 childIndex=0;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
while (nsnull!=child)
|
||||
{
|
||||
nsIAtom *childTag;
|
||||
child->GetTag(childTag);
|
||||
if (mTag==childTag)
|
||||
{
|
||||
(*aLength)++;
|
||||
NS_ENSURE_ARG_POINTER(aLength);
|
||||
|
||||
*aLength = 0;
|
||||
|
||||
if (mParent) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
PRUint32 childIndex = 0;
|
||||
mParent->ChildAt(childIndex, *getter_AddRefs(child));
|
||||
while (child) {
|
||||
nsCOMPtr<nsIAtom> childTag;
|
||||
child->GetTag(*getter_AddRefs(childTag));
|
||||
if (mTag == childTag) {
|
||||
++(*aLength);
|
||||
}
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
childIndex++;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
mParent->ChildAt(++childIndex, *getter_AddRefs(child));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
*aReturn=nsnull;
|
||||
PRUint32 theIndex = 0;
|
||||
nsresult rv = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
nsIContent *child=nsnull;
|
||||
PRUint32 childIndex=0;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
while (nsnull!=child)
|
||||
{
|
||||
nsIAtom *childTag;
|
||||
child->GetTag(childTag);
|
||||
if (mTag==childTag)
|
||||
{
|
||||
if (aIndex==theIndex)
|
||||
{
|
||||
child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn); // out-param addref
|
||||
NS_ASSERTION(nsnull!=aReturn, "content element must be an nsIDOMNode");
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
break;
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
*aReturn = nsnull;
|
||||
|
||||
if (mParent) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
PRUint32 childIndex = 0;
|
||||
mParent->ChildAt(childIndex, *getter_AddRefs(child));
|
||||
|
||||
PRUint32 theIndex = 0;
|
||||
while (child) {
|
||||
nsCOMPtr<nsIAtom> childTag;
|
||||
child->GetTag(*getter_AddRefs(childTag));
|
||||
if (mTag == childTag) {
|
||||
if (aIndex == theIndex) {
|
||||
CallQueryInterface(child, aReturn);
|
||||
NS_ASSERTION(aReturn, "content element must be an nsIDOMNode");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
theIndex++;
|
||||
++theIndex;
|
||||
}
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
childIndex++;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
mParent->ChildAt(++childIndex, *getter_AddRefs(child));
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
*aReturn = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
}
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -144,6 +128,7 @@ GenericElementCollection::ParentDestroyed()
|
||||
{
|
||||
// see comment in destructor, do NOT release mParent!
|
||||
mParent = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -152,8 +137,10 @@ nsresult
|
||||
GenericElementCollection::SizeOf(nsISizeOfHandler* aSizer,
|
||||
PRUint32* aResult) const
|
||||
{
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = sizeof(*this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
@ -40,10 +40,12 @@
|
||||
#define GenericElementCollection_h__
|
||||
|
||||
#include "nsGenericDOMHTMLCollection.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIAtom;
|
||||
#ifdef DEBUG
|
||||
class nsISizeOfHandler;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This class provides a late-bound collection of elements that are
|
||||
@ -54,22 +56,22 @@ class GenericElementCollection : public nsGenericDOMHTMLCollection
|
||||
{
|
||||
public:
|
||||
GenericElementCollection(nsIContent *aParent,
|
||||
nsIAtom *aTag);
|
||||
nsIAtom *aTag);
|
||||
virtual ~GenericElementCollection();
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD NamedItem(const nsAString& aName, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD NamedItem(const nsAString& aName, nsIDOMNode** aReturn);
|
||||
|
||||
NS_IMETHOD ParentDestroyed();
|
||||
NS_IMETHOD ParentDestroyed();
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsIContent * mParent;
|
||||
nsIAtom * mTag;
|
||||
nsIContent* mParent;
|
||||
nsCOMPtr<nsIAtom> mTag;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -242,16 +242,14 @@ public:
|
||||
nsresult
|
||||
NS_NewAttributeContent(nsIContent** aContent)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "null OUT ptr");
|
||||
if (nsnull == aContent) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
|
||||
nsAttributeContent* it = new nsAttributeContent;
|
||||
if (nsnull == it) {
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_SUCCEEDED(it->QueryInterface(NS_GET_IID(nsIContent), (void **)aContent)) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
return CallQueryInterface(it, aContent);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -542,7 +540,7 @@ nsAttributeContent::CloneContent(PRBool aCloneText, nsITextContent** aReturn)
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
result = it->QueryInterface(NS_GET_IID(nsITextContent), (void**) aReturn);
|
||||
result = CallQueryInterface(it, aReturn);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -849,8 +849,7 @@ nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
||||
nsresult res = GetOffsetRect(rcFrame, getter_AddRefs(parent));
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
if (parent) {
|
||||
res = parent->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||
(void**)aOffsetParent);
|
||||
res = CallQueryInterface(parent, aOffsetParent);
|
||||
} else {
|
||||
*aOffsetParent = nsnull;
|
||||
}
|
||||
@ -1699,9 +1698,9 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID,
|
||||
|
||||
mutation.mAttrName = aAttribute;
|
||||
if (!strValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(strValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(strValue);
|
||||
if (!aValue.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||
mutation.mNewAttrValue = do_GetAtom(aValue);
|
||||
if (modification)
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||
else
|
||||
@ -1799,9 +1798,9 @@ nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo,
|
||||
|
||||
mutation.mAttrName = localName;
|
||||
if (!strValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(strValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(strValue);
|
||||
if (!aValue.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||
mutation.mNewAttrValue = do_GetAtom(aValue);
|
||||
if (modification)
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||
else
|
||||
@ -1975,9 +1974,9 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
|
||||
nsAutoString newValueStr;
|
||||
GetAttr(kNameSpaceID_None, aAttribute, newValueStr);
|
||||
if (!newValueStr.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(newValueStr));
|
||||
mutation.mNewAttrValue = do_GetAtom(newValueStr);
|
||||
if (!oldValueStr.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValueStr));
|
||||
mutation.mPrevAttrValue = do_GetAtom(oldValueStr);
|
||||
if (modification)
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||
else
|
||||
@ -2066,7 +2065,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
nsAutoString attr;
|
||||
GetAttr(aNameSpaceID, aAttribute, attr);
|
||||
if (!attr.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(attr));
|
||||
mutation.mPrevAttrValue = do_GetAtom(attr);
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -2420,13 +2419,12 @@ nsGenericHTMLElement::List(FILE* out, PRInt32 aIndent) const
|
||||
PRInt32 index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
nsIAtom* tag;
|
||||
GetTag(tag);
|
||||
if (tag != nsnull) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
GetTag(*getter_AddRefs(tag));
|
||||
if (tag) {
|
||||
nsAutoString buf;
|
||||
tag->ToString(buf);
|
||||
fputs(NS_LossyConvertUCS2toASCII(buf).get(), out);
|
||||
NS_RELEASE(tag);
|
||||
}
|
||||
fprintf(out, "@%p", (void*)this);
|
||||
|
||||
@ -2460,10 +2458,10 @@ nsGenericHTMLElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) co
|
||||
PRInt32 index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
nsIAtom* tag;
|
||||
nsAutoString buf;
|
||||
GetTag(tag);
|
||||
if (tag != nsnull) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
GetTag(*getter_AddRefs(tag));
|
||||
if (tag) {
|
||||
tag->ToString(buf);
|
||||
fputs("<",out);
|
||||
fputs(NS_LossyConvertUCS2toASCII(buf).get(), out);
|
||||
@ -2471,7 +2469,6 @@ nsGenericHTMLElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) co
|
||||
if(aDumpAll) ListAttributes(out);
|
||||
|
||||
fputs(">",out);
|
||||
NS_RELEASE(tag);
|
||||
}
|
||||
|
||||
PRBool canHaveKids;
|
||||
@ -2961,9 +2958,7 @@ nsGenericHTMLElement::GetPrimaryPresState(nsIHTMLContent* aContent,
|
||||
// Get the pres state for this key, if it doesn't exist, create one
|
||||
result = history->GetState(key, aPresState);
|
||||
if (!*aPresState) {
|
||||
result = nsComponentManager::CreateInstance(kPresStateCID, nsnull,
|
||||
NS_GET_IID(nsIPresState),
|
||||
(void**)aPresState);
|
||||
result = CallCreateInstance(kPresStateCID, aPresState);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = history->AddState(key, *aPresState);
|
||||
}
|
||||
@ -3877,12 +3872,13 @@ nsGenericHTMLContainerElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
nsDOMSlots *slots = GetDOMSlots();
|
||||
|
||||
if (nsnull == slots->mChildNodes) {
|
||||
if (!slots->mChildNodes) {
|
||||
slots->mChildNodes = new nsChildContentList(this);
|
||||
// XXX Need to check for out-of-memory
|
||||
NS_ADDREF(slots->mChildNodes);
|
||||
}
|
||||
|
||||
return slots->mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void **)aChildNodes);
|
||||
return CallQueryInterface(slots->mChildNodes, aChildNodes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3902,10 +3898,9 @@ nsGenericHTMLContainerElement::GetFirstChild(nsIDOMNode** aNode)
|
||||
{
|
||||
nsIContent *child = (nsIContent *)mChildren.SafeElementAt(0);
|
||||
if (child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
return res;
|
||||
}
|
||||
*aNode = nsnull;
|
||||
@ -3918,10 +3913,9 @@ nsGenericHTMLContainerElement::GetLastChild(nsIDOMNode** aNode)
|
||||
if (0 != mChildren.Count()) {
|
||||
nsIContent *child = (nsIContent *)mChildren.ElementAt(mChildren.Count()-1);
|
||||
if (child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ void BodyRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("BodyRule"));
|
||||
tag = do_GetAtom("BodyRule");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
aSizeOfHandler->AddSize(tag, aSize);
|
||||
@ -645,11 +645,12 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsIHTMLContentContainer* htmlContainer;
|
||||
if (NS_OK == doc->QueryInterface(NS_GET_IID(nsIHTMLContentContainer),
|
||||
(void**)&htmlContainer)) {
|
||||
nsIHTMLStyleSheet* styleSheet;
|
||||
if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) {
|
||||
nsCOMPtr<nsIHTMLContentContainer> htmlContainer =
|
||||
do_QueryInterface(doc);
|
||||
if (htmlContainer) {
|
||||
nsCOMPtr<nsIHTMLStyleSheet> styleSheet;
|
||||
htmlContainer->GetAttributeStyleSheet(getter_AddRefs(styleSheet));
|
||||
if (styleSheet) {
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::link, value);
|
||||
if ((eHTMLUnit_Color == value.GetUnit()) ||
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
@ -667,10 +668,7 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
styleSheet->SetVisitedLinkColor(value.GetColorValue());
|
||||
}
|
||||
|
||||
NS_RELEASE(styleSheet);
|
||||
}
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1795,9 +1795,7 @@ nsFormControlList::AddElementToTable(nsIFormControl* aChild,
|
||||
// Add the new child too
|
||||
list->AppendElement(newChild);
|
||||
|
||||
nsCOMPtr<nsISupports> listSupports;
|
||||
list->QueryInterface(NS_GET_IID(nsISupports),
|
||||
getter_AddRefs(listSupports));
|
||||
nsCOMPtr<nsISupports> listSupports = do_QueryInterface(list);
|
||||
|
||||
// Replace the element with the list.
|
||||
mNameLookupTable.Put(&key, listSupports);
|
||||
|
@ -1023,8 +1023,7 @@ nsHTMLSelectElement::GetSelectFrame()
|
||||
nsISelectControlFrame *select_frame = nsnull;
|
||||
|
||||
if (form_control_frame) {
|
||||
form_control_frame->QueryInterface(NS_GET_IID(nsISelectControlFrame),
|
||||
(void **)&select_frame);
|
||||
CallQueryInterface(form_control_frame, &select_frame);
|
||||
}
|
||||
|
||||
return select_frame;
|
||||
@ -1917,8 +1916,7 @@ nsHTMLSelectElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsIFrame* formFrame = nsnull;
|
||||
|
||||
if (formControlFrame &&
|
||||
NS_SUCCEEDED(formControlFrame->QueryInterface(NS_GET_IID(nsIFrame),
|
||||
(void **)&formFrame)) &&
|
||||
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
|
||||
formFrame)
|
||||
{
|
||||
const nsStyleUserInterface* uiStyle;
|
||||
|
@ -200,8 +200,7 @@ nsHTMLTableCellElement::GetRow(nsIDOMHTMLTableRowElement** aRow)
|
||||
GetParentNode(getter_AddRefs(rowNode));
|
||||
|
||||
if (rowNode) {
|
||||
rowNode->QueryInterface(NS_GET_IID(nsIDOMHTMLTableRowElement),
|
||||
(void**)aRow);
|
||||
CallQueryInterface(rowNode, aRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,8 +662,7 @@ nsHTMLTextAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsIFrame* formFrame = nsnull;
|
||||
|
||||
if (formControlFrame &&
|
||||
NS_SUCCEEDED(formControlFrame->QueryInterface(NS_GET_IID(nsIFrame),
|
||||
(void **)&formFrame)) &&
|
||||
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
|
||||
formFrame) {
|
||||
const nsStyleUserInterface* uiStyle;
|
||||
formFrame->GetStyleData(eStyleStruct_UserInterface,
|
||||
@ -804,15 +803,10 @@ nsHTMLTextAreaElement::GetControllers(nsIControllers** aResult)
|
||||
|
||||
if (!mControllers)
|
||||
{
|
||||
NS_ENSURE_SUCCESS (
|
||||
nsComponentManager::CreateInstance(kXULControllersCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIControllers),
|
||||
getter_AddRefs(mControllers)),
|
||||
NS_ERROR_FAILURE);
|
||||
if (!mControllers) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
nsresult rv;
|
||||
mControllers = do_CreateInstance(kXULControllersCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/editor/editorcontroller;1", &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -83,7 +83,7 @@ nsresult nsImageMapUtils::FindImageMap(nsIDocument *aDocument,
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
domDoc->GetElementById(usemap,getter_AddRefs(element));
|
||||
if (element) {
|
||||
element->QueryInterface(NS_GET_IID(nsIDOMHTMLMapElement),(void**)aMap);
|
||||
CallQueryInterface(element, aMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -858,7 +858,7 @@ HTMLContentSink::AddAttributes(const nsIParserNode& aNode,
|
||||
k.Assign(key);
|
||||
ToLowerCase(k);
|
||||
|
||||
nsCOMPtr<nsIAtom> keyAtom(dont_AddRef(NS_NewAtom(k)));
|
||||
nsCOMPtr<nsIAtom> keyAtom = do_GetAtom(k);
|
||||
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, keyAtom)) {
|
||||
// Get value and remove mandatory quotes
|
||||
@ -1033,7 +1033,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
NS_ASSERTION(name_str, "What? No string in atom?!?");
|
||||
|
||||
if (nsCRT::strcmp(tag, name_str) != 0) {
|
||||
nsCOMPtr<nsIAtom> atom(dont_AddRef(NS_NewAtom(tag)));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(tag);
|
||||
|
||||
rv = aNodeInfo->NameChanged(atom, *getter_AddRefs(kungFuDeathGrip));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -2382,12 +2382,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIWebShell *aContainer)
|
||||
// Getting context is tricky if the document hasn't had it's
|
||||
// GlobalObject set yet
|
||||
if (!globalObject) {
|
||||
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aContainer));
|
||||
NS_ENSURE_TRUE(requestor, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> owner;
|
||||
requestor->GetInterface(NS_GET_IID(nsIScriptGlobalObjectOwner),
|
||||
getter_AddRefs(owner));
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> owner = do_GetInterface(aContainer);
|
||||
NS_ENSURE_TRUE(owner, PR_TRUE);
|
||||
|
||||
owner->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
@ -2436,7 +2431,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
NS_ADDREF(aDoc);
|
||||
|
||||
aDoc->AddObserver(this);
|
||||
aDoc->QueryInterface(NS_GET_IID(nsIHTMLDocument), (void**)&mHTMLDocument);
|
||||
CallQueryInterface(aDoc, &mHTMLDocument);
|
||||
|
||||
rv = mDocument->GetNodeInfoManager(*getter_AddRefs(mNodeInfoManager));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -5022,7 +5017,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
||||
|
||||
if (!result.IsEmpty()) {
|
||||
ToLowerCase(header);
|
||||
nsCOMPtr<nsIAtom> fieldAtom(dont_AddRef(NS_NewAtom(header)));
|
||||
nsCOMPtr<nsIAtom> fieldAtom = do_GetAtom(header);
|
||||
rv = ProcessHeaderData(fieldAtom, result, it);
|
||||
}
|
||||
}
|
||||
@ -5059,7 +5054,7 @@ HTMLContentSink::ProcessHTTPHeaders(nsIChannel* aChannel)
|
||||
while (*name) {
|
||||
rv = httpchannel->GetResponseHeader(nsDependentCString(*name), tmp);
|
||||
if (NS_SUCCEEDED(rv) && !tmp.IsEmpty()) {
|
||||
nsCOMPtr<nsIAtom> key(dont_AddRef(NS_NewAtom(*name)));
|
||||
nsCOMPtr<nsIAtom> key = do_GetAtom(*name);
|
||||
ProcessHeaderData(key, NS_ConvertASCIItoUCS2(tmp));
|
||||
}
|
||||
name++;
|
||||
|
@ -124,13 +124,11 @@
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsICacheEntryDescriptor.h"
|
||||
#include "nsIXMLContent.h" //for createelementNS
|
||||
#include "nsHTMLParts.h" //for createelementNS
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIWyciwygChannel.h"
|
||||
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIPrompt.h"
|
||||
//AHMED 12-2
|
||||
#ifdef IBMBIDI
|
||||
@ -168,8 +166,6 @@ IsNamedItem(nsIContent* aContent, nsIAtom *aTag, nsAString& aName);
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
static NS_DEFINE_CID(kHTMLStyleSheetCID,NS_HTMLSTYLESHEET_CID);
|
||||
|
||||
nsIRDFService* nsHTMLDocument::gRDF;
|
||||
nsrefcnt nsHTMLDocument::gRefCntRDFService = 0;
|
||||
|
||||
@ -287,8 +283,6 @@ IdAndNameHashInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
||||
|
||||
nsHTMLDocument::nsHTMLDocument()
|
||||
: nsMarkupDocument(),
|
||||
mAttrStyleSheet(nsnull),
|
||||
mStyleAttrStyleSheet(nsnull),
|
||||
mBaseURL(nsnull),
|
||||
mBaseTarget(nsnull),
|
||||
mLastModified(nsnull),
|
||||
@ -319,13 +313,7 @@ nsHTMLDocument::nsHTMLDocument()
|
||||
|
||||
if (gRefCntRDFService++ == 0)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDF);
|
||||
|
||||
//nsCOMPtr<nsIRDFService> gRDF(do_GetService(kRDFServiceCID,
|
||||
//&rv));
|
||||
CallGetService(kRDFServiceCID, &gRDF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,9 +351,8 @@ nsHTMLDocument::~nsHTMLDocument()
|
||||
mCSSLoader->DropDocumentReference(); // release weak ref
|
||||
}
|
||||
|
||||
if (--gRefCntRDFService == 0)
|
||||
{
|
||||
nsServiceManager::ReleaseService("@mozilla.org/rdf/rdf-service;1", gRDF);
|
||||
if (--gRefCntRDFService == 0) {
|
||||
NS_IF_RELEASE(gRDF);
|
||||
}
|
||||
|
||||
if (mIdAndNameHashIsLive) {
|
||||
@ -454,16 +441,8 @@ nsHTMLDocument::BaseResetToURI(nsIURI *aURL)
|
||||
|
||||
if (aURL) {
|
||||
if (!mAttrStyleSheet) {
|
||||
//result = NS_NewHTMLStyleSheet(&mAttrStyleSheet, aURL, this);
|
||||
result = nsComponentManager::CreateInstance(kHTMLStyleSheetCID, nsnull,
|
||||
NS_GET_IID(nsIHTMLStyleSheet),
|
||||
getter_AddRefs(mAttrStyleSheet));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = mAttrStyleSheet->Init(aURL, this);
|
||||
if (NS_FAILED(result)) {
|
||||
mAttrStyleSheet = nsnull;
|
||||
}
|
||||
}
|
||||
result = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aURL,
|
||||
this);
|
||||
}
|
||||
else {
|
||||
result = mAttrStyleSheet->Reset(aURL);
|
||||
@ -561,7 +540,7 @@ nsHTMLDocument::TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
} else if (aDocInfo) {
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
aDocInfo->GetForcedCharset(getter_AddRefs(csAtom));
|
||||
if (csAtom.get() != nsnull) {
|
||||
if (csAtom) {
|
||||
csAtom->ToString(aCharset);
|
||||
aCharsetSource = kCharsetFromUserForced;
|
||||
aDocInfo->SetForcedCharset(nsnull);
|
||||
@ -880,9 +859,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
|
||||
if (needsParser) {
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID, nsnull,
|
||||
NS_GET_IID(nsIParser),
|
||||
(void **)&mParser);
|
||||
rv = CallCreateInstance(kCParserCID, &mParser);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
}
|
||||
|
||||
@ -1019,8 +996,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
|
||||
// Set the parser as the stream listener for the document loader...
|
||||
if (mParser) {
|
||||
rv = mParser->QueryInterface(NS_GET_IID(nsIStreamListener),
|
||||
(void**)aDocListener);
|
||||
rv = CallQueryInterface(mParser, aDocListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -1205,10 +1181,8 @@ nsHTMLDocument::GetImageMap(const nsString& aMapName,
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mAttrStyleSheet;
|
||||
if (!mAttrStyleSheet) {
|
||||
return NS_ERROR_NOT_AVAILABLE; // probably not the right error...
|
||||
@ -1221,10 +1195,8 @@ nsHTMLDocument::GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mStyleAttrStyleSheet;
|
||||
if (!mStyleAttrStyleSheet) {
|
||||
return NS_ERROR_NOT_AVAILABLE; // probably not the right error...
|
||||
@ -1670,7 +1642,7 @@ nsHTMLDocument::CreateElement(const nsAString& aTagName,
|
||||
PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
content->SetContentID(mNextContentID++);
|
||||
rv = content->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aReturn);
|
||||
rv = CallQueryInterface(content, aReturn);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -2513,9 +2485,7 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL)
|
||||
mRootContent = root;
|
||||
}
|
||||
|
||||
result = nsComponentManager::CreateInstance(kCParserCID, nsnull,
|
||||
NS_GET_IID(nsIParser),
|
||||
(void **)&mParser);
|
||||
result = CallCreateInstance(kCParserCID, &mParser);
|
||||
mIsWriting = 1;
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
@ -3025,9 +2995,7 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
// just use the view size itself
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
|
||||
view->QueryInterface(NS_GET_IID(nsIScrollableView),
|
||||
(void**)&scrollableView);
|
||||
CallQueryInterface(view, &scrollableView);
|
||||
|
||||
if (scrollableView) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
@ -3912,7 +3880,7 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
|
||||
list = fc_list;
|
||||
}
|
||||
|
||||
return list->QueryInterface(NS_GET_IID(nsISupports), (void **)aResult);
|
||||
return CallQueryInterface(list, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3979,12 +3947,11 @@ nsHTMLDocument::GetBodyContent()
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetBodyElement(nsIDOMHTMLBodyElement** aBody)
|
||||
{
|
||||
if (!mBodyContent && PR_FALSE == GetBodyContent()) {
|
||||
if (!mBodyContent && !GetBodyContent()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mBodyContent->QueryInterface(NS_GET_IID(nsIDOMHTMLBodyElement),
|
||||
(void**)aBody);
|
||||
|
||||
return CallQueryInterface(mBodyContent, aBody);
|
||||
}
|
||||
|
||||
// forms related stuff
|
||||
|
@ -173,43 +173,31 @@ public:
|
||||
nsresult
|
||||
NS_NewHTMLFragmentContentSink2(nsIHTMLFragmentContentSink** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFragmentContentSink2* it;
|
||||
NS_NEWXPCOM(it, nsHTMLFragmentContentSink2);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult rv = it->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIHTMLFragmentContentSink), (void **)aResult);
|
||||
nsCOMPtr<nsHTMLFragmentContentSink2> it;
|
||||
NS_NEWXPCOM(it, nsHTMLFragmentContentSink2);
|
||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = it->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFragmentContentSink(nsIHTMLFragmentContentSink** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFragmentContentSink* it;
|
||||
NS_NEWXPCOM(it, nsHTMLFragmentContentSink);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult rv = it->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
return it->QueryInterface(NS_GET_IID(nsIHTMLFragmentContentSink), (void **)aResult);
|
||||
nsCOMPtr<nsHTMLFragmentContentSink> it;
|
||||
NS_NEWXPCOM(it, nsHTMLFragmentContentSink);
|
||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = it->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsHTMLFragmentContentSink::nsHTMLFragmentContentSink()
|
||||
@ -302,18 +290,15 @@ nsresult nsHTMLFragmentContentSink::Init()
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFragmentContentSink::WillBuildModel(void)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (nsnull == mRoot) {
|
||||
nsIDOMDocumentFragment* frag;
|
||||
|
||||
result = NS_NewDocumentFragment(&frag, nsnull);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = frag->QueryInterface(NS_GET_IID(nsIContent), (void**)&mRoot);
|
||||
NS_RELEASE(frag);
|
||||
}
|
||||
if (mRoot) {
|
||||
return NS_OK;
|
||||
}
|
||||
return result;
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentFragment> frag;
|
||||
nsresult rv = NS_NewDocumentFragment(getter_AddRefs(frag), nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(frag, &mRoot);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -710,10 +695,9 @@ nsHTMLFragmentContentSink::AddComment(const nsIParserNode& aNode)
|
||||
FlushText();
|
||||
|
||||
result = NS_NewCommentNode(&comment);
|
||||
if (NS_OK == result) {
|
||||
result = comment->QueryInterface(NS_GET_IID(nsIDOMComment),
|
||||
(void **)&domComment);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = CallQueryInterface(comment, &domComment);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
domComment->AppendData(aNode.GetText());
|
||||
NS_RELEASE(domComment);
|
||||
|
||||
@ -757,13 +741,13 @@ nsHTMLFragmentContentSink::DoFragment(PRBool aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFragmentContentSink::GetFragment(nsIDOMDocumentFragment** aFragment)
|
||||
{
|
||||
if (nsnull != mRoot) {
|
||||
return mRoot->QueryInterface(NS_GET_IID(nsIDOMDocumentFragment), (void**)aFragment);
|
||||
}
|
||||
else {
|
||||
*aFragment = nsnull;
|
||||
return NS_OK;
|
||||
if (mRoot) {
|
||||
return CallQueryInterface(mRoot, aFragment);
|
||||
}
|
||||
|
||||
*aFragment = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
@ -938,7 +922,7 @@ nsHTMLFragmentContentSink::AddAttributes(const nsIParserNode& aNode,
|
||||
k.Assign(key);
|
||||
ToLowerCase(k);
|
||||
|
||||
nsIAtom* keyAtom = NS_NewAtom(k);
|
||||
nsCOMPtr<nsIAtom> keyAtom = do_GetAtom(k);
|
||||
|
||||
if (NS_CONTENT_ATTR_NOT_THERE ==
|
||||
aContent->GetAttr(kNameSpaceID_None, keyAtom, v)) {
|
||||
@ -948,7 +932,6 @@ nsHTMLFragmentContentSink::AddAttributes(const nsIParserNode& aNode,
|
||||
// Add attribute to content
|
||||
aContent->SetAttr(kNameSpaceID_None, keyAtom, v, PR_FALSE);
|
||||
}
|
||||
NS_RELEASE(keyAtom);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -144,8 +144,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(ImageListener, nsIStreamListener)
|
||||
NS_IMETHODIMP
|
||||
ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (!channel) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -428,18 +426,12 @@ nsresult nsImageDocument::UpdateTitle( void )
|
||||
// so instead we just get the image-extension
|
||||
// - get the URL interface, get the extension, convert to upper-case
|
||||
// Unless the Imagerequest or Image can tell us the type this is the best we can do.
|
||||
nsIURL *pURL=nsnull;
|
||||
if(NS_SUCCEEDED(mDocumentURL->QueryInterface(NS_GET_IID(nsIURL),(void **)&pURL))) {
|
||||
char *pExtension=nsnull;
|
||||
pURL->GetFileExtension(&pExtension);
|
||||
if(pExtension){
|
||||
nsString strExt; strExt.AssignWithConversion(pExtension);
|
||||
ToUpperCase(strExt);
|
||||
titleStr.Append(strExt);
|
||||
nsCRT::free(pExtension);
|
||||
pExtension=nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(pURL);
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(mDocumentURL);
|
||||
if (url) {
|
||||
nsXPIDLCString extension;
|
||||
url->GetFileExtension(getter_Copies(extension));
|
||||
ToUpperCase(extension);
|
||||
titleStr.AppendWithConversion(extension);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -83,7 +83,7 @@ nsWyciwygChannel::GetInterface(const nsIID &aIID, void **aResult)
|
||||
|
||||
if (mCallbacks)
|
||||
return mCallbacks->GetInterface(aIID, aResult);
|
||||
|
||||
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
|
@ -78,18 +78,15 @@ nsWyciwygProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIURI> url = do_CreateInstance(kSimpleURICID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = url->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*result = url;
|
||||
NS_ADDREF(*result);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -6117,8 +6117,7 @@ void nsCSSDeclaration::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
}
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsCSSDeclaration"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsCSSDeclaration");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
|
@ -1779,7 +1779,7 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
|
||||
// Otherwise we get icky things like crashes in layout... We need
|
||||
// to stop blocking the parser. We really do.
|
||||
PRBool seenParser = PR_FALSE;
|
||||
|
||||
|
||||
// Go through and deal with the whole linked list.
|
||||
SheetLoadData* data = aLoadData;
|
||||
while (data) {
|
||||
|
@ -1097,9 +1097,8 @@ PRBool CSSParserImpl::GatherMedia(PRInt32& aErrorCode, nsString& aMedia,
|
||||
}
|
||||
ToLowerCase(mToken.mIdent); // case insensitive from CSS - must be lower cased
|
||||
if (aMediaAtoms) {
|
||||
nsIAtom* medium = NS_NewAtom(mToken.mIdent);
|
||||
nsCOMPtr<nsIAtom> medium = do_GetAtom(mToken.mIdent);
|
||||
aMediaAtoms->AppendElement(medium);
|
||||
NS_RELEASE(medium);
|
||||
}
|
||||
aMedia.Append(mToken.mIdent);
|
||||
first = PR_FALSE;
|
||||
@ -1323,7 +1322,7 @@ PRBool CSSParserImpl::ProcessNameSpace(PRInt32& aErrorCode, const nsString& aPre
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
}
|
||||
|
||||
NS_NewCSSNameSpaceRule(getter_AddRefs(rule), prefix, aURLSpec);
|
||||
@ -1838,12 +1837,10 @@ void CSSParserImpl::ParseTypeOrUniversalSelector(PRInt32& aDataMask,
|
||||
aDataMask |= SEL_MASK_NSPACE;
|
||||
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(buffer); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(buffer);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(buffer);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown namespace prefix '") +
|
||||
buffer + NS_LITERAL_STRING("'."));
|
||||
@ -2027,12 +2024,10 @@ void CSSParserImpl::ParseAttributeSelector(PRInt32& aDataMask,
|
||||
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // was a namespace
|
||||
nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(attr); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(attr);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(attr);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown namespace prefix '") +
|
||||
attr + NS_LITERAL_STRING("'."));
|
||||
@ -2690,7 +2685,7 @@ PRBool CSSParserImpl::ParseTreePseudoElement(PRInt32& aErrorCode,
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (eCSSToken_Ident == mToken.mType) {
|
||||
nsCOMPtr<nsIAtom> pseudo = getter_AddRefs(NS_NewAtom(mToken.mIdent));
|
||||
nsCOMPtr<nsIAtom> pseudo = do_GetAtom(mToken.mIdent);
|
||||
aSelector.AddPseudoClass(pseudo);
|
||||
}
|
||||
else if (eCSSToken_Symbol == mToken.mType) {
|
||||
@ -3252,12 +3247,10 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue)
|
||||
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // namespace
|
||||
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(holdIdent); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(holdIdent);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(holdIdent);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -271,8 +271,7 @@ void CSSCharsetRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSCharsetRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSCharsetRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
// add the string for encoding value
|
||||
@ -295,7 +294,7 @@ CSSCharsetRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSCharsetRuleImpl* clone = new CSSCharsetRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -520,8 +519,7 @@ void CSSImportRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSImportRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSImportRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -546,7 +544,7 @@ CSSImportRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSImportRuleImpl* clone = new CSSImportRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -935,8 +933,7 @@ void CSSMediaRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSMediaRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSMediaRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -981,7 +978,7 @@ CSSMediaRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSMediaRuleImpl* clone = new CSSMediaRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1380,8 +1377,7 @@ void CSSNameSpaceRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aS
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSNameSpaceRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSNameSpaceRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -1410,7 +1406,7 @@ CSSNameSpaceRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSNameSpaceRuleImpl* clone = new CSSNameSpaceRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -6117,8 +6117,7 @@ void nsCSSDeclaration::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
}
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsCSSDeclaration"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsCSSDeclaration");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
|
@ -336,8 +336,7 @@ void nsAttrSelector::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsAttrSelector"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsAttrSelector");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -655,8 +654,7 @@ void nsCSSSelector::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsCSSSelector"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsCSSSelector");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -1071,8 +1069,7 @@ void CSSImportantRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSImportantRule"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSImportantRule");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(CSSImportantRule);
|
||||
aSizeOfHandler->AddSize(tag,aSize);
|
||||
@ -1377,13 +1374,14 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAString& aDecl,
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::GetParent(nsISupports **aParent)
|
||||
{
|
||||
if (nsnull != mRule) {
|
||||
return mRule->QueryInterface(kISupportsIID, (void **)aParent);
|
||||
} else {
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
|
||||
if (mRule) {
|
||||
return CallQueryInterface(mRule, aParent);
|
||||
}
|
||||
|
||||
*aParent = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1698,7 +1696,7 @@ CSSStyleRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSStyleRuleImpl* clone = new CSSStyleRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -2446,8 +2444,7 @@ void CSSStyleRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSStyleRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSStyleRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
// remove the sizeof the mSelector's class since we count it seperately below
|
||||
@ -2509,8 +2506,8 @@ CSSStyleRuleImpl::SetCssText(const nsAString& aCssText)
|
||||
NS_IMETHODIMP
|
||||
CSSStyleRuleImpl::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
|
||||
{
|
||||
if (nsnull != mSheet) {
|
||||
return mSheet->QueryInterface(NS_GET_IID(nsIDOMCSSStyleSheet), (void**)aSheet);
|
||||
if (mSheet) {
|
||||
return CallQueryInterface(mSheet, aSheet);
|
||||
}
|
||||
*aSheet = nsnull;
|
||||
return NS_OK;
|
||||
@ -2566,10 +2563,10 @@ NS_EXPORT nsresult
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
CSSStyleRuleImpl *it = new CSSStyleRuleImpl(aSelector);
|
||||
|
||||
if (nsnull == it) {
|
||||
CSSStyleRuleImpl *it = new CSSStyleRuleImpl(aSelector);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsICSSStyleRule), (void **) aInstancePtrResult);
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -1317,7 +1317,7 @@ DOMMediaListImpl::Delete(const nsAString& aOldMedium)
|
||||
if (aOldMedium.IsEmpty())
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
|
||||
nsCOMPtr<nsIAtom> old(dont_AddRef(NS_NewAtom(aOldMedium)));
|
||||
nsCOMPtr<nsIAtom> old = do_GetAtom(aOldMedium);
|
||||
NS_ENSURE_TRUE(old, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRInt32 indx = IndexOf(old);
|
||||
@ -1337,7 +1337,7 @@ DOMMediaListImpl::Append(const nsAString& aNewMedium)
|
||||
if (aNewMedium.IsEmpty())
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
|
||||
nsCOMPtr<nsIAtom> media(dont_AddRef(NS_NewAtom(aNewMedium)));
|
||||
nsCOMPtr<nsIAtom> media = do_GetAtom(aNewMedium);
|
||||
NS_ENSURE_TRUE(media, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRInt32 indx = IndexOf(media);
|
||||
@ -1453,14 +1453,14 @@ CSSImportsCollectionImpl::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
|
||||
nsresult result = NS_OK;
|
||||
|
||||
*aReturn = nsnull;
|
||||
if (nsnull != mStyleSheet) {
|
||||
nsICSSStyleSheet *sheet;
|
||||
|
||||
result = mStyleSheet->GetStyleSheetAt(aIndex, sheet);
|
||||
if (NS_OK == result) {
|
||||
result = sheet->QueryInterface(NS_GET_IID(nsIDOMStyleSheet), (void **)aReturn);
|
||||
if (mStyleSheet) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
|
||||
result = mStyleSheet->GetStyleSheetAt(aIndex, *getter_AddRefs(sheet));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = CallQueryInterface(sheet, aReturn);
|
||||
}
|
||||
NS_RELEASE(sheet);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1667,8 +1667,7 @@ void CSSStyleSheetInner::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
|
||||
PRBool rulesCounted=PR_FALSE;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSStyleSheetInner"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSStyleSheetInner");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(CSSStyleSheetInner);
|
||||
|
||||
@ -2588,8 +2587,7 @@ void CSSStyleSheetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSStyleSheet"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSStyleSheet");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(CSSStyleSheetImpl);
|
||||
|
||||
@ -4350,13 +4348,13 @@ void CascadeSizeEnumFunc(RuleCascadeData *cascade, CascadeSizeEnumData *pData)
|
||||
|
||||
// next add up the selectors and the weighted rules for the cascade
|
||||
nsCOMPtr<nsIAtom> stateSelectorSizeTag;
|
||||
stateSelectorSizeTag = getter_AddRefs(NS_NewAtom("CascadeStateSelectors"));
|
||||
stateSelectorSizeTag = do_GetAtom("CascadeStateSelectors");
|
||||
CascadeSizeEnumData stateData(pData->handler,pData->uniqueItems,stateSelectorSizeTag);
|
||||
cascade->mStateSelectors.EnumerateForwards(StateSelectorsSizeEnumFunc, &stateData);
|
||||
|
||||
if(cascade->mWeightedRules){
|
||||
nsCOMPtr<nsIAtom> weightedRulesSizeTag;
|
||||
weightedRulesSizeTag = getter_AddRefs(NS_NewAtom("CascadeWeightedRules"));
|
||||
weightedRulesSizeTag = do_GetAtom("CascadeWeightedRules");
|
||||
CascadeSizeEnumData stateData2(pData->handler,pData->uniqueItems,weightedRulesSizeTag);
|
||||
cascade->mWeightedRules->EnumerateForwards(WeightedRulesSizeEnumFunc, &stateData2);
|
||||
}
|
||||
@ -4387,8 +4385,7 @@ void CSSRuleProcessor::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
}
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSRuleProcessor"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSRuleProcessor");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(CSSRuleProcessor);
|
||||
|
||||
@ -4413,7 +4410,7 @@ void CSSRuleProcessor::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
// and for the medium cascade table we account for the hash table overhead,
|
||||
// and then compute the sizeof each rule-cascade in the table
|
||||
{
|
||||
nsCOMPtr<nsIAtom> tag2 = getter_AddRefs(NS_NewAtom("RuleCascade"));
|
||||
nsCOMPtr<nsIAtom> tag2 = do_GetAtom("RuleCascade");
|
||||
CascadeSizeEnumData data(aSizeOfHandler, uniqueItems, tag2);
|
||||
for (RuleCascadeData *cascadeData = mRuleCascades;
|
||||
cascadeData;
|
||||
|
@ -205,7 +205,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
||||
}
|
||||
|
||||
if (!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty()) {
|
||||
mPseudo = dont_AddRef(NS_NewAtom(aPseudoElt));
|
||||
mPseudo = do_GetAtom(aPseudoElt);
|
||||
NS_ENSURE_TRUE(mPseudo, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ nsDOMCSSDeclaration::GetParentRule(nsIDOMCSSRule** aParentRule)
|
||||
GetParent(getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
parent->QueryInterface(NS_GET_IID(nsIDOMCSSRule), (void **)aParentRule);
|
||||
CallQueryInterface(parent, aParentRule);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -819,7 +819,7 @@ void nsHTMLMappedAttributes::SizeOf(nsISizeOfHandler* aSizer, PRUint32 &aResult)
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("HTMLMappedAttributes"));
|
||||
tag = do_GetAtom("HTMLMappedAttributes");
|
||||
aResult = sizeof(*this);
|
||||
aSizer->AddSize(tag, aResult);
|
||||
}
|
||||
@ -1625,7 +1625,7 @@ void nsHTMLAttributes::SizeOf(nsISizeOfHandler* aSizer, PRUint32 &aResult)
|
||||
aResult = sum;
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsHTMLAttributes"));
|
||||
tag = do_GetAtom("nsHTMLAttributes");
|
||||
aSizer->AddSize(tag, aResult);
|
||||
}
|
||||
#endif
|
||||
|
@ -157,7 +157,7 @@ void CSSFirstLineRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
|
||||
// get or create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSFirstLine-LetterRule"));
|
||||
tag = do_GetAtom("CSSFirstLine-LetterRule");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
aSizeOfHandler->AddSize(tag,aSize);
|
||||
@ -523,7 +523,7 @@ void HTMLCSSStyleSheetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &a
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("HTMLCSSStyleSheet"));
|
||||
tag = do_GetAtom("HTMLCSSStyleSheet");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(HTMLCSSStyleSheetImpl);
|
||||
aSizeOfHandler->AddSize(tag,aSize);
|
||||
@ -534,13 +534,13 @@ void HTMLCSSStyleSheetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &a
|
||||
if(mFirstLineRule && uniqueItems->AddItem((void*)mFirstLineRule)){
|
||||
localSize = sizeof(*mFirstLineRule);
|
||||
aSize += localSize;
|
||||
tag = getter_AddRefs(NS_NewAtom("FirstLineRule"));
|
||||
tag = do_GetAtom("FirstLineRule");
|
||||
aSizeOfHandler->AddSize(tag,localSize);
|
||||
}
|
||||
if(mFirstLetterRule && uniqueItems->AddItem((void*)mFirstLetterRule)){
|
||||
localSize = sizeof(*mFirstLetterRule);
|
||||
aSize += localSize;
|
||||
tag = getter_AddRefs(NS_NewAtom("FirstLetterRule"));
|
||||
tag = do_GetAtom("FirstLetterRule");
|
||||
aSizeOfHandler->AddSize(tag,localSize);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ nsresult nsImageMapUtils::FindImageMap(nsIDocument *aDocument,
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
domDoc->GetElementById(usemap,getter_AddRefs(element));
|
||||
if (element) {
|
||||
element->QueryInterface(NS_GET_IID(nsIDOMHTMLMapElement),(void**)aMap);
|
||||
CallQueryInterface(element, aMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ nsSVGAttribute::SetPrefix(const nsAString& aPrefix)
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -346,8 +346,7 @@ nsSVGAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
|
||||
nsIContent *content;
|
||||
if (mOwner && (content = mOwner->GetContent())) {
|
||||
return content->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||
(void **)aOwnerElement);
|
||||
return CallQueryInterface(content, aOwnerElement);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -644,13 +643,14 @@ nsSVGAttributes::SetAttr(nsINodeInfo* aNodeInfo,
|
||||
mutation.message = NS_MUTATION_ATTRMODIFIED;
|
||||
mutation.mTarget = node;
|
||||
|
||||
//XXX mutation.mRelatedNode = do_QueryInterface(attr);
|
||||
attr->QueryInterface(NS_GET_IID(nsIDOMNode), getter_AddRefs(mutation.mRelatedNode));
|
||||
CallQueryInterface(attr,
|
||||
NS_STATIC_CAST(nsIDOMNode**,
|
||||
getter_AddRefs(mutation.mRelatedNode)));
|
||||
mutation.mAttrName = name;
|
||||
if (!oldValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(oldValue);
|
||||
if (!aValue.IsEmpty())
|
||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||
mutation.mNewAttrValue = do_GetAtom(aValue);
|
||||
mutation.mAttrChange = modification ? nsIDOMMutationEvent::MODIFICATION :
|
||||
nsIDOMMutationEvent::ADDITION;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -707,13 +707,14 @@ nsSVGAttributes::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
mutation.message = NS_MUTATION_ATTRMODIFIED;
|
||||
mutation.mTarget = node;
|
||||
|
||||
//XXX mutation.mRelatedNode = do_QueryInterface(attr);
|
||||
attr->QueryInterface(NS_GET_IID(nsIDOMNode), getter_AddRefs(mutation.mRelatedNode));
|
||||
CallQueryInterface(attr,
|
||||
NS_STATIC_CAST(nsIDOMNode**,
|
||||
getter_AddRefs(mutation.mRelatedNode)));
|
||||
mutation.mAttrName = aName;
|
||||
nsAutoString str;
|
||||
attr->GetValue()->GetValueString(str);
|
||||
if (!str.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(str));
|
||||
mutation.mPrevAttrValue = do_GetAtom(str);
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -503,11 +503,11 @@ NS_IMETHODIMP
|
||||
nsSVGElement::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
if (mParent) {
|
||||
return mParent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aParentNode);
|
||||
return CallQueryInterface(mParent, aParentNode);
|
||||
}
|
||||
else if (mDocument) {
|
||||
if (mDocument) {
|
||||
// we're the root content
|
||||
return mDocument->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aParentNode);
|
||||
return CallQueryInterface(mDocument, aParentNode);
|
||||
}
|
||||
|
||||
// A standalone element (i.e. one without a parent or a document)
|
||||
@ -520,26 +520,24 @@ nsSVGElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
nsDOMSlots *slots = GetDOMSlots();
|
||||
|
||||
if (nsnull == slots->mChildNodes) {
|
||||
if (!slots->mChildNodes) {
|
||||
slots->mChildNodes = new nsChildContentList(this);
|
||||
if (nsnull == slots->mChildNodes) {
|
||||
if (!slots->mChildNodes) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(slots->mChildNodes);
|
||||
}
|
||||
|
||||
return slots->mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList),
|
||||
(void **)aChildNodes);
|
||||
|
||||
return CallQueryInterface(slots->mChildNodes, aChildNodes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::GetFirstChild(nsIDOMNode** aNode)
|
||||
{
|
||||
nsIContent *child = (nsIContent *)mChildren.ElementAt(0);
|
||||
if (nsnull != child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
if (child) {
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
return res;
|
||||
}
|
||||
*aNode = nsnull;
|
||||
@ -550,10 +548,9 @@ NS_IMETHODIMP
|
||||
nsSVGElement::GetLastChild(nsIDOMNode** aNode)
|
||||
{
|
||||
nsIContent *child = (nsIContent *)mChildren.ElementAt(mChildren.Count()-1);
|
||||
if (nsnull != child) {
|
||||
nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode),
|
||||
(void**)aNode);
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node
|
||||
if (child) {
|
||||
nsresult res = CallQueryInterface(child, aNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
|
||||
return res;
|
||||
}
|
||||
*aNode = nsnull;
|
||||
|
@ -577,7 +577,7 @@ PRUint16 nsSVGLength::GetUnitTypeForString(const char* unitStr)
|
||||
{
|
||||
if (!unitStr || *unitStr=='\0') return SVG_LENGTHTYPE_NUMBER;
|
||||
|
||||
nsCOMPtr<nsIAtom> unitAtom = NS_NewAtom(unitStr);
|
||||
nsCOMPtr<nsIAtom> unitAtom = do_GetAtom(unitStr);
|
||||
|
||||
if (unitAtom == nsSVGAtoms::px)
|
||||
return SVG_LENGTHTYPE_PX;
|
||||
|
@ -501,7 +501,7 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
|
||||
#endif
|
||||
if (frame) {
|
||||
nsISVGFrame* svgframe;
|
||||
frame->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&svgframe);
|
||||
CallQueryInterface(frame, &svgframe);
|
||||
NS_ASSERTION(svgframe, "wrong frame type");
|
||||
if (svgframe) {
|
||||
svgframe->NotifyRedrawSuspended();
|
||||
@ -548,7 +548,7 @@ nsSVGSVGElement::UnsuspendRedrawAll()
|
||||
#endif
|
||||
if (frame) {
|
||||
nsISVGFrame* svgframe;
|
||||
frame->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&svgframe);
|
||||
CallQueryInterface(frame, &svgframe);
|
||||
NS_ASSERTION(svgframe, "wrong frame type");
|
||||
if (svgframe) {
|
||||
svgframe->NotifyRedrawUnsuspended();
|
||||
@ -995,7 +995,7 @@ void nsSVGSVGElement::GetScreenPosition(PRInt32 &x, PRInt32 &y)
|
||||
if (view) {
|
||||
// handle scrolled views along the way:
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView);
|
||||
CallQueryInterface(view, &scrollableView);
|
||||
if (scrollableView) {
|
||||
nscoord scrollX, scrollY;
|
||||
scrollableView->GetScrollPosition(scrollX, scrollY);
|
||||
|
@ -204,7 +204,7 @@ nsSVGTransformList::SetValueString(const nsAString& aValue)
|
||||
break;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> keyatom = dont_AddRef(NS_NewAtom(keyword));
|
||||
nsCOMPtr<nsIAtom> keyatom = do_GetAtom(keyword);
|
||||
|
||||
if (keyatom == nsSVGAtoms::translate) {
|
||||
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
|
||||
|
@ -142,8 +142,7 @@ NS_EXPORT nsresult
|
||||
NS_NewSVGDocument(nsIDocument** aInstancePtrResult)
|
||||
{
|
||||
nsSVGDocument* doc = new nsSVGDocument();
|
||||
if (!doc)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return doc->QueryInterface(NS_GET_IID(nsIDocument),
|
||||
(void**) aInstancePtrResult);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return CallQueryInterface(doc, aInstancePtrResult);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
nsISupportsArray* mElements;
|
||||
};
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsAnonymousContentList);
|
||||
MOZ_DECL_CTOR_COUNTER(nsAnonymousContentList)
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAnonymousContentList, nsGenericDOMNodeList, nsIAnonymousContentList)
|
||||
|
||||
@ -191,7 +191,7 @@ nsAnonymousContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
nsCOMPtr<nsIContent> result;
|
||||
rv = point->ChildAt(aIndex, getter_AddRefs(result));
|
||||
if (result && NS_SUCCEEDED(rv))
|
||||
return result->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
return CallQueryInterface(result, aReturn);
|
||||
else return rv;
|
||||
}
|
||||
}
|
||||
|
@ -1465,7 +1465,7 @@ nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName,
|
||||
nsAutoString eventStr(NS_LITERAL_STRING("on"));
|
||||
eventStr += val;
|
||||
|
||||
nsCOMPtr<nsIAtom> eventName = getter_AddRefs(NS_NewAtom(eventStr));
|
||||
nsCOMPtr<nsIAtom> eventName = do_GetAtom(eventStr);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
|
@ -63,17 +63,16 @@ NS_NewXBLContentSink(nsIXMLContentSink** aResult,
|
||||
nsIURI* aURL,
|
||||
nsIWebShell* aWebShell)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsXBLContentSink* it;
|
||||
NS_NEWXPCOM(it, nsXBLContentSink);
|
||||
if (!it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = it->Init(aDoc, aURL, aWebShell);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return it->QueryInterface(NS_GET_IID(nsIXMLContentSink), (void **)aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsXBLContentSink::nsXBLContentSink()
|
||||
@ -800,7 +799,7 @@ nsXBLContentSink::AddAttributesToXULPrototype(const PRUnichar **aAtts,
|
||||
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None;
|
||||
nameAtom = dont_AddRef(NS_NewAtom(key));
|
||||
nameAtom = do_GetAtom(key);
|
||||
nameSpacePrefix = nsnull;
|
||||
}
|
||||
|
||||
@ -831,12 +830,8 @@ nsXBLContentSink::AddAttributesToXULPrototype(const PRUnichar **aAtts,
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
if (!mCSSParser) {
|
||||
rv = nsComponentManager::CreateInstance(kCSSParserCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSParser),
|
||||
getter_AddRefs(mCSSParser));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mCSSParser = do_CreateInstance(kCSSParserCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = mCSSParser->ParseStyleAttribute(value, mDocumentURL,
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "nsIXBLPrototypeHandler.h"
|
||||
#include "nsXBLProtoImplMember.h"
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLProtoImpl);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLProtoImpl)
|
||||
|
||||
class nsXBLProtoImpl
|
||||
{
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "nsXBLProtoImplField.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLProtoImplField);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLProtoImplField)
|
||||
|
||||
nsXBLProtoImplField::nsXBLProtoImplField(const PRUnichar* aName, const PRUnichar* aReadOnly)
|
||||
: nsXBLProtoImplMember(aName),
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsXBLProtoImplMember.h"
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLParameter);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLParameter)
|
||||
|
||||
struct nsXBLParameter {
|
||||
nsXBLParameter* mNext;
|
||||
@ -66,7 +66,7 @@ struct nsXBLParameter {
|
||||
}
|
||||
};
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLUncompiledMethod);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLUncompiledMethod)
|
||||
|
||||
struct nsXBLUncompiledMethod {
|
||||
nsXBLParameter* mParameters;
|
||||
|
@ -1135,12 +1135,13 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
|
||||
attrTok.Left(left, index);
|
||||
attrTok.Right(right, attrTok.Length()-index-1);
|
||||
|
||||
atom = getter_AddRefs(NS_NewAtom(right.get()));
|
||||
attribute = getter_AddRefs(NS_NewAtom(left.get()));
|
||||
atom = do_GetAtom(right);
|
||||
attribute = do_GetAtom(left);
|
||||
}
|
||||
else {
|
||||
nsAutoString tok; tok.AssignWithConversion(token);
|
||||
atom = getter_AddRefs(NS_NewAtom(tok.get()));
|
||||
nsAutoString tok;
|
||||
tok.AssignWithConversion(token);
|
||||
atom = do_GetAtom(tok);
|
||||
attribute = atom;
|
||||
}
|
||||
|
||||
@ -1230,11 +1231,11 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
|
||||
|
||||
char* token = nsCRT::strtok( str, "| ", &newStr );
|
||||
while( token != NULL ) {
|
||||
nsAutoString tok;
|
||||
tok.AssignWithConversion(token);
|
||||
|
||||
// Build an atom out of this string.
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
|
||||
nsAutoString tok; tok.AssignWithConversion(token);
|
||||
atom = getter_AddRefs(NS_NewAtom(tok.get()));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(tok);
|
||||
|
||||
nsISupportsKey key(atom);
|
||||
mInsertionPointTable->Put(&key, xblIns);
|
||||
|
@ -334,7 +334,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
|
||||
nsAutoString str;
|
||||
mEventName->ToString(str);
|
||||
onEvent += str;
|
||||
nsCOMPtr<nsIAtom> onEventAtom = getter_AddRefs(NS_NewAtom(onEvent));
|
||||
nsCOMPtr<nsIAtom> onEventAtom = do_GetAtom(onEvent);
|
||||
|
||||
void* handler = nsnull;
|
||||
|
||||
@ -869,7 +869,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
return;
|
||||
}
|
||||
|
||||
mEventName = getter_AddRefs(NS_NewAtom(event));
|
||||
mEventName = do_GetAtom(event);
|
||||
|
||||
if (aPhase) {
|
||||
const nsDependentString phase(aPhase);
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID);
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLPrototypeResources);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLPrototypeResources)
|
||||
|
||||
nsXBLPrototypeResources::nsXBLPrototypeResources(nsIXBLPrototypeBinding* aBinding)
|
||||
:mStyleSheetList(nsnull)
|
||||
@ -112,11 +112,8 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
||||
// they'll still be in the chrome cache.
|
||||
mRuleProcessors->Clear();
|
||||
|
||||
nsCOMPtr<nsICSSLoader> loader;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSLoader),
|
||||
getter_AddRefs(loader));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICSSLoader> loader = do_CreateInstance(kCSSLoaderCID, &rv);
|
||||
if (NS_FAILED(rv) || !loader) return rv;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> newSheets;
|
||||
|
@ -52,7 +52,7 @@ class nsXBLPrototypeResources;
|
||||
// *********************************************************************/
|
||||
// The XBLResourceLoader class
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLResource);
|
||||
MOZ_DECL_CTOR_COUNTER(nsXBLResource)
|
||||
|
||||
struct nsXBLResource {
|
||||
nsXBLResource* mNext;
|
||||
|
@ -194,9 +194,7 @@ protected:
|
||||
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
nsServiceManager::GetService("@mozilla.org/xbl;1",
|
||||
NS_GET_IID(nsIXBLService),
|
||||
(nsISupports**) &gXBLService);
|
||||
CallGetService("@mozilla.org/xbl;1", &gXBLService);
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,8 +202,7 @@ protected:
|
||||
{
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
nsServiceManager::ReleaseService("@mozilla.org/xbl;1", gXBLService);
|
||||
gXBLService = nsnull;
|
||||
NS_IF_RELEASE(gXBLService);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,10 +277,8 @@ nsXBLStreamListener::nsXBLStreamListener(nsXBLService* aXBLService,
|
||||
mBindingDocument = aBindingDocument;
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService("@mozilla.org/xul/xul-prototype-cache;1",
|
||||
NS_GET_IID(nsIXULPrototypeCache),
|
||||
(nsISupports**) &gXULCache);
|
||||
nsresult rv = CallGetService("@mozilla.org/xul/xul-prototype-cache;1",
|
||||
&gXULCache);
|
||||
if (NS_FAILED(rv)) return;
|
||||
}
|
||||
}
|
||||
@ -293,10 +288,7 @@ nsXBLStreamListener::~nsXBLStreamListener()
|
||||
/* destructor code */
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
if (gXULCache) {
|
||||
nsServiceManager::ReleaseService("@mozilla.org/xul/xul-prototype-cache;1", gXULCache);
|
||||
gXULCache = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gXULCache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -936,7 +928,7 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement,
|
||||
nsAutoString nameSpace;
|
||||
|
||||
if (!prefix.IsEmpty()) {
|
||||
nsCOMPtr<nsIAtom> prefixAtom = getter_AddRefs(NS_NewAtom(prefix));
|
||||
nsCOMPtr<nsIAtom> prefixAtom = do_GetAtom(prefix);
|
||||
|
||||
nsCOMPtr<nsIDOM3Node> node(do_QueryInterface(child));
|
||||
|
||||
@ -956,7 +948,7 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement,
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(nameSpace,
|
||||
nameSpaceID);
|
||||
|
||||
nsCOMPtr<nsIAtom> tagName = getter_AddRefs(NS_NewAtom(display));
|
||||
nsCOMPtr<nsIAtom> tagName = do_GetAtom(display);
|
||||
protoBinding->SetBaseTag(nameSpaceID, tagName);
|
||||
}
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ nsXMLElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
|
||||
CopyInnerTo(this, it, aDeep);
|
||||
|
||||
rv = it->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aReturn);
|
||||
rv = CallQueryInterface(it, aReturn);
|
||||
NS_RELEASE(it);
|
||||
return rv;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
|
||||
delete it;
|
||||
return rv;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsIXMLContentSink), (void **)aResult);
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsXMLContentSink::nsXMLContentSink()
|
||||
@ -233,10 +233,9 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
|
||||
mState = eXMLContentSinkState_InProlog;
|
||||
mDocElement = nsnull;
|
||||
|
||||
nsIHTMLContentContainer* htmlContainer = nsnull;
|
||||
if (NS_SUCCEEDED(aDoc->QueryInterface(NS_GET_IID(nsIHTMLContentContainer), (void**)&htmlContainer))) {
|
||||
nsCOMPtr<nsIHTMLContentContainer> htmlContainer = do_QueryInterface(aDoc);
|
||||
if (htmlContainer) {
|
||||
htmlContainer->GetCSSLoader(mCSSLoader);
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
|
||||
ProcessHTTPHeaders(aChannel);
|
||||
@ -1200,7 +1199,7 @@ nsXMLContentSink::ProcessHTTPHeaders(nsIChannel* aChannel) {
|
||||
while(*name) {
|
||||
rv = httpchannel->GetResponseHeader(nsDependentCString(*name), tmp);
|
||||
if (NS_SUCCEEDED(rv) && !tmp.IsEmpty()) {
|
||||
nsCOMPtr<nsIAtom> key(dont_AddRef(NS_NewAtom(*name)));
|
||||
nsCOMPtr<nsIAtom> key = do_GetAtom(*name);
|
||||
ProcessHeaderData(key,NS_ConvertASCIItoUCS2(tmp),nsnull);
|
||||
}
|
||||
name++;
|
||||
@ -1384,11 +1383,10 @@ nsXMLContentSink::StartLayout()
|
||||
// If the document we are loading has a reference or it is a top level
|
||||
// frameset document, disable the scroll bars on the views.
|
||||
nsCAutoString ref;
|
||||
nsIURL* url;
|
||||
nsresult rv = mDocumentURL->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(mDocumentURL, &rv);
|
||||
if (url) {
|
||||
rv = url->GetRef(ref);
|
||||
NS_RELEASE(url);
|
||||
}
|
||||
if (rv == NS_OK) {
|
||||
NS_UnescapeURL(ref); // XXX this may result in random non-ASCII bytes!
|
||||
@ -1420,10 +1418,10 @@ nsXMLContentSink::StartLayout()
|
||||
if (vm) {
|
||||
nsIView* rootView = nsnull;
|
||||
vm->GetRootView(rootView);
|
||||
if (nsnull != rootView) {
|
||||
if (rootView) {
|
||||
nsIScrollableView* sview = nsnull;
|
||||
rootView->QueryInterface(NS_GET_IID(nsIScrollableView), (void**) &sview);
|
||||
if (nsnull != sview) {
|
||||
CallQueryInterface(rootView, &sview);
|
||||
if (sview) {
|
||||
sview->SetScrollPreference(nsScrollPreference_kNeverScroll);
|
||||
}
|
||||
}
|
||||
@ -1837,21 +1835,15 @@ nsXMLContentSink::HandleComment(const PRUnichar *aName)
|
||||
{
|
||||
FlushText();
|
||||
|
||||
nsIContent *comment;
|
||||
nsIDOMComment *domComment;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = NS_NewCommentNode(&comment);
|
||||
if (NS_OK == result) {
|
||||
result = comment->QueryInterface(NS_GET_IID(nsIDOMComment), (void **)&domComment);
|
||||
if (NS_OK == result) {
|
||||
nsCOMPtr<nsIContent> comment;
|
||||
nsresult result = NS_NewCommentNode(getter_AddRefs(comment));
|
||||
if (comment) {
|
||||
nsCOMPtr<nsIDOMComment> domComment = do_QueryInterface(comment, &result);
|
||||
if (domComment) {
|
||||
domComment->AppendData(nsDependentString(aName));
|
||||
NS_RELEASE(domComment);
|
||||
|
||||
comment->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
result = AddContentAsLeaf(comment);
|
||||
}
|
||||
NS_RELEASE(comment);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1862,26 +1854,20 @@ nsXMLContentSink::HandleCDataSection(const PRUnichar *aData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
FlushText();
|
||||
|
||||
nsIContent *cdata;
|
||||
nsIDOMCDATASection *domCDATA;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (mInTitle) {
|
||||
mTitleText.Append(aData, aLength);
|
||||
}
|
||||
|
||||
result = NS_NewXMLCDATASection(&cdata);
|
||||
if (NS_OK == result) {
|
||||
result = cdata->QueryInterface(NS_GET_IID(nsIDOMCDATASection), (void **)&domCDATA);
|
||||
if (NS_OK == result) {
|
||||
nsCOMPtr<nsIContent> cdata;
|
||||
nsresult result = NS_NewXMLCDATASection(getter_AddRefs(cdata));
|
||||
if (cdata) {
|
||||
nsCOMPtr<nsIDOMCDATASection> domCDATA = do_QueryInterface(cdata);
|
||||
if (domCDATA) {
|
||||
domCDATA->SetData(nsDependentString(aData, aLength));
|
||||
NS_RELEASE(domCDATA);
|
||||
|
||||
cdata->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
result = AddContentAsLeaf(cdata);
|
||||
}
|
||||
NS_RELEASE(cdata);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -2143,8 +2129,7 @@ nsXMLContentSink::PushNameSpacesFrom(const PRUnichar** aAtts)
|
||||
if (*start == ':') {
|
||||
++start;
|
||||
|
||||
prefixAtom =
|
||||
dont_AddRef(NS_NewAtom(nsDependentSubstring(start, end)));
|
||||
prefixAtom = do_GetAtom(Substring(start, end));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2200,7 +2185,7 @@ nsXMLContentSink::AddAttributes(const PRUnichar** aAtts,
|
||||
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None;
|
||||
nameAtom = dont_AddRef(NS_NewAtom(key));
|
||||
nameAtom = do_GetAtom(key);
|
||||
nameSpacePrefix = nsnull;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIAggregatePrincipal.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsFIXptr.h"
|
||||
@ -96,8 +95,6 @@
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIScriptGlobalObjectOwner.h"
|
||||
|
||||
static NS_DEFINE_CID(kHTMLStyleSheetCID,NS_HTMLSTYLESHEET_CID);
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
@ -182,8 +179,7 @@ NS_NewXMLDocument(nsIDocument** aInstancePtrResult)
|
||||
}
|
||||
|
||||
nsXMLDocument::nsXMLDocument()
|
||||
: mAttrStyleSheet(nsnull), mInlineStyleSheet(nsnull),
|
||||
mCountCatalogSheets(0), mParser(nsnull),
|
||||
: mCountCatalogSheets(0), mParser(nsnull),
|
||||
mCrossSiteAccessEnabled(PR_FALSE), mXMLDeclarationBits(0)
|
||||
{
|
||||
}
|
||||
@ -193,11 +189,9 @@ nsXMLDocument::~nsXMLDocument()
|
||||
NS_IF_RELEASE(mParser);
|
||||
if (mAttrStyleSheet) {
|
||||
mAttrStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mAttrStyleSheet);
|
||||
}
|
||||
if (mInlineStyleSheet) {
|
||||
mInlineStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mInlineStyleSheet);
|
||||
}
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->DropDocumentReference();
|
||||
@ -224,20 +218,20 @@ NS_IMETHODIMP
|
||||
nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
nsresult result = nsDocument::Reset(aChannel, aLoadGroup);
|
||||
if (NS_FAILED(result)) return result;
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
nsCOMPtr<nsIURI> url;
|
||||
if (aChannel) {
|
||||
result = aChannel->GetURI(getter_AddRefs(url));
|
||||
if (NS_FAILED(result)) return result;
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
}
|
||||
|
||||
if (nsnull != mAttrStyleSheet) {
|
||||
if (mAttrStyleSheet) {
|
||||
mAttrStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mAttrStyleSheet);
|
||||
}
|
||||
if (nsnull != mInlineStyleSheet) {
|
||||
if (mInlineStyleSheet) {
|
||||
mInlineStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mInlineStyleSheet);
|
||||
}
|
||||
|
||||
result = SetDefaultStylesheets(url);
|
||||
@ -377,7 +371,7 @@ nsXMLDocument::Load(const nsAString& aUrl)
|
||||
if (NS_SUCCEEDED(stack->Peek(&cx)) && cx) {
|
||||
nsISupports *priv = (nsISupports *)::JS_GetContextPrivate(cx);
|
||||
if (priv) {
|
||||
priv->QueryInterface(NS_GET_IID(nsIScriptContext), getter_AddRefs(mScriptContext));
|
||||
mScriptContext = do_QueryInterface(priv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -398,13 +392,14 @@ nsXMLDocument::Load(const nsAString& aUrl)
|
||||
mPrincipal = nsnull;
|
||||
nsCOMPtr<nsISupports> channelOwner;
|
||||
rv = channel->GetOwner(getter_AddRefs(channelOwner));
|
||||
if (NS_SUCCEEDED(rv) && channelOwner)
|
||||
mPrincipal = do_QueryInterface(channelOwner, &rv);
|
||||
if (NS_SUCCEEDED(rv) && channelOwner) {
|
||||
mPrincipal = do_QueryInterface(channelOwner, &rv);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !channelOwner)
|
||||
{
|
||||
rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(mPrincipal));
|
||||
if (!mPrincipal) return rv;
|
||||
NS_ENSURE_TRUE(mPrincipal, rv);
|
||||
}
|
||||
|
||||
// Prepare for loading the XML document "into oneself"
|
||||
@ -490,9 +485,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID, nsnull,
|
||||
NS_GET_IID(nsIParser),
|
||||
(void **)&mParser);
|
||||
rv = CallCreateInstance(kCParserCID, &mParser);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIXMLContentSink> sink;
|
||||
@ -516,11 +509,11 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
rv = NS_NewXMLContentSink(getter_AddRefs(sink), this, aUrl, nsnull, aChannel);
|
||||
}
|
||||
|
||||
if (NS_OK == rv) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Set the parser as the stream listener for the document loader...
|
||||
rv = mParser->QueryInterface(NS_GET_IID(nsIStreamListener), (void**)aDocListener);
|
||||
rv = CallQueryInterface(mParser, aDocListener);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetDocumentCharacterSet(charset);
|
||||
mParser->SetDocumentCharset(charset, charsetSource);
|
||||
mParser->SetCommand(aCommand);
|
||||
@ -563,34 +556,26 @@ nsXMLDocument::EndLoad()
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mAttrStyleSheet;
|
||||
if (nsnull == mAttrStyleSheet) {
|
||||
return NS_ERROR_NOT_AVAILABLE; // probably not the right error...
|
||||
}
|
||||
else {
|
||||
NS_ADDREF(mAttrStyleSheet);
|
||||
}
|
||||
NS_ENSURE_TRUE(mAttrStyleSheet, NS_ERROR_NOT_AVAILABLE); // probably not the right error...
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mInlineStyleSheet;
|
||||
if (nsnull == mInlineStyleSheet) {
|
||||
return NS_ERROR_NOT_AVAILABLE; // probably not the right error...
|
||||
}
|
||||
else {
|
||||
NS_ADDREF(mInlineStyleSheet);
|
||||
}
|
||||
NS_ENSURE_TRUE(mInlineStyleSheet, NS_ERROR_NOT_AVAILABLE); // probably not the right error...
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -691,13 +676,12 @@ nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** a
|
||||
if (FindInReadable(NS_LITERAL_STRING("]]>"),begin,end))
|
||||
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
|
||||
|
||||
nsIContent* content;
|
||||
nsresult rv = NS_NewXMLCDATASection(&content);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
nsresult rv = NS_NewXMLCDATASection(getter_AddRefs(content));
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = content->QueryInterface(NS_GET_IID(nsIDOMCDATASection), (void**)aReturn);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = CallQueryInterface(content, aReturn);
|
||||
(*aReturn)->AppendData(aData);
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -720,17 +704,14 @@ nsXMLDocument::CreateProcessingInstruction(const nsAString& aTarget,
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsIContent* content;
|
||||
nsresult rv = NS_NewXMLProcessingInstruction(&content, aTarget, aData);
|
||||
|
||||
if (NS_OK != rv) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
nsresult rv = NS_NewXMLProcessingInstruction(getter_AddRefs(content),
|
||||
aTarget, aData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = content->QueryInterface(NS_GET_IID(nsIDOMProcessingInstruction), (void**)aReturn);
|
||||
NS_RELEASE(content);
|
||||
|
||||
return rv;
|
||||
return CallQueryInterface(content, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -817,7 +798,7 @@ nsXMLDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
}
|
||||
}
|
||||
|
||||
return newDoc->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
return CallQueryInterface(newDoc, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -842,12 +823,10 @@ nsXMLDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString value;
|
||||
nsDOMAttribute* attribute;
|
||||
|
||||
attribute = new nsDOMAttribute(nsnull, nodeInfo, value);
|
||||
nsDOMAttribute* attribute = new nsDOMAttribute(nsnull, nodeInfo, value);
|
||||
NS_ENSURE_TRUE(attribute, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return attribute->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**)aReturn);
|
||||
return CallQueryInterface(attribute, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -929,7 +908,7 @@ nsXMLDocument::GetElementById(const nsAString& aElementId,
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (content) {
|
||||
rv = content->QueryInterface(NS_GET_IID(nsIDOMElement),(void**)aReturn);
|
||||
rv = CallQueryInterface(content, aReturn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -941,19 +920,11 @@ nsXMLDocument::SetDefaultStylesheets(nsIURI* aUrl)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (aUrl) {
|
||||
//result = NS_NewHTMLStyleSheet(&mAttrStyleSheet, aUrl, this);
|
||||
result = nsComponentManager::CreateInstance(kHTMLStyleSheetCID,nsnull,NS_GET_IID(nsIHTMLStyleSheet),(void**)&mAttrStyleSheet);
|
||||
result = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), aUrl, this);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = mAttrStyleSheet->Init(aUrl,this);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_RELEASE(mAttrStyleSheet);
|
||||
}
|
||||
}
|
||||
if (NS_OK == result) {
|
||||
result = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mInlineStyleSheet), aUrl, this);
|
||||
AddStyleSheet(mAttrStyleSheet, 0); // tell the world about our new style sheet
|
||||
|
||||
result = NS_NewHTMLCSSStyleSheet(&mInlineStyleSheet, aUrl, this);
|
||||
if (NS_OK == result) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
AddStyleSheet(mInlineStyleSheet, 0); // tell the world about our new style sheet
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ protected:
|
||||
|
||||
// For HTML elements in our content model
|
||||
// XXX This is not clean, but is there a better way?
|
||||
nsIHTMLStyleSheet* mAttrStyleSheet;
|
||||
nsIHTMLCSSStyleSheet* mInlineStyleSheet;
|
||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mInlineStyleSheet;
|
||||
// For additional catalog sheets (if any) needed to layout the XML vocabulary
|
||||
// of the document. Catalog sheets are kept at the beginning of our array of
|
||||
// style sheets and this counter is used as an offset to distinguish them
|
||||
|
@ -95,7 +95,7 @@ nsresult nsXULAttributeValue::SetValue(const nsAString& aValue,
|
||||
|
||||
if (len && ((len <= kMaxAtomValueLength) || forceAtom))
|
||||
{
|
||||
newAtom = getter_AddRefs( NS_NewAtom(aValue) );
|
||||
newAtom = do_GetAtom(aValue);
|
||||
}
|
||||
|
||||
// Release the old value
|
||||
|
@ -309,7 +309,7 @@ nsXULAttribute::SetPrefix(const nsAString& aPrefix)
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -469,8 +469,7 @@ nsXULAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
||||
|
||||
return mContent->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||
(void **)aOwnerElement);
|
||||
return CallQueryInterface(mContent, aOwnerElement);
|
||||
}
|
||||
|
||||
|
||||
|
@ -461,10 +461,7 @@ nsXULElement::Init()
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
||||
rv = CallGetService(kRDFServiceCID, &gRDFService);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -496,10 +493,7 @@ nsXULElement::~nsXULElement()
|
||||
if (--gRefCnt == 0) {
|
||||
FinishEventHandlerMap();
|
||||
|
||||
if (gRDFService) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gRDFService);
|
||||
}
|
||||
}
|
||||
|
||||
@ -715,7 +709,7 @@ NS_IMETHODIMP
|
||||
nsXULElement::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
if (mParent) {
|
||||
return mParent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aParentNode);
|
||||
return CallQueryInterface(mParent, aParentNode);
|
||||
}
|
||||
|
||||
if (mDocument) {
|
||||
@ -729,7 +723,7 @@ nsXULElement::GetParentNode(nsIDOMNode** aParentNode)
|
||||
// If we don't have a parent, and we're the root content
|
||||
// of the document, DOM says that our parent is the
|
||||
// document.
|
||||
return mDocument->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aParentNode);
|
||||
return CallQueryInterface(mDocument, aParentNode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,9 +755,8 @@ nsXULElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
rv = child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) getter_AddRefs(domNode));
|
||||
if (NS_FAILED(rv)) {
|
||||
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(child);
|
||||
if (!domNode) {
|
||||
NS_WARNING("child content doesn't support nsIDOMNode");
|
||||
continue;
|
||||
}
|
||||
@ -787,8 +780,8 @@ nsXULElement::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
nsCOMPtr<nsIContent> child;
|
||||
rv = ChildAt(0, *getter_AddRefs(child));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && (child != nsnull)) {
|
||||
rv = child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aFirstChild);
|
||||
if (child) {
|
||||
rv = CallQueryInterface(child, aFirstChild);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM node");
|
||||
return rv;
|
||||
}
|
||||
@ -810,10 +803,10 @@ nsXULElement::GetLastChild(nsIDOMNode** aLastChild)
|
||||
nsCOMPtr<nsIContent> child;
|
||||
rv = ChildAt(count - 1, *getter_AddRefs(child));
|
||||
|
||||
NS_ASSERTION(child != nsnull, "no child");
|
||||
NS_ASSERTION(child, "no child");
|
||||
|
||||
if (child) {
|
||||
rv = child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aLastChild);
|
||||
rv = CallQueryInterface(child, aLastChild);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM node");
|
||||
return rv;
|
||||
}
|
||||
@ -834,8 +827,8 @@ nsXULElement::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
|
||||
nsCOMPtr<nsIContent> prev;
|
||||
mParent->ChildAt(--pos, *getter_AddRefs(prev));
|
||||
if (prev) {
|
||||
nsresult rv = prev->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aPreviousSibling);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM node");
|
||||
nsresult rv = CallQueryInterface(prev, aPreviousSibling);
|
||||
NS_ASSERTION(*aPreviousSibling, "not a DOM node");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@ -858,8 +851,8 @@ nsXULElement::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
nsCOMPtr<nsIContent> next;
|
||||
mParent->ChildAt(++pos, *getter_AddRefs(next));
|
||||
if (next) {
|
||||
nsresult res = next->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aNextSibling);
|
||||
NS_ASSERTION(NS_OK == res, "not a DOM Node");
|
||||
nsresult res = CallQueryInterface(next, aNextSibling);
|
||||
NS_ASSERTION(*aNextSibling, "not a DOM Node");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -943,7 +936,7 @@ nsXULElement::SetPrefix(const nsAString& aPrefix)
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty() && !DOMStringIsNull(aPrefix)) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -1362,14 +1355,12 @@ nsXULElement::GetAttributeNode(const nsAString& aName,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (node) {
|
||||
rv = node->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**) aReturn);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
rv = NS_OK;
|
||||
return CallQueryInterface(node, aReturn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
*aReturn = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -1430,7 +1421,7 @@ nsXULElement::GetAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
|
||||
PRInt32 nsid;
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
@ -1469,7 +1460,7 @@ nsXULElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName)
|
||||
{
|
||||
PRInt32 nameSpaceId;
|
||||
nsCOMPtr<nsIAtom> tag = dont_AddRef(NS_NewAtom(aLocalName));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom(aLocalName);
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
@ -1495,14 +1486,12 @@ nsXULElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (node) {
|
||||
rv = node->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**) aReturn);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
rv = NS_OK;
|
||||
return CallQueryInterface(node, aReturn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
*aReturn = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1580,7 +1569,7 @@ nsXULElement::HasAttributeNS(const nsAString& aNamespaceURI,
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
|
||||
PRInt32 nsid;
|
||||
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
@ -1761,14 +1750,12 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName,
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetListenerManager(nsIEventListenerManager** aResult)
|
||||
{
|
||||
if (! mListenerManager) {
|
||||
if (!mListenerManager) {
|
||||
nsresult rv;
|
||||
mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kEventListenerManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIEventListenerManager),
|
||||
getter_AddRefs(mListenerManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
}
|
||||
|
||||
@ -2629,9 +2616,9 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo,
|
||||
|
||||
mutation.mAttrName = attrName;
|
||||
if (!oldValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = dont_AddRef(NS_NewAtom(oldValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(oldValue);
|
||||
if (!aValue.IsEmpty())
|
||||
mutation.mNewAttrValue = dont_AddRef(NS_NewAtom(aValue));
|
||||
mutation.mNewAttrValue = do_GetAtom(aValue);
|
||||
if (modification)
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||
else
|
||||
@ -2878,7 +2865,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
|
||||
|
||||
mutation.mAttrName = aName;
|
||||
if (!oldValue.IsEmpty())
|
||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue));
|
||||
mutation.mPrevAttrValue = do_GetAtom(oldValue);
|
||||
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(nsnull, &mutation, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
@ -3421,10 +3408,10 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
// still has a ref to the DOM Event but the internal data
|
||||
// hasn't been malloc'd. Force a copy of the data here so the
|
||||
// DOM Event is still valid.
|
||||
nsIPrivateDOMEvent *privateEvent;
|
||||
if (NS_OK == (*aDOMEvent)->QueryInterface(NS_GET_IID(nsIPrivateDOMEvent), (void**)&privateEvent)) {
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
|
||||
do_QueryInterface(*aDOMEvent);
|
||||
if (privateEvent) {
|
||||
privateEvent->DuplicatePrivateData();
|
||||
NS_RELEASE(privateEvent);
|
||||
}
|
||||
}
|
||||
aDOMEvent = nsnull;
|
||||
@ -4551,11 +4538,8 @@ nsXULElement::AddPopupListener(nsIAtom* aName)
|
||||
// Add a popup listener to the element
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIXULPopupListener> popupListener;
|
||||
rv = nsComponentManager::CreateInstance(kXULPopupListenerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIXULPopupListener),
|
||||
getter_AddRefs(popupListener));
|
||||
nsCOMPtr<nsIXULPopupListener> popupListener =
|
||||
do_CreateInstance(kXULPopupListenerCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to create an instance of the popup listener object.");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -158,7 +158,7 @@ nsXULCommandDispatcher::GetFocusedWindow(nsIDOMWindow** aWindow)
|
||||
nsresult rv = mFocusController->GetFocusedWindow(getter_AddRefs(window));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && window, rv);
|
||||
|
||||
return window->QueryInterface(NS_GET_IID(nsIDOMWindow), (void **)aWindow);
|
||||
return CallQueryInterface(window, aWindow);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -553,10 +553,9 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
|
||||
if (mPreferredStyle.IsEmpty()) {
|
||||
mPreferredStyle = aTitle;
|
||||
mCSSLoader->SetPreferredSheet(aTitle);
|
||||
nsIAtom* defaultStyle = NS_NewAtom("default-style");
|
||||
nsCOMPtr<nsIAtom> defaultStyle = do_GetAtom("default-style");
|
||||
if (defaultStyle) {
|
||||
mPrototype->SetHeaderData(defaultStyle, aTitle);
|
||||
NS_RELEASE(defaultStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -614,7 +613,7 @@ XULContentSinkImpl::Init(nsIDocument* aDocument, nsIXULPrototypeDocument* aProto
|
||||
|
||||
// XXX this presumes HTTP header info is already set in document
|
||||
// XXX if it isn't we need to set it here...
|
||||
nsCOMPtr<nsIAtom> defaultStyle = dont_AddRef( NS_NewAtom("default-style") );
|
||||
nsCOMPtr<nsIAtom> defaultStyle = do_GetAtom("default-style");
|
||||
if (! defaultStyle)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -725,7 +724,7 @@ XULContentSinkImpl::NormalizeAttributeString(const nsAFlatString& aText,
|
||||
if (!FindCharInReadable(kNameSpaceSeparator, colon, end)) {
|
||||
colon = start; // No ':' found, reset colon
|
||||
} else if (start != colon) {
|
||||
prefix = dont_AddRef(NS_NewAtom(Substring(start, colon)));
|
||||
prefix = do_GetAtom(Substring(start, colon));
|
||||
|
||||
nsCOMPtr<nsINameSpace> ns;
|
||||
GetTopNameSpace(address_of(ns));
|
||||
@ -1166,8 +1165,7 @@ XULContentSinkImpl::PushNameSpacesFrom(const PRUnichar** aAttributes)
|
||||
start.advance(xmlns_len);
|
||||
|
||||
if (*start == ':' && ++start != end) {
|
||||
prefixAtom =
|
||||
dont_AddRef(NS_NewAtom(Substring(start, end)));
|
||||
prefixAtom = do_GetAtom(Substring(start, end));
|
||||
} else {
|
||||
NS_WARNING("Bad XML namespace declaration 'xmlns:' "
|
||||
"found!");
|
||||
@ -1240,7 +1238,7 @@ XULContentSinkImpl::ParseTag(const PRUnichar* aText,
|
||||
if (!FindCharInReadable(kNameSpaceSeparator, colon, end)) {
|
||||
colon = start; // No ':' found, reset colon
|
||||
} else if (colon != start) {
|
||||
prefix = dont_AddRef(NS_NewAtom(Substring(start, colon)));
|
||||
prefix = do_GetAtom(Substring(start, colon));
|
||||
|
||||
++colon; // Step over ':'
|
||||
}
|
||||
@ -1539,11 +1537,8 @@ XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
if (! mCSSParser) {
|
||||
rv = nsComponentManager::CreateInstance(kCSSParserCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSParser),
|
||||
getter_AddRefs(mCSSParser));
|
||||
if (!mCSSParser) {
|
||||
mCSSParser = do_CreateInstance(kCSSParserCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
@ -499,10 +499,7 @@ nsXULDocument::~nsXULDocument()
|
||||
mListenerManager->SetListenerTarget(nsnull);
|
||||
|
||||
if (--gRefCnt == 0) {
|
||||
if (gRDFService) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gRDFService);
|
||||
|
||||
NS_IF_RELEASE(kNC_persist);
|
||||
NS_IF_RELEASE(kNC_attribute);
|
||||
@ -519,8 +516,7 @@ nsXULDocument::~nsXULDocument()
|
||||
if (mDocumentURL)
|
||||
gXULCache->RemoveFromFastLoadSet(mDocumentURL);
|
||||
|
||||
nsServiceManager::ReleaseService(kXULPrototypeCacheCID, gXULCache);
|
||||
gXULCache = nsnull;
|
||||
NS_RELEASE(gXULCache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -650,41 +646,24 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL)
|
||||
mStyleSheets.Clear();
|
||||
|
||||
// Create an HTML style sheet for the HTML content.
|
||||
nsCOMPtr<nsIHTMLStyleSheet> sheet;
|
||||
if (NS_SUCCEEDED(rv = nsComponentManager::CreateInstance(kHTMLStyleSheetCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIHTMLStyleSheet),
|
||||
getter_AddRefs(sheet)))) {
|
||||
if (NS_SUCCEEDED(rv = sheet->Init(anURL, this))) {
|
||||
mAttrStyleSheet = sheet;
|
||||
AddStyleSheet(mAttrStyleSheet, 0);
|
||||
}
|
||||
}
|
||||
|
||||
rv = NS_NewHTMLStyleSheet(getter_AddRefs(mAttrStyleSheet), anURL, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("unable to add HTML style sheet");
|
||||
return rv;
|
||||
}
|
||||
|
||||
AddStyleSheet(mAttrStyleSheet, 0);
|
||||
|
||||
// Create an inline style sheet for inline content that contains a style
|
||||
// attribute.
|
||||
nsIHTMLCSSStyleSheet* inlineSheet;
|
||||
if (NS_SUCCEEDED(rv = nsComponentManager::CreateInstance(kHTMLCSSStyleSheetCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIHTMLCSSStyleSheet),
|
||||
(void**)&inlineSheet))) {
|
||||
if (NS_SUCCEEDED(rv = inlineSheet->Init(anURL, this))) {
|
||||
mInlineStyleSheet = dont_QueryInterface(inlineSheet);
|
||||
AddStyleSheet(mInlineStyleSheet, 0);
|
||||
}
|
||||
NS_RELEASE(inlineSheet);
|
||||
}
|
||||
|
||||
rv = NS_NewHTMLCSSStyleSheet(getter_AddRefs(mInlineStyleSheet), anURL, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("unable to add inline style sheet");
|
||||
return rv;
|
||||
}
|
||||
|
||||
AddStyleSheet(mInlineStyleSheet, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -959,25 +938,19 @@ nsXULDocument::RemoveCharSetObserver(nsIObserver* aObserver)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetLineBreaker(nsILineBreaker** aResult)
|
||||
{
|
||||
if(! mLineBreaker) {
|
||||
// no line breaker, find a default one
|
||||
nsILineBreakerFactory *lf;
|
||||
nsresult result;
|
||||
result = nsServiceManager::GetService(kLWBrkCID,
|
||||
NS_GET_IID(nsILineBreakerFactory),
|
||||
(nsISupports **)&lf);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsILineBreaker *lb = nsnull ;
|
||||
if (!mLineBreaker) {
|
||||
// no line breaker, find a default one
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILineBreakerFactory> lf = do_GetService(kLWBrkCID, &rv);
|
||||
if (lf) {
|
||||
nsAutoString lbarg;
|
||||
result = lf->GetBreaker(lbarg, &lb);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
mLineBreaker = dont_AddRef(lb);
|
||||
}
|
||||
result = nsServiceManager::ReleaseService(kLWBrkCID, lf);
|
||||
}
|
||||
lf->GetBreaker(lbarg, getter_AddRefs(mLineBreaker));
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = mLineBreaker;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK; // XXX we should do error handling here
|
||||
}
|
||||
|
||||
@ -990,25 +963,19 @@ nsXULDocument::SetLineBreaker(nsILineBreaker* aLineBreaker)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetWordBreaker(nsIWordBreaker** aResult)
|
||||
{
|
||||
if (! mWordBreaker) {
|
||||
// no line breaker, find a default one
|
||||
nsIWordBreakerFactory *lf;
|
||||
nsresult result;
|
||||
result = nsServiceManager::GetService(kLWBrkCID,
|
||||
NS_GET_IID(nsIWordBreakerFactory),
|
||||
(nsISupports **)&lf);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsIWordBreaker *lb = nsnull ;
|
||||
if (!mWordBreaker) {
|
||||
// no line breaker, find a default one
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWordBreakerFactory> lf = do_GetService(kLWBrkCID, &rv);
|
||||
if (lf) {
|
||||
nsAutoString lbarg;
|
||||
result = lf->GetBreaker(lbarg, &lb);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
mWordBreaker = dont_AddRef(lb);
|
||||
}
|
||||
result = nsServiceManager::ReleaseService(kLWBrkCID, lf);
|
||||
}
|
||||
rv = lf->GetBreaker(lbarg, getter_AddRefs(mWordBreaker));
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = mWordBreaker;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK; // XXX we should do error handling here
|
||||
}
|
||||
|
||||
@ -1363,7 +1330,7 @@ nsXULDocument::AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags)
|
||||
if (!aSheet)
|
||||
return;
|
||||
|
||||
if (aSheet == mAttrStyleSheet.get()) { // always first
|
||||
if (aSheet == mAttrStyleSheet) { // always first
|
||||
mStyleSheets.InsertElementAt(aSheet, 0);
|
||||
}
|
||||
else if (aSheet == (nsIHTMLCSSStyleSheet*)mInlineStyleSheet) { // always last
|
||||
@ -1562,11 +1529,8 @@ NS_IMETHODIMP
|
||||
nsXULDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (! mCSSLoader) {
|
||||
result = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSLoader),
|
||||
getter_AddRefs(mCSSLoader));
|
||||
if (!mCSSLoader) {
|
||||
mCSSLoader = do_CreateInstance(kCSSLoaderCID, &result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = mCSSLoader->Init(this);
|
||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||
@ -1883,7 +1847,7 @@ nsXULDocument::SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
||||
}
|
||||
else {
|
||||
// Find out if the attribute is even present at all.
|
||||
nsCOMPtr<nsIAtom> name = dont_AddRef(NS_NewAtom(aAttr));
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aAttr);
|
||||
|
||||
nsAutoString value;
|
||||
nsresult rv = broadcaster->GetAttr(kNameSpaceID_None, name, value);
|
||||
@ -1966,7 +1930,7 @@ nsXULDocument::AddBroadcastListenerFor(nsIDOMElement* aBroadcaster,
|
||||
}
|
||||
|
||||
// Only add the listener if it's not there already!
|
||||
nsCOMPtr<nsIAtom> attr = dont_AddRef(NS_NewAtom(aAttr));
|
||||
nsCOMPtr<nsIAtom> attr = do_GetAtom(aAttr);
|
||||
|
||||
BroadcastListener* bl;
|
||||
for (PRInt32 i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
@ -2005,7 +1969,7 @@ nsXULDocument::RemoveBroadcastListenerFor(nsIDOMElement* aBroadcaster,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
nsCOMPtr<nsIAtom> attr = dont_AddRef(NS_NewAtom(aAttr));
|
||||
nsCOMPtr<nsIAtom> attr = do_GetAtom(aAttr);
|
||||
for (PRInt32 i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
BroadcastListener* bl =
|
||||
NS_STATIC_CAST(BroadcastListener*, entry->mListeners[i]);
|
||||
@ -2610,12 +2574,12 @@ nsXULDocument::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsrefcnt rc;
|
||||
NS_RELEASE2(*aDOMEvent, rc);
|
||||
if (0 != rc) {
|
||||
//Okay, so someone in the DOM loop (a listener, JS object) still has a ref to the DOM Event but
|
||||
//the internal data hasn't been malloc'd. Force a copy of the data here so the DOM Event is still valid.
|
||||
nsIPrivateDOMEvent *privateEvent;
|
||||
if (NS_OK == (*aDOMEvent)->QueryInterface(NS_GET_IID(nsIPrivateDOMEvent), (void**)&privateEvent)) {
|
||||
// Okay, so someone in the DOM loop (a listener, JS object) still has
|
||||
// a ref to the DOM Event but the internal data hasn't been malloc'd.
|
||||
// Force a copy of the data here so the DOM Event is still valid.
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (privateEvent) {
|
||||
privateEvent->DuplicatePrivateData();
|
||||
NS_RELEASE(privateEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2817,10 +2781,7 @@ NS_IMETHODIMP
|
||||
nsXULDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kDOMImplementationCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDOMDOMImplementation),
|
||||
(void**) aImplementation);
|
||||
rv = CallCreateInstance(kDOMImplementationCID, aImplementation);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMImplementation> impl = do_QueryInterface(*aImplementation, &rv);
|
||||
@ -2833,17 +2794,15 @@ nsXULDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetDocumentElement(nsIDOMElement** aDocumentElement)
|
||||
{
|
||||
NS_PRECONDITION(aDocumentElement != nsnull, "null ptr");
|
||||
if (! aDocumentElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aDocumentElement);
|
||||
|
||||
if (mRootContent) {
|
||||
return mRootContent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aDocumentElement);
|
||||
}
|
||||
else {
|
||||
*aDocumentElement = nsnull;
|
||||
return NS_OK;
|
||||
return CallQueryInterface(mRootContent, aDocumentElement);
|
||||
}
|
||||
|
||||
*aDocumentElement = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -2860,7 +2819,7 @@ nsXULDocument::CreateElement(const nsAString& aTagName,
|
||||
|
||||
nsCOMPtr<nsIAtom> name, prefix;
|
||||
|
||||
name = dont_AddRef(NS_NewAtom(aTagName));
|
||||
name = do_GetAtom(aTagName);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
@ -2887,7 +2846,7 @@ nsXULDocument::CreateElement(const nsAString& aTagName,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get the DOM interface
|
||||
rv = result->QueryInterface(NS_GET_IID(nsIDOMElement), (void**) aReturn);
|
||||
rv = CallQueryInterface(result, aReturn);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM element");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -2913,14 +2872,13 @@ nsXULDocument::CreateTextNode(const nsAString& aData,
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsITextContent> text;
|
||||
rv = nsComponentManager::CreateInstance(kTextNodeCID, nsnull, NS_GET_IID(nsITextContent), getter_AddRefs(text));
|
||||
nsCOMPtr<nsITextContent> text = do_CreateInstance(kTextNodeCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = text->SetText(aData, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**) aReturn);
|
||||
rv = CallQueryInterface(text, aReturn);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOMText");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -2936,8 +2894,7 @@ nsXULDocument::CreateComment(const nsAString& aData,
|
||||
nsresult rv = NS_NewCommentNode(getter_AddRefs(comment));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = comment->QueryInterface(NS_GET_IID(nsIDOMComment),
|
||||
(void**)aReturn);
|
||||
rv = CallQueryInterface(comment, aReturn);
|
||||
(*aReturn)->AppendData(aData);
|
||||
}
|
||||
|
||||
@ -3030,21 +2987,19 @@ nsXULDocument::GetElementsByAttribute(const nsAString& aAttribute,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIContent* root = nsnull;
|
||||
GetRootContent(&root);
|
||||
NS_ASSERTION(root != nsnull, "no doc root");
|
||||
nsCOMPtr<nsIContent> root;
|
||||
GetRootContent(getter_AddRefs(root));
|
||||
|
||||
if (root != nsnull) {
|
||||
nsIDOMNode* domRoot;
|
||||
if (NS_SUCCEEDED(rv = root->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) &domRoot))) {
|
||||
rv = GetElementsByAttribute(domRoot, aAttribute, aValue, elements);
|
||||
NS_RELEASE(domRoot);
|
||||
}
|
||||
NS_RELEASE(root);
|
||||
nsCOMPtr<nsIDOMNode> domRoot = do_QueryInterface(root);
|
||||
NS_ASSERTION(domRoot, "no doc root");
|
||||
|
||||
if (domRoot) {
|
||||
rv = GetElementsByAttribute(domRoot, aAttribute, aValue, elements);
|
||||
}
|
||||
|
||||
*aReturn = elements;
|
||||
return NS_OK;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -3207,9 +3162,7 @@ nsXULDocument::GetCharacterSet(nsAString& aCharacterSet)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::CreateRange(nsIDOMRange** aRange)
|
||||
{
|
||||
return nsComponentManager::CreateInstance(kRangeCID, nsnull,
|
||||
NS_GET_IID(nsIDOMRange),
|
||||
(void **)aRange);
|
||||
return CallCreateInstance(kRangeCID, aRange);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3260,17 +3213,10 @@ nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
||||
rv = ctx->GetContainer(getter_AddRefs(container));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && container, rv);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> ifrq(do_QueryInterface(container));
|
||||
NS_ENSURE_TRUE(ifrq, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> window;
|
||||
ifrq->GetInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(window));
|
||||
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(container);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
window->QueryInterface(NS_GET_IID(nsIDOMAbstractView),
|
||||
(void **)aDefaultView);
|
||||
|
||||
return NS_OK;
|
||||
return CallQueryInterface(window, aDefaultView);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -3300,8 +3246,7 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
if (view) {
|
||||
nsIScrollableView* scrollableView;
|
||||
|
||||
if (NS_SUCCEEDED(view->QueryInterface(NS_GET_IID(nsIScrollableView),
|
||||
(void**)&scrollableView))) {
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollableView))) {
|
||||
scrollableView->GetScrolledView(view);
|
||||
}
|
||||
|
||||
@ -3456,7 +3401,7 @@ GetElementByAttribute(nsIContent* aContent,
|
||||
nsresult rv = aContent->GetAttr(kNameSpaceID_None, aAttrName, value);
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
if (aUniversalMatch || value.Equals(aAttrValue))
|
||||
return aContent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aResult);
|
||||
return CallQueryInterface(aContent, aResult);
|
||||
}
|
||||
|
||||
|
||||
@ -3491,7 +3436,7 @@ nsXULDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement,
|
||||
if (!nodeList)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAtom> attribute = getter_AddRefs(NS_NewAtom(aAttrName));
|
||||
nsCOMPtr<nsIAtom> attribute = do_GetAtom(aAttrName);
|
||||
|
||||
PRUint32 length;
|
||||
nodeList->GetLength(&length);
|
||||
@ -3718,7 +3663,7 @@ nsXULDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get the DOM interface
|
||||
rv = result->QueryInterface(NS_GET_IID(nsIDOMElement), (void**) aReturn);
|
||||
rv = CallQueryInterface(result, aReturn);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM element");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -3752,10 +3697,7 @@ nsXULDocument::GetElementById(const nsAString& aId,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (element) {
|
||||
rv = element->QueryInterface(NS_GET_IID(nsIDOMElement), (void**) aReturn);
|
||||
}
|
||||
else {
|
||||
rv = NS_OK;
|
||||
rv = CallQueryInterface(element, aReturn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -4119,13 +4061,11 @@ nsXULDocument::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
rv = nsRDFDOMNodeList::Create(&children);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* domNode = nsnull;
|
||||
rv = mRootContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&domNode);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "root content is not a DOM node");
|
||||
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(mRootContent);
|
||||
NS_ASSERTION(domNode, "root content is not a DOM node");
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (domNode) {
|
||||
rv = children->AppendNode(domNode);
|
||||
NS_RELEASE(domNode);
|
||||
|
||||
*aChildNodes = children;
|
||||
return NS_OK;
|
||||
@ -4136,10 +4076,10 @@ nsXULDocument::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
NS_RELEASE(children);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
*aChildNodes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aChildNodes = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -4174,34 +4114,30 @@ nsXULDocument::HasAttributes(PRBool* aHasAttributes)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
{
|
||||
NS_PRECONDITION(aFirstChild != nsnull, "null ptr");
|
||||
if (! aFirstChild)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aFirstChild);
|
||||
|
||||
if (mRootContent) {
|
||||
return mRootContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aFirstChild);
|
||||
}
|
||||
else {
|
||||
*aFirstChild = nsnull;
|
||||
return NS_OK;
|
||||
return CallQueryInterface(mRootContent, aFirstChild);
|
||||
}
|
||||
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetLastChild(nsIDOMNode** aLastChild)
|
||||
{
|
||||
NS_PRECONDITION(aLastChild != nsnull, "null ptr");
|
||||
if (! aLastChild)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aLastChild);
|
||||
|
||||
if (mRootContent) {
|
||||
return mRootContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aLastChild);
|
||||
}
|
||||
else {
|
||||
*aLastChild = nsnull;
|
||||
return NS_OK;
|
||||
return CallQueryInterface(mRootContent, aLastChild);
|
||||
}
|
||||
|
||||
*aLastChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -4404,17 +4340,15 @@ nsXULDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix,
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mAttrStyleSheet;
|
||||
if (! mAttrStyleSheet) {
|
||||
if (!mAttrStyleSheet) {
|
||||
return NS_ERROR_NOT_AVAILABLE; // probably not the right error...
|
||||
}
|
||||
else {
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -4448,11 +4382,7 @@ nsXULDocument::Init()
|
||||
rv = NS_NewHeapArena(getter_AddRefs(mArena), nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(NS_NODEINFOMANAGER_CONTRACTID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINodeInfoManager),
|
||||
getter_AddRefs(mNodeInfoManager));
|
||||
|
||||
mNodeInfoManager = do_CreateInstance(NS_NODEINFOMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mNodeInfoManager->Init(this);
|
||||
@ -4462,21 +4392,10 @@ nsXULDocument::Init()
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a focus tracker");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Get the local store. Yeah, I know. I wish GetService() used a
|
||||
// 'void**', too.
|
||||
nsIRDFDataSource* localstore;
|
||||
rv = nsServiceManager::GetService(kLocalStoreCID,
|
||||
NS_GET_IID(nsIRDFDataSource),
|
||||
(nsISupports**) &localstore);
|
||||
|
||||
// this _could_ fail; e.g., if we've tried to grab the local store
|
||||
// before profiles have initialized. If so, no big deal; nothing
|
||||
// will persist.
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLocalStore = localstore;
|
||||
NS_IF_RELEASE(localstore);
|
||||
}
|
||||
mLocalStore = do_GetService(kLocalStoreCID);
|
||||
|
||||
// Create a new nsISupportsArray for dealing with overlay references
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mUnloadedOverlays));
|
||||
@ -4489,23 +4408,10 @@ nsXULDocument::Init()
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mPrototypes));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#if 0
|
||||
// construct a selection object
|
||||
if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRangeListCID,
|
||||
nsnull,
|
||||
kIDOMSelectionIID,
|
||||
(void**) &mSelection))) {
|
||||
NS_ERROR("unable to create DOM selection");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gRefCnt++ == 0) {
|
||||
// Keep the RDF service cached in a member variable to make using
|
||||
// it a bit less painful
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
||||
rv = CallGetService(kRDFServiceCID, &gRDFService);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF Service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -4513,24 +4419,15 @@ nsXULDocument::Init()
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "attribute", &kNC_attribute);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "value", &kNC_value);
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kHTMLElementFactoryCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIElementFactory),
|
||||
(void**) &gHTMLElementFactory);
|
||||
|
||||
rv = CallCreateInstance(kHTMLElementFactoryCID, &gHTMLElementFactory);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get HTML element factory");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kXMLElementFactoryCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIElementFactory),
|
||||
(void**) &gXMLElementFactory);
|
||||
rv = CallCreateInstance(kXMLElementFactoryCID, &gXMLElementFactory);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get XML element factory");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kXULPrototypeCacheCID,
|
||||
NS_GET_IID(nsIXULPrototypeCache),
|
||||
(nsISupports**) &gXULCache);
|
||||
rv = CallGetService(kXULPrototypeCacheCID, &gXULCache);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
@ -4910,13 +4807,9 @@ nsXULDocument::CreateEventGroup(nsIDOMEventGroup **_retval)
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetListenerManager(nsIEventListenerManager** aResult)
|
||||
{
|
||||
if (! mListenerManager) {
|
||||
if (!mListenerManager) {
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kEventListenerManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIEventListenerManager),
|
||||
getter_AddRefs(mListenerManager));
|
||||
|
||||
mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument*,this));
|
||||
@ -5023,11 +4916,8 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand,
|
||||
|
||||
// Create a XUL content sink, a parser, and kick off a load for
|
||||
// the overlay.
|
||||
nsCOMPtr<nsIXULContentSink> sink;
|
||||
rv = nsComponentManager::CreateInstance(kXULContentSinkCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIXULContentSink),
|
||||
getter_AddRefs(sink));
|
||||
nsCOMPtr<nsIXULContentSink> sink = do_CreateInstance(kXULContentSinkCID,
|
||||
&rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create XUL content sink");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -5035,11 +4925,7 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand,
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to initialize datasource sink");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
rv = nsComponentManager::CreateInstance(kParserCID,
|
||||
nsnull,
|
||||
kIParserIID,
|
||||
getter_AddRefs(parser));
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create parser");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -5151,7 +5037,7 @@ nsXULDocument::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, ns
|
||||
rv = property->GetValueConst(&attrname);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> attr = dont_AddRef(NS_NewAtom(attrname));
|
||||
nsCOMPtr<nsIAtom> attr = do_GetAtom(attrname);
|
||||
if (! attr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -5595,11 +5481,8 @@ nsXULDocument::ResumeWalk()
|
||||
// and attach them to the parent node.
|
||||
NS_ASSERTION(element != nsnull, "no element on context stack");
|
||||
|
||||
nsCOMPtr<nsITextContent> text;
|
||||
rv = nsComponentManager::CreateInstance(kTextNodeCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsITextContent),
|
||||
getter_AddRefs(text));
|
||||
nsCOMPtr<nsITextContent> text =
|
||||
do_CreateInstance(kTextNodeCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXULPrototypeText* textproto =
|
||||
NS_REINTERPRET_CAST(nsXULPrototypeText*, childproto);
|
||||
|
@ -144,12 +144,9 @@ value_to_isupports(const nsIID& aIID, const Value& aValue)
|
||||
// Need to const_cast aValue because QI() & Release() are not const
|
||||
nsISupports* isupports = NS_STATIC_CAST(nsISupports*, NS_CONST_CAST(Value&, aValue));
|
||||
if (isupports) {
|
||||
nsISupports* dummy;
|
||||
rv = isupports->QueryInterface(aIID, (void**) &dummy);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_RELEASE(dummy);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsISupports> dummy;
|
||||
rv = isupports->QueryInterface(aIID, getter_AddRefs(dummy));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("value does not support expected interface");
|
||||
}
|
||||
}
|
||||
|
@ -339,11 +339,7 @@ nsXULContentBuilder::nsXULContentBuilder()
|
||||
nsXULContentBuilder::~nsXULContentBuilder()
|
||||
{
|
||||
if (--gRefCnt == 0) {
|
||||
if (gXULSortService) {
|
||||
nsServiceManager::ReleaseService(kXULSortServiceCID, gXULSortService);
|
||||
gXULSortService = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gXULSortService);
|
||||
NS_IF_RELEASE(gHTMLElementFactory);
|
||||
NS_IF_RELEASE(gXMLElementFactory);
|
||||
}
|
||||
@ -353,24 +349,17 @@ nsresult
|
||||
nsXULContentBuilder::Init()
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
nsresult rv = CallGetService(kXULSortServiceCID, &gXULSortService);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kXULSortServiceCID,
|
||||
NS_GET_IID(nsIXULSortService),
|
||||
(nsISupports**) &gXULSortService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallGetService(kHTMLElementFactoryCID, &gHTMLElementFactory);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kHTMLElementFactoryCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIElementFactory),
|
||||
(void**) &gHTMLElementFactory);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kXMLElementFactoryCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIElementFactory),
|
||||
(void**) &gXMLElementFactory);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallGetService(kXMLElementFactoryCID, &gXMLElementFactory);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return nsXULTemplateBuilder::Init();
|
||||
@ -709,11 +698,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
||||
rv = SubstituteText(*aMatch, attrValue, value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsITextContent> content;
|
||||
rv = nsComponentManager::CreateInstance(kTextNodeCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsITextContent),
|
||||
getter_AddRefs(content));
|
||||
nsCOMPtr<nsITextContent> content =
|
||||
do_CreateInstance(kTextNodeCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = content->SetText(value.get(), value.Length(), PR_FALSE);
|
||||
@ -2160,7 +2146,7 @@ nsXULContentBuilder::CompileContentCondition(nsTemplateRule* aRule,
|
||||
aCondition->GetAttr(kNameSpaceID_None, nsXULAtoms::tag, tagstr);
|
||||
|
||||
if (!tagstr.IsEmpty()) {
|
||||
tag = dont_AddRef(NS_NewAtom(tagstr));
|
||||
tag = do_GetAtom(tagstr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
@ -2206,7 +2192,7 @@ nsXULContentBuilder::CompileSimpleAttributeCondition(PRInt32 aNameSpaceID,
|
||||
// the previous node, because it'll cause an unconstrained
|
||||
// search if we ever came "up" through this path. Need a
|
||||
// JoinNode in here somewhere.
|
||||
nsCOMPtr<nsIAtom> tag = dont_AddRef(NS_NewAtom(aValue));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom(aValue);
|
||||
|
||||
*aResult = new nsContentTagTestNode(aParentNode, mConflictSet, mContentVar, tag);
|
||||
if (*aResult)
|
||||
|
@ -95,11 +95,10 @@ nsresult
|
||||
nsXULContentUtils::Init()
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDF);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = CallGetService(kRDFServiceCID, &gRDF);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define XUL_RESOURCE(ident, uri) \
|
||||
PR_BEGIN_MACRO \
|
||||
@ -117,14 +116,13 @@ nsXULContentUtils::Init()
|
||||
#undef XUL_RESOURCE
|
||||
#undef XUL_LITERAL
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
(void**) &gFormat);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallCreateInstance(kDateTimeFormatCID, &gFormat);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX HUH?
|
||||
return gRefCnt;
|
||||
}
|
||||
|
||||
@ -133,10 +131,7 @@ nsresult
|
||||
nsXULContentUtils::Finish()
|
||||
{
|
||||
if (--gRefCnt == 0) {
|
||||
if (gRDF) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDF);
|
||||
gRDF = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gRDF);
|
||||
|
||||
#define XUL_RESOURCE(ident, uri) NS_IF_RELEASE(ident)
|
||||
#define XUL_LITERAL(ident, val) NS_IF_RELEASE(ident)
|
||||
|
@ -227,15 +227,11 @@ XULSortServiceImpl::XULSortServiceImpl(void)
|
||||
kAscendingStr = new nsString(NS_LITERAL_STRING("ascending"));
|
||||
kDescendingStr = new nsString(NS_LITERAL_STRING("descending"));
|
||||
|
||||
nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDFService);
|
||||
nsresult rv = CallGetService(kRDFServiceCID, &gRDFService);
|
||||
if (NS_FAILED(rv))
|
||||
NS_ERROR("couldn't create rdf service");
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFContainerUtilsCID,
|
||||
NS_GET_IID(nsIRDFContainerUtils),
|
||||
(nsISupports**) &gRDFC);
|
||||
rv = CallGetService(kRDFContainerUtilsCID, &gRDFC);
|
||||
if (NS_FAILED(rv))
|
||||
NS_ERROR("couldn't create rdf container utils");
|
||||
|
||||
@ -286,12 +282,8 @@ XULSortServiceImpl::~XULSortServiceImpl(void) {
|
||||
|
||||
NS_IF_RELEASE(gCollation);
|
||||
|
||||
if (gRDFService) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
if (gRDFC)
|
||||
nsServiceManager::ReleaseService(kRDFContainerUtilsCID, gRDFC);
|
||||
NS_IF_RELEASE(gRDFService);
|
||||
NS_IF_RELEASE(gRDFC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,22 +163,10 @@ nsXULTemplateBuilder::nsXULTemplateBuilder(void)
|
||||
nsXULTemplateBuilder::~nsXULTemplateBuilder(void)
|
||||
{
|
||||
if (--gRefCnt == 0) {
|
||||
if (gRDFService) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
|
||||
if (gRDFContainerUtils) {
|
||||
nsServiceManager::ReleaseService(kRDFContainerUtilsCID, gRDFContainerUtils);
|
||||
gRDFContainerUtils = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gRDFService);
|
||||
NS_IF_RELEASE(gRDFContainerUtils);
|
||||
NS_IF_RELEASE(gSystemPrincipal);
|
||||
|
||||
if (gScriptSecurityManager) {
|
||||
nsServiceManager::ReleaseService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, gScriptSecurityManager);
|
||||
gScriptSecurityManager = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gScriptSecurityManager);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,23 +179,22 @@ nsXULTemplateBuilder::Init()
|
||||
|
||||
// Initialize the global shared reference to the service
|
||||
// manager and get some shared resource objects.
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallGetService(kRDFServiceCID, &gRDFService);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFContainerUtilsCID,
|
||||
NS_GET_IID(nsIRDFContainerUtils),
|
||||
(nsISupports**) &gRDFContainerUtils);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
||||
NS_GET_IID(nsIScriptSecurityManager),
|
||||
(nsISupports**) &gScriptSecurityManager);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
||||
&gScriptSecurityManager);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = gScriptSecurityManager->GetSystemPrincipal(&gSystemPrincipal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -1543,7 +1543,7 @@ nsXULTreeBuilder::TokenizeProperties(const nsAString& aString,
|
||||
if (iter == first)
|
||||
break;
|
||||
|
||||
nsCOMPtr<nsIAtom> atom = dont_AddRef(NS_NewAtom(Substring(first, iter)));
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(Substring(first, iter));
|
||||
aProperties->AppendElement(atom);
|
||||
} while (iter != end);
|
||||
|
||||
|
@ -1785,7 +1785,7 @@ DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent,
|
||||
|
||||
// do a breadth search across all siblings
|
||||
PRInt32 inx;
|
||||
for (inx=0;inx<numChildren;inx++) {
|
||||
for (inx = 0; inx < numChildren; ++inx) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
if (NS_SUCCEEDED(aParentContent->ChildAt(inx, *getter_AddRefs(child))) && child) {
|
||||
nsCOMPtr<nsISupports> temp;
|
||||
@ -1869,7 +1869,7 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
nsISupports* data = (nsISupports*)clientData;
|
||||
|
||||
if (data) {
|
||||
data->QueryInterface(NS_GET_IID(nsIView), (void **)&containerView);
|
||||
CallQueryInterface(data, &containerView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,8 @@ NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult)
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(NS_GET_IID(nsIDocumentLoaderFactory), (void**)aResult);
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsContentDLF::nsContentDLF()
|
||||
@ -415,9 +416,7 @@ nsContentDLF::CreateDocument(const char* aCommand,
|
||||
nsCOMPtr<nsIDocumentViewer> docv;
|
||||
do {
|
||||
// Create the document
|
||||
rv = nsComponentManager::CreateInstance(aDocumentCID, nsnull,
|
||||
NS_GET_IID(nsIDocument),
|
||||
getter_AddRefs(doc));
|
||||
doc = do_CreateInstance(aDocumentCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
@ -482,9 +481,7 @@ nsContentDLF::CreateRDFDocument(nsISupports* aExtraInfo,
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// Create the XUL document
|
||||
rv = nsComponentManager::CreateInstance(kXULDocumentCID, nsnull,
|
||||
NS_GET_IID(nsIDocument),
|
||||
getter_AddRefs(*doc));
|
||||
*doc = do_CreateInstance(kXULDocumentCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Create the image content viewer...
|
||||
|
@ -101,11 +101,12 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
//nodtifications
|
||||
// notifications
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsISelectionController.h"//for the enums
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
#define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;}
|
||||
|
||||
@ -532,12 +533,6 @@ private:
|
||||
PRPackedBool mMouseDoubleDownState; //has the doubleclick down happened
|
||||
PRPackedBool mDesiredXSet;
|
||||
short mReason; //reason for notifications of selection changing
|
||||
public:
|
||||
static nsIAtom *sTableAtom;
|
||||
static nsIAtom *sRowAtom;
|
||||
static nsIAtom *sCellAtom;
|
||||
static nsIAtom *sTbodyAtom;
|
||||
static PRInt32 sInstanceCount;
|
||||
};
|
||||
|
||||
class nsSelectionIterator : public nsIBidirectionalEnumerator
|
||||
@ -715,13 +710,6 @@ nsresult NS_NewDomSelection(nsISelection **aDomSelection)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//Horrible statics but no choice
|
||||
nsIAtom *nsSelection::sTableAtom = 0;
|
||||
nsIAtom *nsSelection::sRowAtom = 0;
|
||||
nsIAtom *nsSelection::sCellAtom = 0;
|
||||
nsIAtom *nsSelection::sTbodyAtom = 0;
|
||||
PRInt32 nsSelection::sInstanceCount = 0;
|
||||
|
||||
static PRInt8
|
||||
GetIndexFromSelectionType(SelectionType aType)
|
||||
{
|
||||
@ -978,15 +966,7 @@ nsSelection::nsSelection()
|
||||
|
||||
mMouseDoubleDownState = PR_FALSE;
|
||||
|
||||
if (sInstanceCount <= 0)
|
||||
{
|
||||
sTableAtom = NS_NewAtom("table");
|
||||
sRowAtom = NS_NewAtom("tr");
|
||||
sCellAtom = NS_NewAtom("td");
|
||||
sTbodyAtom = NS_NewAtom("tbody");
|
||||
}
|
||||
mHint = HINTLEFT;
|
||||
sInstanceCount ++;
|
||||
mDragSelectingCells = PR_FALSE;
|
||||
mSelectingTableCellMode = 0;
|
||||
mSelectedCellIndex = 0;
|
||||
@ -1024,19 +1004,11 @@ nsSelection::nsSelection()
|
||||
|
||||
nsSelection::~nsSelection()
|
||||
{
|
||||
if (sInstanceCount <= 1)
|
||||
{
|
||||
NS_IF_RELEASE(sTableAtom);
|
||||
NS_IF_RELEASE(sRowAtom);
|
||||
NS_IF_RELEASE(sCellAtom);
|
||||
NS_IF_RELEASE(sTbodyAtom);
|
||||
}
|
||||
PRInt32 i;
|
||||
for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){
|
||||
if (mDomSelections[i])
|
||||
NS_IF_RELEASE(mDomSelections[i]);
|
||||
}
|
||||
sInstanceCount--;
|
||||
}
|
||||
|
||||
|
||||
@ -1445,8 +1417,7 @@ ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset)
|
||||
if (!aNode || !aParent || !aChildOffset)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
result = aNode->QueryInterface(NS_GET_IID(nsIContent),getter_AddRefs(content));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode, &result);
|
||||
if (NS_SUCCEEDED(result) && content)
|
||||
{
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
@ -1454,8 +1425,9 @@ ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset)
|
||||
if (NS_SUCCEEDED(result) && parent)
|
||||
{
|
||||
result = parent->IndexOf(content, *aChildOffset);
|
||||
if (NS_SUCCEEDED(result))
|
||||
result = parent->QueryInterface(NS_GET_IID(nsIDOMNode),(void **)aParent);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = CallQueryInterface(parent, aParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -1474,7 +1446,7 @@ GetCellParent(nsIDOMNode *aDomNode)
|
||||
while(current)
|
||||
{
|
||||
tag = GetTag(current);
|
||||
if (tag == nsSelection::sCellAtom)
|
||||
if (tag == nsHTMLAtoms::td)
|
||||
return current;
|
||||
if (NS_FAILED(ParentOffset(current,getter_AddRefs(parent),&childOffset)) || !parent)
|
||||
return 0;
|
||||
@ -1892,11 +1864,12 @@ nsresult FindLineContaining(nsIFrame* aFrame, nsIFrame** aBlock, PRInt32* aLine)
|
||||
{
|
||||
thisBlock = blockFrame;
|
||||
result = blockFrame->GetParent(&blockFrame);
|
||||
if (NS_SUCCEEDED(result) && blockFrame){
|
||||
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
|
||||
if (NS_SUCCEEDED(result) && blockFrame) {
|
||||
it = do_QueryInterface(blockFrame, &result);
|
||||
}
|
||||
else
|
||||
else {
|
||||
blockFrame = nsnull;
|
||||
}
|
||||
}
|
||||
if (!blockFrame || !it)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2345,11 +2318,12 @@ nsSelection::GetPrevNextBidiLevels(nsIPresContext *aPresContext,
|
||||
{
|
||||
thisBlock = blockFrame;
|
||||
result = blockFrame->GetParent(&blockFrame);
|
||||
if (NS_SUCCEEDED(result) && blockFrame){
|
||||
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
|
||||
if (NS_SUCCEEDED(result) && blockFrame) {
|
||||
it = do_QueryInterface(blockFrame, &result);
|
||||
}
|
||||
else
|
||||
else {
|
||||
blockFrame = nsnull;
|
||||
}
|
||||
}
|
||||
if (!blockFrame || !it)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -3416,19 +3390,21 @@ static PRBool IsCell(nsIContent *aContent)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
aContent->GetTag(*getter_AddRefs(tag));
|
||||
return (tag != 0 && tag.get() == nsSelection::sCellAtom);
|
||||
return (tag == nsHTMLAtoms::td);
|
||||
}
|
||||
|
||||
nsITableCellLayout*
|
||||
nsSelection::GetCellLayout(nsIContent *aCellContent)
|
||||
{
|
||||
// Get frame for cell
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
nsresult result = GetTracker()->GetPrimaryFrameFor(aCellContent, &cellFrame);
|
||||
if (!cellFrame) return nsnull;
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
GetTracker()->GetPrimaryFrameFor(aCellContent, &cellFrame);
|
||||
if (!cellFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableCellLayout *cellLayoutObject = nsnull;
|
||||
result = cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void**)(&cellLayoutObject));
|
||||
if (NS_FAILED(result)) return nsnull;
|
||||
CallQueryInterface(cellFrame, &cellLayoutObject);
|
||||
|
||||
return cellLayoutObject;
|
||||
}
|
||||
|
||||
@ -3436,12 +3412,14 @@ nsITableLayout*
|
||||
nsSelection::GetTableLayout(nsIContent *aTableContent)
|
||||
{
|
||||
// Get frame for table
|
||||
nsIFrame *tableFrame = nsnull;
|
||||
nsresult result = GetTracker()->GetPrimaryFrameFor(aTableContent, &tableFrame);
|
||||
if (!tableFrame) return nsnull;
|
||||
nsIFrame *tableFrame = nsnull;
|
||||
GetTracker()->GetPrimaryFrameFor(aTableContent, &tableFrame);
|
||||
if (!tableFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableLayout *tableLayoutObject = nsnull;
|
||||
result = tableFrame->QueryInterface(NS_GET_IID(nsITableLayout), (void**)(&tableLayoutObject));
|
||||
if (NS_FAILED(result)) return nsnull;
|
||||
CallQueryInterface(tableFrame, &tableLayoutObject);
|
||||
|
||||
return tableLayoutObject;
|
||||
}
|
||||
|
||||
@ -4180,7 +4158,7 @@ nsSelection::GetParentTable(nsIContent *aCell, nsIContent **aTable)
|
||||
{
|
||||
nsIAtom *tag;
|
||||
parent->GetTag(tag);
|
||||
if (tag && tag == nsSelection::sTableAtom)
|
||||
if (tag == nsHTMLAtoms::table)
|
||||
{
|
||||
*aTable = parent;
|
||||
NS_ADDREF(*aTable);
|
||||
@ -4381,7 +4359,7 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
if (!atom) return NS_ERROR_FAILURE;
|
||||
|
||||
if (atom.get() == nsSelection::sRowAtom)
|
||||
if (atom == nsHTMLAtoms::tr)
|
||||
{
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||
}
|
||||
@ -4395,9 +4373,9 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
||||
child->GetTag(*getter_AddRefs(atom));
|
||||
if (!atom) return NS_ERROR_FAILURE;
|
||||
|
||||
if (atom.get() == nsSelection::sTableAtom)
|
||||
if (atom == nsHTMLAtoms::table)
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
||||
else if (atom.get() == nsSelection::sRowAtom)
|
||||
else if (atom == nsHTMLAtoms::tr)
|
||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||
}
|
||||
return result;
|
||||
@ -5119,8 +5097,9 @@ nsTypedSelection::selectFrames(nsIPresContext* aPresContext,
|
||||
mFrameSelection->GetTableCellSelection(&tablesel);
|
||||
if (tablesel)
|
||||
{
|
||||
nsITableCellLayout *tcl;
|
||||
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITableCellLayout),(void **)&tcl)) && tcl)
|
||||
nsITableCellLayout *tcl = nsnull;
|
||||
CallQueryInterface(frame, &tcl);
|
||||
if (tcl)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -5181,28 +5160,25 @@ nsTypedSelection::selectFrames(nsIPresContext* aPresContext, nsIDOMRange *aRange
|
||||
return NS_OK;//nothing to do
|
||||
if (!aRange || !aPresContext)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIContentIterator> iter;
|
||||
nsCOMPtr<nsIContentIterator> inneriter;
|
||||
nsresult result = nsComponentManager::CreateInstance(
|
||||
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIContentIterator> iter = do_CreateInstance(
|
||||
#ifdef USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
kCGenSubtreeIteratorCID,
|
||||
#else
|
||||
kCSubtreeIteratorCID,
|
||||
#endif // USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
nsnull,
|
||||
NS_GET_IID(nsIContentIterator),
|
||||
getter_AddRefs(iter));
|
||||
&result);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
result = nsComponentManager::CreateInstance(
|
||||
|
||||
nsCOMPtr<nsIContentIterator> inneriter = do_CreateInstance(
|
||||
#ifdef USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
kCGenContentIteratorCID,
|
||||
#else
|
||||
kCContentIteratorCID,
|
||||
#endif // USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE
|
||||
nsnull,
|
||||
NS_GET_IID(nsIContentIterator),
|
||||
getter_AddRefs(inneriter));
|
||||
&result);
|
||||
|
||||
if ((NS_SUCCEEDED(result)) && iter && inneriter)
|
||||
{
|
||||
@ -5504,11 +5480,10 @@ nsTypedSelection::GetClosestScrollableView(nsIView *aView, nsIScrollableView **a
|
||||
|
||||
while (!*aScrollableView && aView)
|
||||
{
|
||||
nsresult result = aView->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)aScrollableView);
|
||||
|
||||
CallQueryInterface(aView, aScrollableView);
|
||||
if (!*aScrollableView)
|
||||
{
|
||||
result = aView->GetParent(aView);
|
||||
nsresult result = aView->GetParent(aView);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
@ -5759,7 +5734,7 @@ nsTypedSelection::ScrollPointIntoView(nsIPresContext *aPresContext, nsIView *aVi
|
||||
nsIView *scrolledView = 0;
|
||||
nsIView *view = 0;
|
||||
|
||||
result = scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view);
|
||||
CallQueryInterface(scrollableView, &view);
|
||||
|
||||
if (view)
|
||||
{
|
||||
@ -5819,13 +5794,11 @@ nsTypedSelection::ScrollPointIntoView(nsIPresContext *aPresContext, nsIView *aVi
|
||||
//
|
||||
|
||||
view = 0;
|
||||
result = scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
result = CallQueryInterface(scrollableView, &view);
|
||||
if (!view)
|
||||
return result;
|
||||
|
||||
if (view)
|
||||
view->GetParent(view);
|
||||
view->GetParent(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6290,7 +6263,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
// if end node is a tbody then all bets are off we cannot select "rows"
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
atom = GetTag(endNode);
|
||||
if (atom.get() == nsSelection::sTbodyAtom)
|
||||
if (atom == nsHTMLAtoms::tbody)
|
||||
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
||||
|
||||
//get common parent
|
||||
@ -6336,7 +6309,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
while (tempNode != parent)
|
||||
{
|
||||
atom = GetTag(tempNode);
|
||||
if (atom.get() == nsSelection::sTableAtom) //select whole table if in cell mode, wait for cell
|
||||
if (atom == nsHTMLAtoms::table) //select whole table if in cell mode, wait for cell
|
||||
{
|
||||
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
|
||||
if (NS_FAILED(result))
|
||||
@ -6346,7 +6319,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
dirtystart = PR_TRUE;
|
||||
cellMode = PR_FALSE;
|
||||
}
|
||||
else if (atom.get() == nsSelection::sCellAtom) //you are in "cell" mode put selection to end of cell
|
||||
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
|
||||
{
|
||||
cellMode = PR_TRUE;
|
||||
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
|
||||
@ -6373,7 +6346,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
while (tempNode != parent)
|
||||
{
|
||||
atom = GetTag(tempNode);
|
||||
if (atom.get() == nsSelection::sTableAtom) //select whole table if in cell mode, wait for cell
|
||||
if (atom == nsHTMLAtoms::table) //select whole table if in cell mode, wait for cell
|
||||
{
|
||||
if (!cellMode)
|
||||
{
|
||||
@ -6387,7 +6360,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
||||
else
|
||||
found = PR_FALSE; //didnt find the right cell yet
|
||||
}
|
||||
else if (atom.get() == nsSelection::sCellAtom) //you are in "cell" mode put selection to end of cell
|
||||
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
|
||||
{
|
||||
result = ParentOffset(tempNode, getter_AddRefs(endNode), &endOffset);
|
||||
if (NS_FAILED(result))
|
||||
@ -7141,7 +7114,7 @@ nsTypedSelection::GetFrameToScrolledViewOffsets(nsIScrollableView *aScrollableVi
|
||||
|
||||
// XXX Deal with the case where there is a scrolled element, e.g., a
|
||||
// DIV in the middle...
|
||||
while ((closestView != nsnull) && (closestView != scrolledView)) {
|
||||
while (closestView && closestView != scrolledView) {
|
||||
nscoord dx, dy;
|
||||
|
||||
// Update the offset
|
||||
@ -7610,14 +7583,9 @@ nsTypedSelection::ScrollRectIntoView(nsIScrollableView *aScrollableView,
|
||||
//
|
||||
|
||||
nsIView *view = 0;
|
||||
|
||||
rv = aScrollableView->QueryInterface(NS_GET_IID(nsIView), (void **)&view);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = CallQueryInterface(aScrollableView, &view);
|
||||
if (!view)
|
||||
return NS_ERROR_FAILURE;
|
||||
return rv;
|
||||
|
||||
rv = view->GetParent(view);
|
||||
|
||||
|
@ -4788,19 +4788,18 @@ int RemoveFilesInDir(const char * aDir)
|
||||
*/
|
||||
static void RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
if((nsnull == aPresContext) || (nsnull == out))
|
||||
if (!aPresContext || !out)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (nsnull != shell) {
|
||||
if (shell) {
|
||||
nsIFrame* frame;
|
||||
shell->GetRootFrame(&frame);
|
||||
if(nsnull != frame) {
|
||||
if (frame) {
|
||||
nsIFrameDebug* debugFrame;
|
||||
nsresult rv;
|
||||
rv = frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&debugFrame);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
nsresult rv = CallQueryInterface(frame, &debugFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
debugFrame->List(aPresContext, out, aIndent);
|
||||
}
|
||||
}
|
||||
|
@ -6117,8 +6117,7 @@ void nsCSSDeclaration::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
}
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsCSSDeclaration"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsCSSDeclaration");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
|
@ -1779,7 +1779,7 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
|
||||
// Otherwise we get icky things like crashes in layout... We need
|
||||
// to stop blocking the parser. We really do.
|
||||
PRBool seenParser = PR_FALSE;
|
||||
|
||||
|
||||
// Go through and deal with the whole linked list.
|
||||
SheetLoadData* data = aLoadData;
|
||||
while (data) {
|
||||
|
@ -1097,9 +1097,8 @@ PRBool CSSParserImpl::GatherMedia(PRInt32& aErrorCode, nsString& aMedia,
|
||||
}
|
||||
ToLowerCase(mToken.mIdent); // case insensitive from CSS - must be lower cased
|
||||
if (aMediaAtoms) {
|
||||
nsIAtom* medium = NS_NewAtom(mToken.mIdent);
|
||||
nsCOMPtr<nsIAtom> medium = do_GetAtom(mToken.mIdent);
|
||||
aMediaAtoms->AppendElement(medium);
|
||||
NS_RELEASE(medium);
|
||||
}
|
||||
aMedia.Append(mToken.mIdent);
|
||||
first = PR_FALSE;
|
||||
@ -1323,7 +1322,7 @@ PRBool CSSParserImpl::ProcessNameSpace(PRInt32& aErrorCode, const nsString& aPre
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
|
||||
if (!aPrefix.IsEmpty()) {
|
||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||
prefix = do_GetAtom(aPrefix);
|
||||
}
|
||||
|
||||
NS_NewCSSNameSpaceRule(getter_AddRefs(rule), prefix, aURLSpec);
|
||||
@ -1838,12 +1837,10 @@ void CSSParserImpl::ParseTypeOrUniversalSelector(PRInt32& aDataMask,
|
||||
aDataMask |= SEL_MASK_NSPACE;
|
||||
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(buffer); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(buffer);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(buffer);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown namespace prefix '") +
|
||||
buffer + NS_LITERAL_STRING("'."));
|
||||
@ -2027,12 +2024,10 @@ void CSSParserImpl::ParseAttributeSelector(PRInt32& aDataMask,
|
||||
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // was a namespace
|
||||
nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(attr); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(attr);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(attr);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown namespace prefix '") +
|
||||
attr + NS_LITERAL_STRING("'."));
|
||||
@ -2690,7 +2685,7 @@ PRBool CSSParserImpl::ParseTreePseudoElement(PRInt32& aErrorCode,
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (eCSSToken_Ident == mToken.mType) {
|
||||
nsCOMPtr<nsIAtom> pseudo = getter_AddRefs(NS_NewAtom(mToken.mIdent));
|
||||
nsCOMPtr<nsIAtom> pseudo = do_GetAtom(mToken.mIdent);
|
||||
aSelector.AddPseudoClass(pseudo);
|
||||
}
|
||||
else if (eCSSToken_Symbol == mToken.mType) {
|
||||
@ -3252,12 +3247,10 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue)
|
||||
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // namespace
|
||||
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
|
||||
if (mNameSpace) {
|
||||
nsIAtom* prefix;
|
||||
ToLowerCase(holdIdent); // always case insensitive, since stays within CSS
|
||||
prefix = NS_NewAtom(holdIdent);
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(holdIdent);
|
||||
mNameSpace->FindNameSpaceID(prefix, nameSpaceID);
|
||||
NS_IF_RELEASE(prefix);
|
||||
} // else, no delcared namespaces
|
||||
} // else, no declared namespaces
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -271,8 +271,7 @@ void CSSCharsetRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSCharsetRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSCharsetRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
// add the string for encoding value
|
||||
@ -295,7 +294,7 @@ CSSCharsetRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSCharsetRuleImpl* clone = new CSSCharsetRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -520,8 +519,7 @@ void CSSImportRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSImportRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSImportRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -546,7 +544,7 @@ CSSImportRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSImportRuleImpl* clone = new CSSImportRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -935,8 +933,7 @@ void CSSMediaRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSMediaRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSMediaRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -981,7 +978,7 @@ CSSMediaRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSMediaRuleImpl* clone = new CSSMediaRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1380,8 +1377,7 @@ void CSSNameSpaceRuleImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aS
|
||||
PRUint32 localSize=0;
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("CSSNameSpaceRuleImpl"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("CSSNameSpaceRuleImpl");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
@ -1410,7 +1406,7 @@ CSSNameSpaceRuleImpl::Clone(nsICSSRule*& aClone) const
|
||||
{
|
||||
CSSNameSpaceRuleImpl* clone = new CSSNameSpaceRuleImpl(*this);
|
||||
if (clone) {
|
||||
return clone->QueryInterface(NS_GET_IID(nsICSSRule), (void **)&aClone);
|
||||
return CallQueryInterface(clone, &aClone);
|
||||
}
|
||||
aClone = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -6117,8 +6117,7 @@ void nsCSSDeclaration::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
||||
}
|
||||
|
||||
// create a tag for this instance
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
tag = getter_AddRefs(NS_NewAtom("nsCSSDeclaration"));
|
||||
nsCOMPtr<nsIAtom> tag = do_GetAtom("nsCSSDeclaration");
|
||||
// get the size of an empty instance and add to the sizeof handler
|
||||
aSize = sizeof(*this);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user