Backed out changeset ea13caf078a7 (bug 847586)

This commit is contained in:
Ed Morley 2013-03-14 13:23:28 +00:00
parent 2b6f518d2b
commit 0708b1cd92
5 changed files with 11 additions and 80 deletions

View File

@ -6,6 +6,8 @@
#include "nsCOMPtr.h"
#include "nsDOMClassInfoID.h"
#include "nsDOMMutationEvent.h"
#include "nsMutationEvent.h"
class nsPresContext;
@ -16,7 +18,6 @@ nsDOMMutationEvent::nsDOMMutationEvent(mozilla::dom::EventTarget* aOwner,
aEvent ? aEvent : new nsMutationEvent(false, 0))
{
mEventIsInternal = (aEvent == nullptr);
SetIsDOMBinding();
}
nsDOMMutationEvent::~nsDOMMutationEvent()
@ -41,9 +42,10 @@ NS_IMPL_RELEASE_INHERITED(nsDOMMutationEvent, nsDOMEvent)
NS_IMETHODIMP
nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
{
nsCOMPtr<nsINode> relatedNode = GetRelatedNode();
nsCOMPtr<nsIDOMNode> relatedDOMNode = relatedNode ? relatedNode->AsDOMNode() : nullptr;
relatedDOMNode.forget(aRelatedNode);
*aRelatedNode = nullptr;
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
*aRelatedNode = mutation->mRelatedNode;
NS_IF_ADDREF(*aRelatedNode);
return NS_OK;
}
@ -77,7 +79,10 @@ nsDOMMutationEvent::GetAttrName(nsAString& aAttrName)
NS_IMETHODIMP
nsDOMMutationEvent::GetAttrChange(uint16_t* aAttrChange)
{
*aAttrChange = AttrChange();
*aAttrChange = 0;
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
if (mutation->mAttrChange)
*aAttrChange = mutation->mAttrChange;
return NS_OK;
}

View File

@ -8,8 +8,6 @@
#include "nsIDOMMutationEvent.h"
#include "nsDOMEvent.h"
#include "nsMutationEvent.h"
#include "mozilla/dom/MutationEventBinding.h"
class nsDOMMutationEvent : public nsDOMEvent,
public nsIDOMMutationEvent
@ -19,48 +17,13 @@ public:
nsPresContext* aPresContext, nsMutationEvent* aEvent);
virtual ~nsDOMMutationEvent();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMMUTATIONEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMEVENT
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
{
return mozilla::dom::MutationEventBinding::Wrap(aCx, aScope, this);
}
// xpidl implementation
// GetPrevValue(nsAString& aPrevValue);
// GetNewValue(nsAString& aNewValue);
// GetAttrName(nsAString& aAttrName);
already_AddRefed<nsINode> GetRelatedNode()
{
nsCOMPtr<nsINode> n =
do_QueryInterface(static_cast<nsMutationEvent*>(mEvent)->mRelatedNode);
return n.forget();
}
uint16_t AttrChange()
{
return static_cast<nsMutationEvent*>(mEvent)->mAttrChange;
}
void InitMutationEvent(const nsAString& aType,
bool& aCanBubble, bool& aCancelable,
nsINode* aRelatedNode,
const nsAString& aPrevValue,
const nsAString& aNewValue,
const nsAString& aAttrName,
uint16_t& aAttrChange, mozilla::ErrorResult& aRv)
{
aRv = InitMutationEvent(aType, aCanBubble, aCancelable,
aRelatedNode ? aRelatedNode->AsDOMNode() : nullptr,
aPrevValue, aNewValue, aAttrName, aAttrChange);
}
};
#endif // nsDOMMutationEvent_h__

View File

@ -518,9 +518,6 @@ DOMInterfaces = {
'workers': True,
}],
'MutationEvent': {
'nativeType': 'nsDOMMutationEvent',
},
'MutationObserver': {
'nativeType': 'nsDOMMutationObserver',

View File

@ -1,33 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface MutationEvent : Event
{
const unsigned short MODIFICATION = 1;
const unsigned short ADDITION = 2;
const unsigned short REMOVAL = 3;
readonly attribute Node? relatedNode;
readonly attribute DOMString prevValue;
readonly attribute DOMString newValue;
readonly attribute DOMString attrName;
readonly attribute unsigned short attrChange;
[Throws]
void initMutationEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Node? relatedNode,
DOMString prevValue,
DOMString newValue,
DOMString attrName,
unsigned short attrChange);
};

View File

@ -125,7 +125,6 @@ webidl_files = \
Location.webidl \
MediaStream.webidl \
MessageEvent.webidl \
MutationEvent.webidl \
MutationObserver.webidl \
Node.webidl \
NodeFilter.webidl \