Bug 1434399 part 7. Remove nsIDOMXULDocument's getElementsByAttribute(NS) methods. r=mystor

MozReview-Commit-ID: HN1le8EkeGr
This commit is contained in:
Boris Zbarsky 2018-01-31 14:49:27 -05:00
parent cf38d244a2
commit f35c2bc77d
4 changed files with 9 additions and 40 deletions

View File

@ -28,17 +28,18 @@
#include "TableAccessible.h"
#include "TableCellAccessible.h"
#include "TreeWalker.h"
#include "XULDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULLabelElement.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsINodeList.h"
#include "nsPIDOMWindow.h"
#include "nsIDocument.h"
@ -1751,22 +1752,17 @@ Accessible::RelationByType(RelationType aType)
}
} else {
// In XUL, use first <button default="true" .../> in the document
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(mContent->OwnerDoc());
dom::XULDocument* xulDoc = mContent->OwnerDoc()->AsXULDocument();
nsCOMPtr<nsIDOMXULButtonElement> buttonEl;
if (xulDoc) {
nsCOMPtr<nsIDOMNodeList> possibleDefaultButtons;
xulDoc->GetElementsByAttribute(NS_LITERAL_STRING("default"),
NS_LITERAL_STRING("true"),
getter_AddRefs(possibleDefaultButtons));
nsCOMPtr<nsINodeList> possibleDefaultButtons =
xulDoc->GetElementsByAttribute(NS_LITERAL_STRING("default"),
NS_LITERAL_STRING("true"));
if (possibleDefaultButtons) {
uint32_t length;
possibleDefaultButtons->GetLength(&length);
nsCOMPtr<nsIDOMNode> possibleButton;
uint32_t length = possibleDefaultButtons->Length();
// Check for button in list of default="true" elements
for (uint32_t count = 0; count < length && !buttonEl; count ++) {
possibleDefaultButtons->Item(count, getter_AddRefs(possibleButton));
buttonEl = do_QueryInterface(possibleButton);
buttonEl = do_QueryInterface(possibleDefaultButtons->Item(count));
}
}
if (!buttonEl) { // Check for anonymous accept button in <dialog>

View File

@ -31,6 +31,7 @@ LOCAL_INCLUDES += [
'/accessible/xpcom',
'/accessible/xul',
'/dom/base',
'/dom/xul',
'/layout/generic',
'/layout/xul',
]

View File

@ -13,13 +13,6 @@ interface nsIBoxObject;
[uuid(7790d4c3-e8f0-4e29-9887-d683ed2b2a44)]
interface nsIDOMXULDocument : nsIDOMDocument
{
nsIDOMNodeList getElementsByAttribute(in DOMString name,
in DOMString value);
nsIDOMNodeList getElementsByAttributeNS(in DOMString namespaceURI,
in DOMString name,
in DOMString value);
void addBroadcastListenerFor(in nsIDOMElement broadcaster,
in nsIDOMElement observer,
in DOMString attr);

View File

@ -1102,15 +1102,6 @@ XULDocument::ResolveForwardReferences()
// nsIDOMDocument interface
//
NS_IMETHODIMP
XULDocument::GetElementsByAttribute(const nsAString& aAttribute,
const nsAString& aValue,
nsIDOMNodeList** aReturn)
{
*aReturn = GetElementsByAttribute(aAttribute, aValue).take();
return NS_OK;
}
already_AddRefed<nsINodeList>
XULDocument::GetElementsByAttribute(const nsAString& aAttribute,
const nsAString& aValue)
@ -1128,18 +1119,6 @@ XULDocument::GetElementsByAttribute(const nsAString& aAttribute,
return list.forget();
}
NS_IMETHODIMP
XULDocument::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aAttribute,
const nsAString& aValue,
nsIDOMNodeList** aReturn)
{
ErrorResult rv;
*aReturn = GetElementsByAttributeNS(aNamespaceURI, aAttribute,
aValue, rv).take();
return rv.StealNSResult();
}
already_AddRefed<nsINodeList>
XULDocument::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aAttribute,