Backed out 2 changesets (bug 1519185) build bustages on nsMenuGroupOwnerX.mm. CLOSED TREE

Backed out changeset e1de5282e21a (bug 1519185)
Backed out changeset 00d8afb01890 (bug 1519185)

--HG--
extra : rebase_source : d92a7d4606992503f24c66093d35676e12a84ff0
This commit is contained in:
Cosmin Sabou 2019-01-29 18:22:46 +02:00
parent 10cc795220
commit 6b126c3ff0
14 changed files with 53 additions and 28 deletions

View File

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

View File

@ -2345,6 +2345,9 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
uint8_t modType;
bool hasListeners;
// We don't want to spend time preparsing class attributes if the value is not
// changing, so just init our nsAttrValueOrString with aValue for the
// OnlyNotifySameValueSet call.
nsAttrValueOrString value(aValue);
nsAttrValue oldValue;
bool oldValueSet;
@ -2354,8 +2357,19 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
return OnAttrSetButNotChanged(aNamespaceID, aName, value, aNotify);
}
nsAttrValue attrValue;
nsAttrValue* preparsedAttrValue;
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::_class) {
attrValue.ParseAtomArray(aValue);
value.ResetToAttrValue(attrValue);
preparsedAttrValue = &attrValue;
} else {
preparsedAttrValue = nullptr;
}
if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType);
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType,
preparsedAttrValue);
}
// Hold a script blocker while calling ParseAttribute since that can call
@ -2366,9 +2380,8 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
nsAttrValue attrValue;
if (!ParseAttribute(aNamespaceID, aName, aValue, aSubjectPrincipal,
attrValue)) {
if (!preparsedAttrValue && !ParseAttribute(aNamespaceID, aName, aValue,
aSubjectPrincipal, attrValue)) {
attrValue.SetTo(aValue);
}
@ -2401,7 +2414,8 @@ nsresult Element::SetParsedAttr(int32_t aNamespaceID, nsAtom* aName,
}
if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType);
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType,
&aParsedValue);
}
nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
@ -2568,11 +2582,9 @@ bool Element::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
}
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::_class) {
aResult.ParseAtomArray(aValue);
return true;
}
MOZ_ASSERT(aAttribute != nsGkAtoms::_class,
"The class attribute should be preparsed and therefore should "
"never be passed to Element::ParseAttribute");
if (aAttribute == nsGkAtoms::id) {
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
@ -2706,7 +2718,7 @@ nsresult Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName, bool aNotify) {
if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNameSpaceID, aName,
MutationEvent_Binding::REMOVAL);
MutationEvent_Binding::REMOVAL, nullptr);
}
nsresult rv = BeforeSetAttr(aNameSpaceID, aName, nullptr, aNotify);

View File

@ -139,7 +139,8 @@ void nsMutationReceiver::NativeAnonymousChildListChange(nsIContent* aContent,
void nsMutationReceiver::AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
int32_t aModType,
const nsAttrValue* aNewValue) {
if (nsAutoMutationBatch::IsBatching() ||
!ObservesAttr(RegisterTarget(), aElement, aNameSpaceID, aAttribute)) {
return;

View File

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

View File

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

View File

@ -141,11 +141,12 @@ void nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
}
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();
IMPL_MUTATION_NOTIFICATION(
AttributeWillChange, aElement,
(aElement, aNameSpaceID, aAttribute, aModType),
(aElement, aNameSpaceID, aAttribute, aModType, aNewValue),
IsRemoveNotification::No);
}

View File

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

View File

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

View File

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

View File

@ -1252,7 +1252,8 @@ nsAttrValue SVGElement::WillChangeValue(nsAtom* aName) {
uint8_t modType =
attrValue ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
: 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
// BeforeSetAttr should reflect the value that *will* be set but that implies

View File

@ -4262,7 +4262,8 @@ void PresShell::DocumentStatesChanged(Document* aDocument,
}
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(aElement->OwnerDoc() == mDocument, "Unexpected document");
@ -4272,7 +4273,7 @@ void PresShell::AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
if (mDidInitialize) {
nsAutoCauseReflowNotifier crNotifier(this);
mPresContext->RestyleManager()->AttributeWillChange(
aElement, aNameSpaceID, aAttribute, aModType);
aElement, aNameSpaceID, aAttribute, aModType, aNewValue);
}
}

View File

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

View File

@ -341,7 +341,8 @@ class RestyleManager {
void ContentStateChanged(nsIContent* aContent, EventStates aStateMask);
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 AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType,

View File

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