зеркало из https://github.com/mozilla/gecko-dev.git
Bug 968766 - Part h: Replace GetDocumentAllResult by GetDocumentAllList on nsHTMLDocument; r=jst
This commit is contained in:
Родитель
c18f27d71d
Коммит
4204e87a21
|
@ -135,7 +135,24 @@ HTMLAllCollection::GetNamedItem(const nsAString& aID,
|
|||
nsWrapperCache** aCache,
|
||||
nsresult* aResult)
|
||||
{
|
||||
return mDocument->GetDocumentAllResult(aID, aCache, aResult);
|
||||
nsContentList* docAllList = mDocument->GetDocumentAllList(aID, aResult);
|
||||
if (!docAllList) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Check if there are more than 1 entries. Do this by getting the second one
|
||||
// rather than the length since getting the length always requires walking
|
||||
// the entire document.
|
||||
|
||||
nsIContent* cont = docAllList->Item(1, true);
|
||||
if (cont) {
|
||||
*aCache = docAllList;
|
||||
return static_cast<nsINodeList*>(docAllList);
|
||||
}
|
||||
|
||||
// There's only 0 or 1 items. Return the first one or null.
|
||||
*aCache = cont = docAllList->Item(0, true);
|
||||
return cont;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -2591,12 +2591,9 @@ DocAllResultMatch(nsIContent* aContent, int32_t aNamespaceID, nsIAtom* aAtom,
|
|||
}
|
||||
|
||||
|
||||
nsISupports*
|
||||
nsHTMLDocument::GetDocumentAllResult(const nsAString& aID,
|
||||
nsWrapperCache** aCache,
|
||||
nsresult *aResult)
|
||||
nsContentList*
|
||||
nsHTMLDocument::GetDocumentAllList(const nsAString& aID, nsresult *aResult)
|
||||
{
|
||||
*aCache = nullptr;
|
||||
*aResult = NS_OK;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aID);
|
||||
|
@ -2620,20 +2617,7 @@ nsHTMLDocument::GetDocumentAllResult(const nsAString& aID,
|
|||
entry->SetDocAllList(docAllList);
|
||||
}
|
||||
|
||||
// Check if there are more than 1 entries. Do this by getting the second one
|
||||
// rather than the length since getting the length always requires walking
|
||||
// the entire document.
|
||||
|
||||
nsIContent* cont = docAllList->Item(1, true);
|
||||
if (cont) {
|
||||
*aCache = docAllList;
|
||||
return static_cast<nsINodeList*>(docAllList);
|
||||
}
|
||||
|
||||
// There's only 0 or 1 items. Return the first one or null.
|
||||
*aCache = cont = docAllList->Item(0, true);
|
||||
|
||||
return cont;
|
||||
return docAllList;
|
||||
}
|
||||
|
||||
HTMLAllCollection*
|
||||
|
|
|
@ -103,13 +103,9 @@ public:
|
|||
NS_DECL_NSIDOMHTMLDOCUMENT
|
||||
|
||||
/**
|
||||
* Returns the result of document.all[aID] which can either be a node
|
||||
* or a nodelist depending on if there are multiple nodes with the same
|
||||
* id.
|
||||
* Returns the NodeList for document.all[aID], or null if there isn't one.
|
||||
*/
|
||||
nsISupports *GetDocumentAllResult(const nsAString& aID,
|
||||
nsWrapperCache **aCache,
|
||||
nsresult *aResult);
|
||||
nsContentList* GetDocumentAllList(const nsAString& aID, nsresult* aResult);
|
||||
mozilla::dom::HTMLAllCollection* All();
|
||||
JSObject* GetAll(JSContext* aCx, mozilla::ErrorResult& aRv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче