зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1517880 - Add a flag for l10n elements created from prototype. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36067 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
52c27c1da9
Коммит
ebcd546db9
|
@ -1894,6 +1894,7 @@ void Element::UnbindFromTree(bool aNullParent) {
|
|||
|
||||
ClearInDocument();
|
||||
SetIsConnected(false);
|
||||
ClearElementCreatedFromPrototypeAndHasUnmodifiedL10n();
|
||||
|
||||
if (aNullParent || !mParent->IsInShadowTree()) {
|
||||
UnsetFlags(NODE_IS_IN_SHADOW_TREE);
|
||||
|
@ -2468,6 +2469,12 @@ nsresult Element::SetAttrAndNotify(
|
|||
}
|
||||
}
|
||||
|
||||
if (HasElementCreatedFromPrototypeAndHasUnmodifiedL10n() &&
|
||||
aNamespaceID == kNameSpaceID_None &&
|
||||
(aName == nsGkAtoms::datal10nid || aName == nsGkAtoms::datal10nargs)) {
|
||||
ClearElementCreatedFromPrototypeAndHasUnmodifiedL10n();
|
||||
}
|
||||
|
||||
CustomElementDefinition* definition = GetCustomElementDefinition();
|
||||
// Only custom element which is in `custom` state could get the
|
||||
// CustomElementDefinition.
|
||||
|
|
|
@ -1474,6 +1474,9 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
ElementMayHaveAnonymousChildren,
|
||||
// Set if element has CustomElementData.
|
||||
ElementHasCustomElementData,
|
||||
// Set if the element was created from prototype cache and
|
||||
// its l10n attributes haven't been changed.
|
||||
ElementCreatedFromPrototypeAndHasUnmodifiedL10n,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
|
@ -1611,6 +1614,16 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
return GetBoolFlag(ElementHasCustomElementData);
|
||||
}
|
||||
|
||||
void SetElementCreatedFromPrototypeAndHasUnmodifiedL10n() {
|
||||
SetBoolFlag(ElementCreatedFromPrototypeAndHasUnmodifiedL10n);
|
||||
}
|
||||
bool HasElementCreatedFromPrototypeAndHasUnmodifiedL10n() {
|
||||
return GetBoolFlag(ElementCreatedFromPrototypeAndHasUnmodifiedL10n);
|
||||
}
|
||||
void ClearElementCreatedFromPrototypeAndHasUnmodifiedL10n() {
|
||||
ClearBoolFlag(ElementCreatedFromPrototypeAndHasUnmodifiedL10n);
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
|
||||
void SetIsInDocument() { SetBoolFlag(IsInDocument); }
|
||||
|
|
|
@ -1054,6 +1054,7 @@ nsresult PrototypeDocumentContentSink::CreateElementFromPrototype(
|
|||
}
|
||||
}
|
||||
|
||||
result->SetElementCreatedFromPrototypeAndHasUnmodifiedL10n();
|
||||
result.forget(aResult);
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче