Bug 1184842. Add aNewValue to nsIMutationObserver::AttributeWillChange. r=peterv

This commit is contained in:
Robert O'Callahan 2015-07-25 18:05:19 +12:00
parent 9fb2247b78
commit 3e3003e4ce
13 changed files with 33 additions and 17 deletions

View File

@ -692,7 +692,8 @@ void
DocAccessible::AttributeWillChange(nsIDocument* aDocument, DocAccessible::AttributeWillChange(nsIDocument* aDocument,
dom::Element* aElement, dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType) nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aNewValue)
{ {
Accessible* accessible = GetAccessible(aElement); Accessible* accessible = GetAccessible(aElement);
if (!accessible) { if (!accessible) {

View File

@ -327,7 +327,8 @@ nsSHEntryShared::AttributeWillChange(nsIDocument* aDocument,
dom::Element* aContent, dom::Element* aContent,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType,
const nsAttrValue* aNewValue)
{ {
} }

View File

@ -117,7 +117,8 @@ nsMutationReceiver::AttributeWillChange(nsIDocument* aDocument,
mozilla::dom::Element* aElement, mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType,
const nsAttrValue* aNewValue)
{ {
if (nsAutoMutationBatch::IsBatching() || if (nsAutoMutationBatch::IsBatching() ||
!ObservesAttr(RegisterTarget(), aElement, aNameSpaceID, aAttribute)) { !ObservesAttr(RegisterTarget(), aElement, aNameSpaceID, aAttribute)) {

View File

@ -374,7 +374,7 @@ public:
{ {
// We can reuse AttributeWillChange implementation. // We can reuse AttributeWillChange implementation.
AttributeWillChange(aDocument, aElement, aNameSpaceID, aAttribute, AttributeWillChange(aDocument, aElement, aNameSpaceID, aAttribute,
nsIDOMMutationEvent::MODIFICATION); nsIDOMMutationEvent::MODIFICATION, nullptr);
} }
protected: protected:

View File

@ -22,8 +22,9 @@ class Element;
} // namespace mozilla } // namespace mozilla
#define NS_IMUTATION_OBSERVER_IID \ #define NS_IMUTATION_OBSERVER_IID \
{ 0x51a4cec3, 0xb720, 0x4893, \ { 0xdd74f0cc, 0x2849, 0x4d05, \
{ 0xb1, 0x11, 0x33, 0xca, 0xbe, 0xae, 0xbf, 0x57 } } { 0x9c, 0xe3, 0xb0, 0x95, 0x3e, 0xc2, 0xfd, 0x44 } }
/** /**
* Information details about a characterdata change. Basically, we * Information details about a characterdata change. Basically, we
* view all changes as replacements of a length of text at some offset * view all changes as replacements of a length of text at some offset
@ -157,6 +158,8 @@ public:
* @param aModType Whether or not the attribute will be added, changed, or * @param aModType Whether or not the attribute will be added, changed, or
* removed. The constants are defined in * removed. The constants are defined in
* nsIDOMMutationEvent.h. * nsIDOMMutationEvent.h.
* @param aNewValue The new value, IF it has been preparsed by
* BeforeSetAttr, otherwise null.
* *
* @note Callers of this method might not hold a strong reference to the * @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays * observer. The observer is responsible for making sure it stays
@ -168,7 +171,8 @@ public:
mozilla::dom::Element* aElement, mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) = 0; int32_t aModType,
const nsAttrValue* aNewValue) = 0;
/** /**
* Notification that an attribute of an element has changed. * Notification that an attribute of an element has changed.
@ -339,7 +343,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
mozilla::dom::Element* aElement, \ mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
int32_t aModType) override; int32_t aModType, \
const nsAttrValue* aNewValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \ #define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
virtual void AttributeChanged(nsIDocument* aDocument, \ virtual void AttributeChanged(nsIDocument* aDocument, \
@ -409,7 +414,8 @@ _class::AttributeWillChange(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \ mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
int32_t aModType) \ int32_t aModType, \
const nsAttrValue* aNewValue) \
{ \ { \
} \ } \
void \ void \

View File

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

View File

@ -744,7 +744,8 @@ IMEContentObserver::AttributeWillChange(nsIDocument* aDocument,
dom::Element* aElement, dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType,
const nsAttrValue* aNewValue)
{ {
nsIContent *content = GetContentBR(aElement); nsIContent *content = GetContentBR(aElement);
mPreAttrChangeLength = content ? mPreAttrChangeLength = content ?

View File

@ -647,7 +647,8 @@ UndoMutationObserver::AttributeWillChange(nsIDocument* aDocument,
mozilla::dom::Element* aElement, mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType,
const nsAttrValue* aNewValue)
{ {
if (!IsManagerForMutation(aElement)) { if (!IsManagerForMutation(aElement)) {
return; return;

View File

@ -1439,7 +1439,8 @@ nsSVGElement::WillChangeValue(nsIAtom* aName)
uint8_t modType = attrValue uint8_t modType = attrValue
? static_cast<uint8_t>(nsIDOMMutationEvent::MODIFICATION) ? static_cast<uint8_t>(nsIDOMMutationEvent::MODIFICATION)
: static_cast<uint8_t>(nsIDOMMutationEvent::ADDITION); : static_cast<uint8_t>(nsIDOMMutationEvent::ADDITION);
nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, aName, modType); nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, aName, modType,
nullptr);
return emptyOrOldAttrValue; return emptyOrOldAttrValue;
} }

View File

@ -914,7 +914,8 @@ XULDocument::ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
void void
XULDocument::AttributeWillChange(nsIDocument* aDocument, XULDocument::AttributeWillChange(nsIDocument* aDocument,
Element* aElement, int32_t aNameSpaceID, Element* aElement, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType) nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aNewValue)
{ {
MOZ_ASSERT(aElement, "Null content!"); MOZ_ASSERT(aElement, "Null content!");
NS_PRECONDITION(aAttribute, "Must have an attribute that's changing!"); NS_PRECONDITION(aAttribute, "Must have an attribute that's changing!");

View File

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

View File

@ -189,7 +189,8 @@ void
nsFormFillController::AttributeWillChange(nsIDocument* aDocument, nsFormFillController::AttributeWillChange(nsIDocument* aDocument,
mozilla::dom::Element* aElement, mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType) nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aNewValue)
{ {
} }

View File

@ -91,7 +91,8 @@ void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument,
dom::Element* aContent, dom::Element* aContent,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) int32_t aModType,
const nsAttrValue* aNewValue)
{ {
} }