Bug 1426525 part 2. Remove the now-nearly-unused XULDocument::GetElementsForID method. r=smaug

MozReview-Commit-ID: Gv23I8gLhem
This commit is contained in:
Boris Zbarsky 2018-01-05 13:48:39 -05:00
Родитель bde68b50e6
Коммит 77660697fc
5 изменённых файлов: 13 добавлений и 39 удалений

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

@ -444,14 +444,6 @@ nsIdentifierMapEntry::GetImageIdElement()
return mImageElement ? mImageElement.get() : GetIdElement();
}
void
nsIdentifierMapEntry::AppendAllIdContent(nsCOMArray<Element>* aElements)
{
for (Element* element : mIdContentList) {
aElements->AppendObject(element);
}
}
void
nsIdentifierMapEntry::AddContentChangeCallback(nsIDocument::IDTargetObserver aCallback,
void* aData, bool aForImage)

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

@ -17,7 +17,6 @@
#include "mozilla/Move.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsAtom.h"
#include "nsTArray.h"
@ -139,10 +138,6 @@ public:
* the image element will be returned, otherwise the same as GetIdElement().
*/
Element* GetImageIdElement();
/**
* Append all the elements with this id to aElements
*/
void AppendAllIdContent(nsCOMArray<Element>* aElements);
/**
* This can fire ID change callbacks.
* @return true if the content could be added, false if we failed due

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

@ -1021,18 +1021,6 @@ XULDocument::ContentRemoved(nsIDocument* aDocument,
// nsIXULDocument interface
//
void
XULDocument::GetElementsForID(const nsAString& aID,
nsCOMArray<Element>& aElements)
{
aElements.Clear();
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aID);
if (entry) {
entry->AppendAllIdContent(&aElements);
}
}
nsresult
XULDocument::AddForwardReference(nsForwardReference* aRef)
{
@ -1893,9 +1881,19 @@ XULDocument::ApplyPersistentAttributesInternal()
continue;
}
// This will clear the array if there are no elements.
GetElementsForID(id, elements);
if (!elements.Count()) {
nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(id);
if (!entry) {
continue;
}
// We want to hold strong refs to the elements while applying
// persistent attributes, just in case.
elements.Clear();
elements.SetCapacity(entry->GetIdElements().Length());
for (Element* element : entry->GetIdElements()) {
elements.AppendObject(element);
}
if (elements.IsEmpty()) {
continue;
}

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

@ -91,9 +91,6 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
// nsIXULDocument interface
virtual void GetElementsForID(const nsAString& aID,
nsCOMArray<mozilla::dom::Element>& aElements) override;
NS_IMETHOD AddSubtreeToDocument(nsIContent* aContent) override;
NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aContent) override;
NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) override;

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

@ -35,14 +35,6 @@ class nsIXULDocument : public nsISupports
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID)
/**
* Get the elements for a particular resource --- all elements whose 'id'
* or 'ref' is aID. The nsCOMArray will be truncated and filled in with
* nsIContent pointers.
*/
virtual void GetElementsForID(const nsAString& aID,
nsCOMArray<mozilla::dom::Element>& aElements) = 0;
/**
* Notify the XUL document that a subtree has been added
*/