Bug 1519185: Remove AttributeWillChange aNewValue parameter r=emilio,bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D17073
This commit is contained in:
garvitdelhi
2019-01-29 15:27:02 +00:00
committed by Emilio Cobos Álvarez
parent ef8b62c773
commit cdc6f539cb
15 changed files with 26 additions and 43 deletions

View File

@@ -641,8 +641,7 @@ NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(DocAccessible)
void DocAccessible::AttributeWillChange(dom::Element* aElement, void DocAccessible::AttributeWillChange(dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType) {
const nsAttrValue* aNewValue) {
Accessible* accessible = GetAccessible(aElement); Accessible* accessible = GetAccessible(aElement);
if (!accessible) { if (!accessible) {
if (aElement != mContent) return; if (aElement != mContent) return;

View File

@@ -2355,8 +2355,7 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
} }
if (aNotify) { if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType, nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType);
nullptr);
} }
// Hold a script blocker while calling ParseAttribute since that can call // Hold a script blocker while calling ParseAttribute since that can call
@@ -2402,8 +2401,7 @@ nsresult Element::SetParsedAttr(int32_t aNamespaceID, nsAtom* aName,
} }
if (aNotify) { if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType, nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType);
&aParsedValue);
} }
nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify); nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
@@ -2708,7 +2706,7 @@ nsresult Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName, bool aNotify) {
if (aNotify) { if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNameSpaceID, aName, nsNodeUtils::AttributeWillChange(this, aNameSpaceID, aName,
MutationEvent_Binding::REMOVAL, nullptr); MutationEvent_Binding::REMOVAL);
} }
nsresult rv = BeforeSetAttr(aNameSpaceID, aName, nullptr, aNotify); nsresult rv = BeforeSetAttr(aNameSpaceID, aName, nullptr, aNotify);

View File

@@ -139,8 +139,7 @@ void nsMutationReceiver::NativeAnonymousChildListChange(nsIContent* aContent,
void nsMutationReceiver::AttributeWillChange(mozilla::dom::Element* aElement, void nsMutationReceiver::AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* 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)) {
return; return;

View File

@@ -359,8 +359,7 @@ class nsMutationReceiver : public nsMutationReceiverBase {
nsAtom* aAttribute) override { nsAtom* aAttribute) override {
// We can reuse AttributeWillChange implementation. // We can reuse AttributeWillChange implementation.
AttributeWillChange(aElement, aNameSpaceID, aAttribute, AttributeWillChange(aElement, aNameSpaceID, aAttribute,
mozilla::dom::MutationEvent_Binding::MODIFICATION, mozilla::dom::MutationEvent_Binding::MODIFICATION);
nullptr);
} }
protected: protected:

View File

@@ -164,8 +164,7 @@ class nsIMutationObserver : public nsISupports {
*/ */
virtual void AttributeWillChange(mozilla::dom::Element* aElement, virtual void AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType, int32_t aModType) = 0;
const nsAttrValue* aNewValue) = 0;
/** /**
* Notification that an attribute of an element has changed. * Notification that an attribute of an element has changed.
@@ -308,8 +307,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE \ #define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE \
virtual void AttributeWillChange(mozilla::dom::Element* aElement, \ virtual void AttributeWillChange(mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, nsAtom* aAttribute, \ int32_t aNameSpaceID, nsAtom* aAttribute, \
int32_t aModType, \ int32_t aModType) override;
const nsAttrValue* aNewValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_NATIVEANONYMOUSCHILDLISTCHANGE \ #define NS_DECL_NSIMUTATIONOBSERVER_NATIVEANONYMOUSCHILDLISTCHANGE \
virtual void NativeAnonymousChildListChange(nsIContent* aContent, \ virtual void NativeAnonymousChildListChange(nsIContent* aContent, \
@@ -357,9 +355,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
nsIContent* aContent, const CharacterDataChangeInfo& aInfo) {} \ nsIContent* aContent, const CharacterDataChangeInfo& aInfo) {} \
void _class::CharacterDataChanged(nsIContent* aContent, \ void _class::CharacterDataChanged(nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) {} \ const CharacterDataChangeInfo& aInfo) {} \
void _class::AttributeWillChange( \ void _class::AttributeWillChange(mozilla::dom::Element* aElement, \
mozilla::dom::Element* aElement, int32_t aNameSpaceID, \ int32_t aNameSpaceID, nsAtom* aAttribute, \
nsAtom* aAttribute, int32_t aModType, const nsAttrValue* aNewValue) {} \ int32_t aModType) {} \
void _class::NativeAnonymousChildListChange(nsIContent* aContent, \ void _class::NativeAnonymousChildListChange(nsIContent* aContent, \
bool aIsRemove) {} \ bool aIsRemove) {} \
void _class::AttributeChanged( \ void _class::AttributeChanged( \

View File

@@ -141,13 +141,11 @@ void nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
} }
void nsNodeUtils::AttributeWillChange(Element* aElement, int32_t aNameSpaceID, void nsNodeUtils::AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType) {
const nsAttrValue* aNewValue) {
Document* doc = aElement->OwnerDoc(); Document* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION( IMPL_MUTATION_NOTIFICATION(AttributeWillChange, aElement,
AttributeWillChange, aElement, (aElement, aNameSpaceID, aAttribute, aModType),
(aElement, aNameSpaceID, aAttribute, aModType, aNewValue), IsRemoveNotification::No);
IsRemoveNotification::No);
} }
void nsNodeUtils::AttributeChanged(Element* aElement, int32_t aNameSpaceID, void nsNodeUtils::AttributeChanged(Element* aElement, int32_t aNameSpaceID,

View File

@@ -57,8 +57,7 @@ class nsNodeUtils {
*/ */
static void AttributeWillChange(mozilla::dom::Element* aElement, static void AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType, int32_t aModType);
const nsAttrValue* aNewValue);
/** /**
* Send AttributeChanged notifications to nsIMutationObservers. * Send AttributeChanged notifications to nsIMutationObservers.

View File

@@ -97,7 +97,7 @@ void nsStyledElement::InlineStyleDeclarationWillChange(
modification ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION) modification ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
: static_cast<uint8_t>(MutationEvent_Binding::ADDITION); : static_cast<uint8_t>(MutationEvent_Binding::ADDITION);
nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, nsGkAtoms::style, nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, nsGkAtoms::style,
aData.mModType, nullptr); aData.mModType);
// XXXsmaug In order to make attribute handling more consistent, consider to // XXXsmaug In order to make attribute handling more consistent, consider to
// call BeforeSetAttr and pass kCallAfterSetAttr to // call BeforeSetAttr and pass kCallAfterSetAttr to

View File

@@ -1088,8 +1088,7 @@ void IMEContentObserver::ContentRemoved(nsIContent* aChild,
void IMEContentObserver::AttributeWillChange(dom::Element* aElement, void IMEContentObserver::AttributeWillChange(dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType) {
const nsAttrValue* aNewValue) {
if (!NeedsTextChangeNotification()) { if (!NeedsTextChangeNotification()) {
return; return;
} }

View File

@@ -1252,8 +1252,7 @@ nsAttrValue SVGElement::WillChangeValue(nsAtom* aName) {
uint8_t modType = uint8_t modType =
attrValue ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION) attrValue ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
: static_cast<uint8_t>(MutationEvent_Binding::ADDITION); : static_cast<uint8_t>(MutationEvent_Binding::ADDITION);
nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, aName, modType, nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, aName, modType);
nullptr);
// This is not strictly correct--the attribute value parameter for // This is not strictly correct--the attribute value parameter for
// BeforeSetAttr should reflect the value that *will* be set but that implies // BeforeSetAttr should reflect the value that *will* be set but that implies

View File

@@ -4262,8 +4262,7 @@ void PresShell::DocumentStatesChanged(Document* aDocument,
} }
void PresShell::AttributeWillChange(Element* aElement, int32_t aNameSpaceID, void PresShell::AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType) {
const nsAttrValue* aNewValue) {
MOZ_ASSERT(!mIsDocumentGone, "Unexpected AttributeWillChange"); MOZ_ASSERT(!mIsDocumentGone, "Unexpected AttributeWillChange");
MOZ_ASSERT(aElement->OwnerDoc() == mDocument, "Unexpected document"); MOZ_ASSERT(aElement->OwnerDoc() == mDocument, "Unexpected document");
@@ -4272,8 +4271,8 @@ void PresShell::AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
// squelch any other inappropriate notifications as well. // squelch any other inappropriate notifications as well.
if (mDidInitialize) { if (mDidInitialize) {
nsAutoCauseReflowNotifier crNotifier(this); nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->AttributeWillChange( mPresContext->RestyleManager()->AttributeWillChange(aElement, aNameSpaceID,
aElement, aNameSpaceID, aAttribute, aModType, aNewValue); aAttribute, aModType);
} }
} }

View File

@@ -3279,8 +3279,7 @@ static inline bool NeedToRecordAttrChange(
void RestyleManager::AttributeWillChange(Element* aElement, void RestyleManager::AttributeWillChange(Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType) {
const nsAttrValue* aNewValue) {
TakeSnapshotForAttributeChange(*aElement, aNameSpaceID, aAttribute); TakeSnapshotForAttributeChange(*aElement, aNameSpaceID, aAttribute);
} }

View File

@@ -341,8 +341,7 @@ class RestyleManager {
void ContentStateChanged(nsIContent* aContent, EventStates aStateMask); void ContentStateChanged(nsIContent* aContent, EventStates aStateMask);
void AttributeWillChange(Element* aElement, int32_t aNameSpaceID, void AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType);
const nsAttrValue* aNewValue);
void ClassAttributeWillBeChangedBySMIL(dom::Element* aElement); void ClassAttributeWillBeChangedBySMIL(dom::Element* aElement);
void AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID, void AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType,

View File

@@ -180,8 +180,7 @@ void nsFormFillController::CharacterDataChanged(
void nsFormFillController::AttributeWillChange(mozilla::dom::Element* aElement, void nsFormFillController::AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType) {}
const nsAttrValue* aNewValue) {}
void nsFormFillController::NativeAnonymousChildListChange(nsIContent* aContent, void nsFormFillController::NativeAnonymousChildListChange(nsIContent* aContent,
bool aIsRemove) {} bool aIsRemove) {}

View File

@@ -70,8 +70,7 @@ void nsMenuGroupOwnerX::ContentAppended(nsIContent* aFirstNewContent) {
void nsMenuGroupOwnerX::NodeWillBeDestroyed(const nsINode* aNode) {} void nsMenuGroupOwnerX::NodeWillBeDestroyed(const nsINode* aNode) {}
void nsMenuGroupOwnerX::AttributeWillChange(dom::Element* aContent, int32_t aNameSpaceID, void nsMenuGroupOwnerX::AttributeWillChange(dom::Element* aContent, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType) {}
const nsAttrValue* aNewValue) {}
void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIContent* aContent, bool aIsRemove) {} void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIContent* aContent, bool aIsRemove) {}