2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Implementation of DOM Core's nsIDOMAttr node.
|
|
|
|
*/
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
#include "mozilla/dom/Attr.h"
|
2013-04-09 08:29:47 -07:00
|
|
|
#include "mozilla/dom/AttrBinding.h"
|
2010-08-24 00:05:56 -07:00
|
|
|
#include "mozilla/dom/Element.h"
|
2014-03-17 21:48:21 -07:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-02-27 02:51:15 -08:00
|
|
|
#include "mozilla/InternalMutationEvent.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2012-07-27 07:03:27 -07:00
|
|
|
#include "nsError.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsUnicharUtils.h"
|
|
|
|
#include "nsDOMString.h"
|
2013-10-02 04:40:07 -07:00
|
|
|
#include "nsIContentInlines.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsCOMArray.h"
|
2014-02-27 15:04:46 -08:00
|
|
|
#include "nsNameSpaceManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsNodeUtils.h"
|
2008-10-15 02:40:28 -07:00
|
|
|
#include "nsTextNode.h"
|
|
|
|
#include "mozAutoDocUpdate.h"
|
2011-05-26 12:58:35 -07:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-06 16:37:47 -07:00
|
|
|
nsIAttribute::nsIAttribute(nsDOMAttributeMap* aAttrMap,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2013-05-06 16:37:47 -07:00
|
|
|
bool aNsAware)
|
|
|
|
: nsINode(aNodeInfo), mAttrMap(aAttrMap), mNsAware(aNsAware)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-27 04:54:32 -08:00
|
|
|
nsIAttribute::~nsIAttribute()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2010-08-24 00:05:56 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
2013-04-09 08:29:44 -07:00
|
|
|
bool Attr::sInitialized;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::Attr(nsDOMAttributeMap *aAttrMap,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2013-04-09 08:29:44 -07:00
|
|
|
const nsAString &aValue, bool aNsAware)
|
2012-04-03 00:25:39 -07:00
|
|
|
: nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
|
2011-06-14 00:56:49 -07:00
|
|
|
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
|
|
|
|
"Wrong nodeType");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// We don't add a reference to our content. It will tell us
|
|
|
|
// to drop our reference when it goes away.
|
2008-07-11 13:42:19 -07:00
|
|
|
}
|
|
|
|
|
2013-08-01 18:29:05 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(Attr)
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
|
2009-05-12 13:20:42 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
2011-08-28 07:07:24 -07:00
|
|
|
|
|
|
|
if (!nsINode::Traverse(tmp, cb)) {
|
|
|
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
|
|
|
}
|
2013-05-06 16:37:47 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAttrMap)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2013-05-28 16:58:29 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Attr)
|
2009-05-12 13:20:42 -07:00
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Attr)
|
2011-08-28 07:07:24 -07:00
|
|
|
nsINode::Unlink(tmp);
|
2013-05-06 16:37:47 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAttrMap)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
2010-01-12 05:08:43 -08:00
|
|
|
|
2013-05-06 16:37:47 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(Attr)
|
2014-04-10 09:09:50 -07:00
|
|
|
Element* ownerElement = tmp->GetElement();
|
2013-05-06 16:37:47 -07:00
|
|
|
if (tmp->IsBlack()) {
|
|
|
|
if (ownerElement) {
|
|
|
|
// The attribute owns the element via attribute map so we can
|
|
|
|
// mark it when the attribute is certainly alive.
|
|
|
|
mozilla::dom::FragmentOrElement::MarkNodeChildren(ownerElement);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (ownerElement &&
|
|
|
|
mozilla::dom::FragmentOrElement::CanSkip(ownerElement, true)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(Attr)
|
|
|
|
return tmp->IsBlackAndDoesNotNeedTracing(static_cast<nsIAttribute*>(tmp));
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(Attr)
|
|
|
|
return tmp->IsBlack();
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
// QueryInterface implementation for Attr
|
|
|
|
NS_INTERFACE_TABLE_HEAD(Attr)
|
2014-08-25 16:21:35 -07:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
2014-04-27 00:06:00 -07:00
|
|
|
NS_INTERFACE_TABLE(Attr, nsINode, nsIDOMAttr, nsIAttribute, nsIDOMNode,
|
|
|
|
nsIDOMEventTarget, EventTarget)
|
2013-05-21 12:59:27 -07:00
|
|
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(Attr)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
|
|
|
new nsNodeSupportsWeakRefTearoff(this))
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
|
2013-07-09 10:30:58 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(Attr,
|
|
|
|
nsNodeUtils::LastRelease(this))
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::SetMap(nsDOMAttributeMap *aMap)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (mAttrMap && !aMap && sInitialized) {
|
|
|
|
// We're breaking a relationship with content and not getting a new one,
|
|
|
|
// need to locally cache value. GetValue() does that.
|
|
|
|
GetValue(mValue);
|
|
|
|
}
|
2010-05-27 12:10:33 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
mAttrMap = aMap;
|
|
|
|
}
|
|
|
|
|
2014-04-10 09:09:50 -07:00
|
|
|
Element*
|
|
|
|
Attr::GetElement() const
|
2014-03-21 13:02:21 -07:00
|
|
|
{
|
2014-04-10 09:09:50 -07:00
|
|
|
if (!mAttrMap) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
nsIContent* content = mAttrMap->GetContent();
|
|
|
|
return content ? content->AsElement() : nullptr;
|
2014-03-21 13:02:21 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::SetOwnerDocument(nsIDocument* aDocument)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aDocument, "Missing document");
|
|
|
|
|
2011-10-18 03:53:36 -07:00
|
|
|
nsIDocument *doc = OwnerDoc();
|
2013-04-09 08:29:44 -07:00
|
|
|
NS_ASSERTION(doc != aDocument, "bad call to Attr::SetOwnerDocument");
|
2011-10-18 04:19:44 -07:00
|
|
|
doc->DeleteAllPropertiesFor(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
nsRefPtr<mozilla::dom::NodeInfo> newNodeInfo;
|
2008-09-12 15:32:18 -07:00
|
|
|
newNodeInfo = aDocument->NodeInfoManager()->
|
2007-03-22 10:30:00 -07:00
|
|
|
GetNodeInfo(mNodeInfo->NameAtom(), mNodeInfo->GetPrefixAtom(),
|
2011-06-14 00:56:49 -07:00
|
|
|
mNodeInfo->NamespaceID(),
|
|
|
|
nsIDOMNode::ATTRIBUTE_NODE);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ASSERTION(newNodeInfo, "GetNodeInfo lies");
|
|
|
|
mNodeInfo.swap(newNodeInfo);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetName(nsAString& aName)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-06-14 00:56:49 -07:00
|
|
|
aName = NodeName();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-12-28 06:35:06 -08:00
|
|
|
already_AddRefed<nsIAtom>
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetNameAtom(nsIContent* aContent)
|
2009-12-28 06:35:06 -08:00
|
|
|
{
|
2010-10-14 07:07:20 -07:00
|
|
|
if (!mNsAware &&
|
|
|
|
mNodeInfo->NamespaceID() == kNameSpaceID_None &&
|
2009-12-28 06:35:06 -08:00
|
|
|
aContent->IsInHTMLDocument() &&
|
|
|
|
aContent->IsHTML()) {
|
2012-03-09 21:50:34 -08:00
|
|
|
nsString name;
|
|
|
|
mNodeInfo->GetName(name);
|
|
|
|
nsAutoString lowercaseName;
|
|
|
|
nsContentUtils::ASCIIToLower(name, lowercaseName);
|
2013-04-22 04:15:59 -07:00
|
|
|
return do_GetAtom(lowercaseName);
|
2009-12-28 06:35:06 -08:00
|
|
|
}
|
2013-04-22 04:15:59 -07:00
|
|
|
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
|
|
|
|
return nameAtom.forget();
|
2009-12-28 06:35:06 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetValue(nsAString& aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-04-10 09:09:50 -07:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (element) {
|
|
|
|
nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(element);
|
|
|
|
element->GetAttr(mNodeInfo->NamespaceID(), nameAtom, aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
aValue = mValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-09 08:29:47 -07:00
|
|
|
void
|
|
|
|
Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-04-10 09:09:50 -07:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (!element) {
|
2012-04-03 00:25:39 -07:00
|
|
|
mValue = aValue;
|
2013-04-09 08:29:47 -07:00
|
|
|
return;
|
2012-04-03 00:25:39 -07:00
|
|
|
}
|
|
|
|
|
2014-04-10 09:09:50 -07:00
|
|
|
nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(element);
|
|
|
|
aRv = element->SetAttr(mNodeInfo->NamespaceID(),
|
2013-04-09 08:29:47 -07:00
|
|
|
nameAtom,
|
|
|
|
mNodeInfo->GetPrefixAtom(),
|
|
|
|
aValue,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Attr::SetValue(const nsAString& aValue)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetValue(aValue, rv);
|
|
|
|
return rv.ErrorCode();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 08:29:47 -07:00
|
|
|
bool
|
|
|
|
Attr::Specified() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-06-23 01:30:48 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetSpecified(bool* aSpecified)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aSpecified);
|
2013-04-09 08:29:47 -07:00
|
|
|
*aSpecified = Specified();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-03-21 13:04:09 -07:00
|
|
|
Element*
|
|
|
|
Attr::GetOwnerElement(ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
|
2014-04-10 09:09:50 -07:00
|
|
|
return GetElement();
|
2014-03-21 13:04:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Attr::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
|
|
|
|
|
2014-04-10 09:09:50 -07:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (element) {
|
|
|
|
return CallQueryInterface(element, aOwnerElement);
|
2014-03-21 13:04:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*aOwnerElement = nullptr;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetNodeValueInternal(nsAString& aNodeValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-18 04:19:44 -07:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
2011-06-23 01:30:48 -07:00
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
GetValue(aNodeValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-18 04:19:44 -07:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
2011-06-23 01:30:48 -07:00
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
aError = SetValue(aNodeValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2014-06-19 19:01:40 -07:00
|
|
|
Attr::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nsAutoString value;
|
2013-04-09 08:29:44 -07:00
|
|
|
const_cast<Attr*>(this)->GetValue(value);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
nsRefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
|
2013-04-09 08:29:44 -07:00
|
|
|
*aResult = new Attr(nullptr, ni.forget(), value, mNsAware);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-04-19 08:40:15 -07:00
|
|
|
already_AddRefed<nsIURI>
|
2013-09-24 14:56:52 -07:00
|
|
|
Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
2010-04-19 08:40:15 -07:00
|
|
|
{
|
2014-04-10 09:09:50 -07:00
|
|
|
Element* parent = GetElement();
|
2010-04-19 08:40:15 -07:00
|
|
|
|
2013-09-24 14:56:52 -07:00
|
|
|
return parent ? parent->GetBaseURI(aTryUseXHRDocBaseURI) : nullptr;
|
2010-04-19 08:40:15 -07:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
void
|
2014-08-05 03:10:00 -07:00
|
|
|
Attr::GetTextContentInternal(nsAString& aTextContent,
|
|
|
|
ErrorResult& aError)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-18 04:19:44 -07:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
GetValue(aTextContent);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::SetTextContentInternal(const nsAString& aTextContent,
|
|
|
|
ErrorResult& aError)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-18 04:19:44 -07:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
SetNodeValueInternal(aTextContent, aError);
|
2011-06-14 00:56:48 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetIsId(bool* aReturn)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-05-30 00:36:53 -07:00
|
|
|
*aReturn = mNodeInfo->Equals(nsGkAtoms::id, kNameSpaceID_None);
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::IsNodeOfType(uint32_t aFlags) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return !(aFlags & ~eATTRIBUTE);
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetChildCount() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-04-03 00:25:39 -07:00
|
|
|
return 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIContent *
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetChildAt(uint32_t aIndex) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2008-07-11 13:42:19 -07:00
|
|
|
|
|
|
|
nsIContent * const *
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::GetChildArray(uint32_t* aChildCount) const
|
2008-07-11 13:42:19 -07:00
|
|
|
{
|
2012-04-03 00:25:39 -07:00
|
|
|
*aChildCount = 0;
|
2013-04-02 18:14:24 -07:00
|
|
|
return nullptr;
|
2009-01-02 09:00:18 -08:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::IndexOf(const nsINode* aPossibleChild) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-04-03 00:25:39 -07:00
|
|
|
return -1;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aNotify)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-03-29 14:09:07 -07:00
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2014-03-17 21:48:19 -07:00
|
|
|
Attr::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
aVisitor.mCanHandle = true;
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::Initialize()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
sInitialized = true;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-09 08:29:44 -07:00
|
|
|
Attr::Shutdown()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
sInitialized = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2013-04-09 08:29:44 -07:00
|
|
|
|
2013-04-09 08:29:47 -07:00
|
|
|
JSObject*
|
2014-10-07 02:44:48 -07:00
|
|
|
Attr::WrapNode(JSContext* aCx)
|
2013-04-09 08:29:47 -07:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 15:27:17 -07:00
|
|
|
return AttrBinding::Wrap(aCx, this);
|
2013-04-09 08:29:47 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 08:29:44 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|