Bug 1359556 - Optimize cloneNode by preinitializing attribute and child arrays r=bz

Currently, attribute and child arrays (implemented in dom/base/nsAttrAndChildArray.h) start out empty. When cloning, the array ends up being resized multiple times in order to add the attributes and children that are being cloned from the original node. This would be quicker if the array was initialized to the correct size in the first place so that resizes are not necessary.

However, preallocating space for children is only necessary when performing a deep clone. Therefore, an additional parameter is being added to the Clone, CopyInnerTo, and CloneDocHelper methods to indicate whether preallocation of children should happen. Attributes are copied either way, so that part of the array is preallocated in both cases.

MozReview-Commit-ID: 3iVezeAKXnI

--HG--
extra : rebase_source : 9c3deec6d7aafd6411044d623d4863637b45fd58
This commit is contained in:
Kirk Steuber 2017-04-20 12:57:48 -07:00
Родитель 5ddbffd2b7
Коммит 7fdb378650
175 изменённых файлов: 447 добавлений и 212 удалений

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

@ -251,7 +251,8 @@ Attr::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
}
nsresult
Attr::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
Attr::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const
{
nsAutoString value;
const_cast<Attr*>(this)->GetValue(value);

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

@ -70,7 +70,8 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
static void Initialize();

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

@ -144,7 +144,8 @@ protected:
{
}
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsIContent* mHost; // Weak
};

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

@ -1653,7 +1653,8 @@ inline void nsINode::UnsetRestyleFlagsIfGecko()
*/
#define NS_IMPL_ELEMENT_CLONE(_elementName) \
nsresult \
_elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const \
_elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult, \
bool aPreallocateChildren) const \
{ \
*aResult = nullptr; \
already_AddRefed<mozilla::dom::NodeInfo> ni = \
@ -1664,7 +1665,7 @@ _elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
} \
\
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
nsresult rv = const_cast<_elementName*>(this)->CopyInnerTo(it); \
nsresult rv = const_cast<_elementName*>(this)->CopyInnerTo(it, aPreallocateChildren); \
if (NS_SUCCEEDED(rv)) { \
kungFuDeathGrip.swap(*aResult); \
} \
@ -1674,7 +1675,8 @@ _elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
#define NS_IMPL_ELEMENT_CLONE_WITH_INIT(_elementName) \
nsresult \
_elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const \
_elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult, \
bool aPreallocateChildren) const \
{ \
*aResult = nullptr; \
already_AddRefed<mozilla::dom::NodeInfo> ni = \
@ -1686,7 +1688,7 @@ _elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
\
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
nsresult rv = it->Init(); \
nsresult rv2 = const_cast<_elementName*>(this)->CopyInnerTo(it); \
nsresult rv2 = const_cast<_elementName*>(this)->CopyInnerTo(it, aPreallocateChildren); \
if (NS_FAILED(rv2)) { \
rv = rv2; \
} \

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

@ -2058,15 +2058,20 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(FragmentOrElement,
//----------------------------------------------------------------------
nsresult
FragmentOrElement::CopyInnerTo(FragmentOrElement* aDst)
FragmentOrElement::CopyInnerTo(FragmentOrElement* aDst,
bool aPreallocateChildren)
{
nsresult rv = aDst->mAttrsAndChildren.EnsureCapacityToClone(mAttrsAndChildren,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t i, count = mAttrsAndChildren.AttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue* value = mAttrsAndChildren.AttrAt(i);
nsAutoString valStr;
value->ToString(valStr);
nsresult rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
name->GetPrefix(), valStr, false);
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -236,7 +236,7 @@ protected:
* Copy attributes and state to another element
* @param aDest the object to copy to
*/
nsresult CopyInnerTo(FragmentOrElement* aDest);
nsresult CopyInnerTo(FragmentOrElement* aDest, bool aPreallocateChildren);
public:
// Because of a bug in MS C++ compiler nsDOMSlots must be declared public,

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

@ -710,7 +710,8 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
}
nsresult
ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const
{
*aResult = nullptr;
return NS_ERROR_DOM_DATA_CLONE_ERR;

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

@ -186,7 +186,8 @@ protected:
// so instead we track it here.
bool mIsComposedDocParticipant;
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
};
class ShadowRootStyleSheetList : public StyleSheetList

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

@ -794,6 +794,44 @@ nsAttrAndChildArray::GetMapped() const
return mImpl ? mImpl->mMappedAttrs : nullptr;
}
nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
bool aAllocateChildren)
{
NS_PRECONDITION(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
uint32_t attrCount = aOther.NonMappedAttrCount();
uint32_t childCount = 0;
if (aAllocateChildren) {
childCount = aOther.ChildCount();
}
if (attrCount == 0 && childCount == 0) {
return NS_OK;
}
// No need to use a CheckedUint32 because we are cloning. We know that we
// have already allocated an nsAttrAndChildArray of this size.
uint32_t size = attrCount;
size *= ATTRSIZE;
size += childCount;
uint32_t totalSize = size;
totalSize += NS_IMPL_EXTRA_SIZE;
mImpl = static_cast<Impl*>(malloc(totalSize * sizeof(void*)));
NS_ENSURE_TRUE(mImpl, NS_ERROR_OUT_OF_MEMORY);
mImpl->mMappedAttrs = nullptr;
mImpl->mBufferSize = size;
// The array is now the right size, but we should reserve the correct
// number of slots for attributes so that children don't get written into
// that part of the array (which will then need to be moved later).
memset(static_cast<void*>(mImpl->mBuffer), 0, sizeof(InternalAttr) * attrCount);
SetAttrSlotAndChildCount(attrCount, 0);
return NS_OK;
}
bool
nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
{

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

@ -143,6 +143,13 @@ public:
// Will assert off main thread
void ClearMappedServoStyle();
// Increases capacity (if necessary) to have enough space to accomodate the
// unmapped attributes and children of |aOther|. If |aAllocateChildren| is not
// true, only enough space for unmapped attributes will be reserved.
// It is REQUIRED that this function be called ONLY when the array is empty.
nsresult EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
bool aAllocateChildren);
private:
nsAttrAndChildArray(const nsAttrAndChildArray& aOther) = delete;
nsAttrAndChildArray& operator=(const nsAttrAndChildArray& aOther) = delete;

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

@ -9318,7 +9318,7 @@ nsDocument::RefreshLinkHrefs()
}
nsresult
nsDocument::CloneDocHelper(nsDocument* clone) const
nsDocument::CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const
{
clone->mIsStaticDocument = mCreatingStaticClone;
@ -9395,6 +9395,11 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
clone->mType = mType;
clone->mXMLDeclarationBits = mXMLDeclarationBits;
clone->mBaseTarget = mBaseTarget;
// Preallocate attributes and child arrays
rv = clone->mChildren.EnsureCapacityToClone(mChildren, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}

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

@ -812,7 +812,8 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1011,7 +1012,7 @@ public:
mLoadedAsInteractiveData = aLoadedAsInteractiveData;
}
nsresult CloneDocHelper(nsDocument* clone) const;
nsresult CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const;
void MaybeInitializeFinalizeFrameLoaders();

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

@ -167,7 +167,8 @@ public:
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override
{
nsCOMPtr<nsINode> result = CloneDataNode(aNodeInfo, true);
result.forget(aResult);

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

@ -1084,8 +1084,11 @@ public:
*
* @param aNodeInfo the nodeinfo to use for the clone
* @param aResult the clone
* @param aPreallocateChildren If true, the array of children will be
* preallocated in preparation for a deep copy.
*/
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const = 0;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const = 0;
// This class can be extended by subclasses that wish to store more
// information in the slots.

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

@ -473,7 +473,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
nsCOMPtr<nsINode> clone;
if (aClone) {
rv = aNode->Clone(nodeInfo, getter_AddRefs(clone));
rv = aNode->Clone(nodeInfo, getter_AddRefs(clone), aDeep);
NS_ENSURE_SUCCESS(rv, rv);
if (clone->IsElement()) {

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

@ -81,7 +81,8 @@ public:
const nsAString& aValue,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual EventStates IntrinsicState() const override;

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

@ -67,7 +67,8 @@ public:
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual EventStates IntrinsicState() const override;

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

@ -29,7 +29,8 @@ public:
// nsIDOMHTMLMediaElement
using HTMLMediaElement::GetPaused;
virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel) override;
virtual nsIDOMNode* AsDOMNode() override { return this; }

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

@ -25,7 +25,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
bool Clear()
{

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

@ -106,7 +106,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual already_AddRefed<nsIEditor> GetAssociatedEditor() override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual bool IsEventAttributeName(nsIAtom* aName) override;

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

@ -62,7 +62,8 @@ public:
EventChainPostVisitor& aVisitor) override;
// nsINode
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// nsIContent

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

@ -561,9 +561,10 @@ HTMLCanvasElement::GetOriginalCanvas()
}
nsresult
HTMLCanvasElement::CopyInnerTo(Element* aDest)
HTMLCanvasElement::CopyInnerTo(Element* aDest,
bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);

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

@ -307,8 +307,10 @@ public:
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsresult CopyInnerTo(mozilla::dom::Element* aDest,
bool aPreallocateChildren);
virtual nsresult GetEventTargetParent(
mozilla::EventChainPreVisitor& aVisitor) override;

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

@ -40,7 +40,8 @@ public:
virtual bool IsHTMLContentElement() const override { return true; }
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual nsIDOMNode* AsDOMNode() override { return this; }

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

@ -31,7 +31,8 @@ public:
SetHTMLAttr(nsGkAtoms::value, aValue, aError);
}
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLDataElement();

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

@ -34,7 +34,8 @@ public:
}
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// This function is used to generate the nsContentList (option elements).
static bool MatchOptions(Element* aElement, int32_t aNamespaceID,

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

@ -32,7 +32,8 @@ public:
nsIContent* GetFirstSummary() const;
nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult) const override;
nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const override;

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

@ -24,7 +24,8 @@ public:
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLDialogElement, dialog)
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
static bool IsDialogEnabled();

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

@ -35,7 +35,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLDivElement();

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

@ -18,7 +18,8 @@ public:
virtual ~HTMLElement();
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo,
nsINode** aResult) const override;
nsINode** aResult,
bool aPreallocateChildren) const override;
protected:
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;

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

@ -53,7 +53,8 @@ public:
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
const nsIContent* GetFirstLegend() const { return mFirstLegend; }

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

@ -51,7 +51,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLFontElement();

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

@ -122,7 +122,8 @@ public:
*/
void ForgetCurrentSubmission();
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLFormElement,
nsGenericHTMLElement)

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

@ -35,7 +35,8 @@ public:
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
// The XPCOM GetFrameBorder is OK for us

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

@ -136,7 +136,8 @@ public:
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLFrameSetElement();

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

@ -35,7 +35,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
void SetAlign(const nsAString& aAlign, ErrorResult& aError)

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

@ -27,7 +27,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
{

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

@ -44,7 +44,8 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)

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

@ -810,7 +810,7 @@ HTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
}
nsresult
HTMLImageElement::CopyInnerTo(Element* aDest)
HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
bool destIsStatic = aDest->OwnerDoc()->IsStaticDocument();
auto dest = static_cast<HTMLImageElement*>(aDest);
@ -818,7 +818,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest)
CreateStaticImageClone(dest);
}
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
if (NS_FAILED(rv)) {
return rv;
}

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

@ -92,11 +92,12 @@ public:
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
virtual EventStates IntrinsicState() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
nsresult CopyInnerTo(Element* aDest);
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void MaybeLoadImage();

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

@ -1285,7 +1285,8 @@ NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLInputElement)
// nsIDOMNode
nsresult
HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const
HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateArrays) const
{
*aResult = nullptr;
@ -1293,7 +1294,7 @@ HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) co
RefPtr<HTMLInputElement> it = new HTMLInputElement(ni, NOT_FROM_PARSER,
FromClone::yes);
nsresult rv = const_cast<HTMLInputElement*>(this)->CopyInnerTo(it);
nsresult rv = const_cast<HTMLInputElement*>(this)->CopyInnerTo(it, aPreallocateArrays);
NS_ENSURE_SUCCESS(rv, rv);
switch (GetValueMode()) {

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

@ -285,7 +285,8 @@ public:
*/
already_AddRefed<nsIDOMHTMLInputElement> GetSelectedRadioButton() const;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLInputElement,
nsGenericHTMLFormElementWithState)

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

@ -36,7 +36,8 @@ public:
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
void GetType(DOMString& aType)

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

@ -66,7 +66,8 @@ public:
EventChainPostVisitor& aVisitor) override;
virtual bool PerformAccesskey(bool aKeyCausesActivation,
bool aIsTrustedEvent) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsGenericHTMLElement* GetLabeledElement() const;
protected:

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

@ -53,7 +53,8 @@ public:
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
Element* GetFormElement() const
{

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

@ -52,7 +52,8 @@ public:
EventChainPostVisitor& aVisitor) override;
// nsINode
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// nsIContent

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

@ -29,7 +29,8 @@ public:
// nsIDOMHTMLMapElement
NS_DECL_NSIDOMHTMLMAPELEMENT
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLMapElement,
nsGenericHTMLElement)

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

@ -6376,9 +6376,9 @@ already_AddRefed<nsILoadGroup> HTMLMediaElement::GetDocumentLoadGroup()
}
nsresult
HTMLMediaElement::CopyInnerTo(Element* aDest)
HTMLMediaElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {
HTMLMediaElement* dest = static_cast<HTMLMediaElement*>(aDest);

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

@ -385,7 +385,7 @@ public:
*/
bool GetPlayedOrSeeked() const { return mHasPlayedOrSeeked; }
nsresult CopyInnerTo(Element* aDest);
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
/**
* Sets the Accept header on the HTTP channel to the required

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

@ -37,7 +37,8 @@ public:
const nsAString& aValue,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
uint8_t GetType() const { return mType; }

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

@ -178,13 +178,14 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLMenuItemElement, nsGenericHTMLElement,
//NS_IMPL_ELEMENT_CLONE(HTMLMenuItemElement)
nsresult
HTMLMenuItemElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
HTMLMenuItemElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateArrays) const
{
*aResult = nullptr;
already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
RefPtr<HTMLMenuItemElement> it =
new HTMLMenuItemElement(ni, NOT_FROM_PARSER);
nsresult rv = const_cast<HTMLMenuItemElement*>(this)->CopyInnerTo(it);
nsresult rv = const_cast<HTMLMenuItemElement*>(this)->CopyInnerTo(it, aPreallocateArrays);
if (NS_SUCCEEDED(rv)) {
switch (mType) {
case CMD_TYPE_CHECKBOX:

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

@ -52,7 +52,8 @@ public:
virtual void DoneCreatingElement() override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
uint8_t GetType() const { return mType; }

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

@ -37,7 +37,8 @@ public:
void CreateAndDispatchEvent(nsIDocument* aDoc, const nsAString& aEventName);
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// XPCOM GetName is fine.
void SetName(const nsAString& aName, ErrorResult& aRv)

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

@ -24,7 +24,8 @@ public:
virtual EventStates IntrinsicState() const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;

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

@ -19,7 +19,8 @@ class HTMLModElement final : public nsGenericHTMLElement
public:
explicit HTMLModElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
void GetCite(nsString& aCite)
{

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

@ -570,9 +570,10 @@ HTMLObjectElement::DestroyContent()
}
nsresult
HTMLObjectElement::CopyInnerTo(Element* aDest)
HTMLObjectElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {

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

@ -89,9 +89,10 @@ public:
// nsObjectLoadingContent
virtual uint32_t GetCapabilities() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsresult CopyInnerTo(Element* aDest);
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void StartObjectLoad() { StartObjectLoad(true, false); }

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

@ -40,7 +40,8 @@ public:
virtual EventStates IntrinsicState() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;

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

@ -437,9 +437,9 @@ HTMLOptionElement::Option(const GlobalObject& aGlobal,
}
nsresult
HTMLOptionElement::CopyInnerTo(Element* aDest)
HTMLOptionElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {

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

@ -63,9 +63,10 @@ public:
// nsIContent
virtual EventStates IntrinsicState() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
virtual bool IsDisabled() const override {
return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);

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

@ -36,7 +36,8 @@ public:
virtual bool IsDisabled() const override { return false; }
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;

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

@ -37,7 +37,8 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
// The XPCOM GetAlign is fine for our purposes

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

@ -26,7 +26,8 @@ public:
// nsIDOMHTMLPictureElement
NS_DECL_NSIDOMHTMLPICTUREELEMENT
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify) override;

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

@ -38,7 +38,8 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
int32_t Width() const

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

@ -23,7 +23,8 @@ public:
EventStates IntrinsicState() const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;

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

@ -93,7 +93,8 @@ HTMLScriptElement::ParseAttribute(int32_t aNamespaceID,
}
nsresult
HTMLScriptElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
HTMLScriptElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const
{
*aResult = nullptr;
@ -101,7 +102,7 @@ HTMLScriptElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) c
HTMLScriptElement* it = new HTMLScriptElement(ni, NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = const_cast<HTMLScriptElement*>(this)->CopyInnerTo(it);
nsresult rv = const_cast<HTMLScriptElement*>(this)->CopyInnerTo(it, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
// The clone should be marked evaluated if we are.

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

@ -53,7 +53,8 @@ public:
const nsAString& aValue,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// Element
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,

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

@ -402,7 +402,8 @@ public:
int32_t aModType) const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSelectElement,
nsGenericHTMLFormElementWithState)

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

@ -39,7 +39,8 @@ public:
virtual bool IsHTMLShadowElement() const override { return true; }
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,

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

@ -81,7 +81,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// WebIDL API
// HTMLParamElement

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

@ -41,7 +41,8 @@ public:
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
bool Reversed() const
{

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

@ -346,9 +346,9 @@ HTMLSharedObjectElement::DestroyContent()
}
nsresult
HTMLSharedObjectElement::CopyInnerTo(Element* aDest)
HTMLSharedObjectElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {

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

@ -79,9 +79,10 @@ public:
// nsObjectLoadingContent
virtual uint32_t GetCapabilities() const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsresult CopyInnerTo(Element* aDest);
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void StartObjectLoad() { StartObjectLoad(true, false); }

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

@ -35,7 +35,8 @@ public:
// nsIDOMHTMLSourceElement
NS_DECL_NSIDOMHTMLSOURCEELEMENT
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
// Override BindToTree() so that we can trigger a load when we add a
// child source element.

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

@ -26,7 +26,8 @@ public:
{
}
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLSpanElement();

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

@ -50,7 +50,8 @@ public:
const nsAttrValue* aValue,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// nsIMutationObserver
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED

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

@ -29,7 +29,8 @@ public:
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLSummaryElement, summary)
nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult) const override;
nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;

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

@ -37,7 +37,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLTableCaptionElement();

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

@ -151,7 +151,8 @@ public:
// Get mapped attributes of ancestor table, if any
nsMappedAttributes* GetMappedAttributesInheritedFromTable() const;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLTableCellElement();

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

@ -79,7 +79,8 @@ public:
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLTableColElement();

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

@ -189,7 +189,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,

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

@ -85,7 +85,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLTableRowElement,
nsGenericHTMLElement)

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

@ -70,7 +70,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLTableSectionElement,
nsGenericHTMLElement)

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

@ -26,7 +26,8 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTemplateElement,
nsGenericHTMLElement)
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
DocumentFragment* Content()
{

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

@ -102,14 +102,15 @@ NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
// nsIDOMHTMLTextAreaElement
nsresult
HTMLTextAreaElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
HTMLTextAreaElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const
{
*aResult = nullptr;
already_AddRefed<mozilla::dom::NodeInfo> ni =
RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
RefPtr<HTMLTextAreaElement> it = new HTMLTextAreaElement(ni);
nsresult rv = const_cast<HTMLTextAreaElement*>(this)->CopyInnerTo(it);
nsresult rv = const_cast<HTMLTextAreaElement*>(this)->CopyInnerTo(it, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (mValueChanged) {
@ -1120,9 +1121,10 @@ HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
nsresult
HTMLTextAreaElement::CopyInnerTo(Element* aDest)
HTMLTextAreaElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLFormElementWithState::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLFormElementWithState::CopyInnerTo(aDest,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {

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

@ -145,9 +145,10 @@ public:
virtual void DoneAddingChildren(bool aHaveNotified) override;
virtual bool IsDoneAddingChildren() override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsresult CopyInnerTo(Element* aDest);
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
/**
* Called when an attribute is about to be changed

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

@ -32,7 +32,8 @@ public:
SetHTMLAttr(nsGkAtoms::datetime, aDateTime, aError);
}
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
protected:
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

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

@ -38,7 +38,8 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,

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

@ -90,7 +90,8 @@ public:
TextTrack* GetTrack();
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
// Override ParseAttribute() to convert kind strings to enum values.
virtual bool ParseAttribute(int32_t aNamespaceID,

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

@ -31,7 +31,8 @@ public:
}
}
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
protected:
virtual ~HTMLUnknownElement() {}

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

@ -41,7 +41,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// Set size with the current video frame's height and width.
// If there is no video frame, returns NS_ERROR_FAILURE.

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

@ -175,9 +175,14 @@ NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement)
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElementBase)
nsresult
nsGenericHTMLElement::CopyInnerTo(Element* aDst)
nsGenericHTMLElement::CopyInnerTo(Element* aDst, bool aPreallocateChildren)
{
nsresult rv;
rv = static_cast<nsGenericHTMLElement*>(aDst)->mAttrsAndChildren.
EnsureCapacityToClone(mAttrsAndChildren, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
int32_t i, count = GetAttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);

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

@ -68,7 +68,7 @@ public:
NS_IMPL_FROMCONTENT(nsGenericHTMLElement, kNameSpaceID_XHTML)
// From Element
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
void GetTitle(mozilla::dom::DOMString& aTitle)
{

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

@ -433,9 +433,10 @@ nsGenericHTMLFrameElement::DestroyContent()
}
nsresult
nsGenericHTMLFrameElement::CopyInnerTo(Element* aDest)
nsGenericHTMLFrameElement::CopyInnerTo(Element* aDest,
bool aPreallocateChildren)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument* doc = aDest->OwnerDoc();

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

@ -68,7 +68,7 @@ public:
bool aNotify) override;
virtual void DestroyContent() override;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
virtual int32_t TabIndexDefault() override;

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

@ -3654,13 +3654,14 @@ nsHTMLDocument::QueryCommandValue(const nsAString& commandID,
}
nsresult
nsHTMLDocument::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
nsHTMLDocument::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const
{
NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager,
"Can't import this document into another document!");
RefPtr<nsHTMLDocument> clone = new nsHTMLDocument();
nsresult rv = CloneDocHelper(clone.get());
nsresult rv = CloneDocHelper(clone.get(), aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
// State from nsHTMLDocument

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

@ -148,7 +148,8 @@ public:
virtual nsresult SetEditingState(EditingState aState) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual void RemovedFromDocShell() override;

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

@ -78,7 +78,8 @@ public:
mozilla::EventChainPreVisitor& aVisitor) override;
virtual nsresult PostHandleEvent(
mozilla::EventChainPostVisitor& aVisitor) override;
nsresult Clone(mozilla::dom::NodeInfo*, nsINode**) const override;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual mozilla::EventStates IntrinsicState() const override;
virtual bool IsNodeOfType(uint32_t aFlags) const override;

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

@ -41,7 +41,8 @@ public:
EventChainPreVisitor& aVisitor) override;
virtual nsresult PostHandleEvent(
EventChainPostVisitor& aVisitor) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// nsIContent
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,

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

@ -31,7 +31,8 @@ protected:
public:
// nsIDOMNode
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// SVGAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction() override;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше