From 3c70b297c7be12b7d7e120de04a38f40b600928b Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 25 Jan 2020 09:14:03 -0500 Subject: Bug 1430951 - Avoid element name atomizing to improve performance of LookupCustomElementDefinition Since we are dealing with the element (nodeInfo->LocalName() and NameAtom() are the same value), we could use nodeInfo->NameAtom() instead. Tag UXP Issue #1344 --- dom/base/nsContentUtils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dom/base/nsContentUtils.cpp') diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 402dfd1c5..b6cbbbace 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9536,9 +9536,11 @@ nsContentUtils::TryToUpgradeElement(Element* aElement) NodeInfo* nodeInfo = aElement->NodeInfo(); RefPtr typeAtom = aElement->GetCustomElementData()->GetCustomElementType(); + + MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName())); CustomElementDefinition* definition = nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(), - nodeInfo->LocalName(), + nodeInfo->NameAtom(), nodeInfo->NamespaceID(), typeAtom); if (definition) { @@ -9553,7 +9555,7 @@ nsContentUtils::TryToUpgradeElement(Element* aElement) /* static */ CustomElementDefinition* nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc, - const nsAString& aLocalName, + nsIAtom* aNameAtom, uint32_t aNameSpaceID, nsIAtom* aTypeAtom) { @@ -9577,7 +9579,7 @@ nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc, return nullptr; } - return registry->LookupCustomElementDefinition(aLocalName, aTypeAtom); + return registry->LookupCustomElementDefinition(aNameAtom, aTypeAtom); } /* static */ void -- cgit v1.2.3