Bug 1184842. Pass aOldValue to all mutation observers. r=peterv

This commit is contained in:
Robert O'Callahan 2015-07-25 18:01:19 +12:00
parent 0d0c23582f
commit d67ff5c3b6
28 changed files with 67 additions and 35 deletions

View File

@ -733,7 +733,8 @@ void
DocAccessible::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_ASSERTION(!IsDefunct(),
"Attribute changed called on defunct document accessible!");

View File

@ -336,7 +336,8 @@ nsSHEntryShared::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
RemoveFromBFCacheAsync();
}

View File

@ -607,7 +607,8 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (!IsPooledNode(aElement, aElement->GetParent(), mPoolHost)) {
return;

View File

@ -659,7 +659,8 @@ nsContentList::Item(uint32_t aIndex)
void
nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_PRECONDITION(aElement, "Must have a content node to work with");

View File

@ -2590,7 +2590,8 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
MOZ_ASSERT(mObservingOwnerContent);
// TODO: Implement ContentShellAdded for remote browsers (bug 658304)

View File

@ -9,6 +9,7 @@
#include "nsISupports.h"
class nsAttrValue;
class nsIAtom;
class nsIContent;
class nsIDocument;
@ -21,9 +22,8 @@ class Element;
} // namespace mozilla
#define NS_IMUTATION_OBSERVER_IID \
{ 0x16fe5e3e, 0xeadc, 0x4312, \
{ 0x9d, 0x44, 0xb6, 0xbe, 0xdd, 0x6b, 0x54, 0x74 } }
{ 0x51a4cec3, 0xb720, 0x4893, \
{ 0xb1, 0x11, 0x33, 0xca, 0xbe, 0xae, 0xbf, 0x57 } }
/**
* Information details about a characterdata change. Basically, we
* view all changes as replacements of a length of text at some offset
@ -180,6 +180,8 @@ public:
* @param aModType Whether or not the attribute was added, changed, or
* removed. The constants are defined in
* nsIDOMMutationEvent.h.
* @param aOldValue The old value, if either the old value or the new
* value are StoresOwnData() (or absent); null otherwise.
*
* @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays
@ -191,7 +193,8 @@ public:
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) = 0;
int32_t aModType,
const nsAttrValue* aOldValue) = 0;
/**
* Notification that an attribute of an element has been
@ -343,7 +346,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsIAtom* aAttribute, \
int32_t aModType) override;
int32_t aModType, \
const nsAttrValue* aOldValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \
virtual void ContentAppended(nsIDocument* aDocument, \
@ -413,7 +417,8 @@ _class::AttributeChanged(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsIAtom* aAttribute, \
int32_t aModType) \
int32_t aModType, \
const nsAttrValue* aOldValue) \
{ \
} \
void \

View File

@ -141,7 +141,7 @@ nsNodeUtils::AttributeChanged(Element* aElement,
nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement,
(doc, aElement, aNameSpaceID, aAttribute,
aModType));
aModType, aOldValue));
}
void

View File

@ -83,7 +83,8 @@ nsScriptElement::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
MaybeProcessScript();
}

View File

@ -268,7 +268,8 @@ nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (aNameSpaceID == mNameSpaceID && aAttribute == mAttrName &&
aElement == mGrandparent) {

View File

@ -756,7 +756,8 @@ IMEContentObserver::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
mEndOfAddedTextCache.Clear();
mStartOfRemovingTextRangeCache.Clear();

View File

@ -153,7 +153,8 @@ HTMLPropertiesCollection::NamedItem(const nsAString& aName)
void
HTMLPropertiesCollection::AttributeChanged(nsIDocument *aDocument, Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
mIsDirty = true;
}
@ -427,7 +428,8 @@ PropertyNodeList::GetValues(JSContext* aCx, nsTArray<JS::Value >& aResult,
void
PropertyNodeList::AttributeChanged(nsIDocument* aDocument, Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
mIsDirty = true;
}

View File

@ -259,7 +259,8 @@ bool nsDOMStringMap::AttrToDataProp(const nsAString& aAttr,
void
nsDOMStringMap::AttributeChanged(nsIDocument *aDocument, Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if ((aModType == nsIDOMMutationEvent::ADDITION ||
aModType == nsIDOMMutationEvent::REMOVAL) &&

View File

@ -165,7 +165,8 @@ SVGMPathElement::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::d) {

View File

@ -156,7 +156,8 @@ SVGUseElement::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (nsContentUtils::IsInSameAnonymousTree(this, aElement)) {
TriggerReclone();

View File

@ -218,7 +218,8 @@ nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
MaybeUnhook(aElement);
}

View File

@ -136,7 +136,8 @@ XPathResult::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
Invalidate(aElement);
}

View File

@ -1244,7 +1244,8 @@ txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
mStylesheet = nullptr;
}

View File

@ -931,7 +931,8 @@ XULDocument::AttributeWillChange(nsIDocument* aDocument,
void
XULDocument::AttributeChanged(nsIDocument* aDocument,
Element* aElement, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType)
nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_ASSERTION(aDocument == this, "unexpected doc");

View File

@ -1510,7 +1510,8 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@ -1536,7 +1537,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
// Pass along to the generic template builder.
nsXULTemplateBuilder::AttributeChanged(aDocument, aElement, aNameSpaceID,
aAttribute, aModType);
aAttribute, aModType, aOldValue);
}
void

View File

@ -1093,7 +1093,8 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (aElement == mRoot && aNameSpaceID == kNameSpaceID_None) {
// Check for a change to the 'ref' attribute on an atom, in which

View File

@ -4257,7 +4257,8 @@ PresShell::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected AttributeChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");

View File

@ -919,7 +919,8 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
// If the parent of the changing content node is our map then update
// the map. But only do this if the node is an HTML <area> or <a>

View File

@ -632,7 +632,8 @@ inDOMView::NodeWillBeDestroyed(const nsINode* aNode)
void
inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
int32_t aNameSpaceID, nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (!mTree) {
return;

View File

@ -3467,7 +3467,8 @@ SVGTextFrame::MutationObserver::AttributeChanged(
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
if (!aElement->IsSVGElement()) {
return;

View File

@ -112,7 +112,8 @@ nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
// An attribute belonging to the element that we are observing *or one of its
// descendants* has changed.

View File

@ -715,7 +715,8 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
// Lots of codepaths under here that do all sorts of stuff, so be safe.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);

View File

@ -114,7 +114,8 @@ void
nsFormFillController::AttributeChanged(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType)
nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue)
{
if ((aAttribute == nsGkAtoms::type || aAttribute == nsGkAtoms::readonly ||
aAttribute == nsGkAtoms::autocomplete) &&

View File

@ -100,7 +100,8 @@ void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
int32_t aModType,
const nsAttrValue* aOldValue)
{
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aElement);