Bug 1577592 - Properly set the has part attribute bit when cloning a XUL element. r=bzbarsky

Test is in the other revision for this bug.

Do the same we do for the other bits. This setup looks pretty error prone
though...

Differential Revision: https://phabricator.services.mozilla.com/D44069

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-08-30 00:10:36 +00:00
Родитель 233a01c078
Коммит 7a79edccc2
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -314,6 +314,10 @@ nsresult nsXULElement::Clone(mozilla::dom::NodeInfo* aNodeInfo,
uint32_t count = mAttrs.AttrCount();
rv = NS_OK;
// FIXME(emilio): This setup looks somewhat error prone. Other than the
// AddListenerFor bit (what is that for?), everything else could be handled by
// the generic Element::CopyInnerTo, or the equivalent in
// nsGenericHTMLElement (somehow), both of which go through AfterSetAttr...
for (uint32_t i = 0; i < count; ++i) {
const nsAttrName* originalName = mAttrs.AttrNameAt(i);
const nsAttrValue* originalValue = mAttrs.AttrAt(i);
@ -352,6 +356,9 @@ nsresult nsXULElement::Clone(mozilla::dom::NodeInfo* aNodeInfo,
if (originalName->Equals(nsGkAtoms::style)) {
element->SetMayHaveStyle();
}
if (originalName->Equals(nsGkAtoms::part)) {
element->SetHasPartAttribute(true);
}
}
element.forget(aResult);