optimized <object_ref> handling for the common case of simple reference with no overwrites
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -844,6 +844,22 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !node->GetChildren() )
|
||||||
|
{
|
||||||
|
// In the typical, simple case, <object_ref> is used to link
|
||||||
|
// to another node and doesn't have any content of its own that
|
||||||
|
// would overwrite linked object's properties. In this case,
|
||||||
|
// we can simply create the resource from linked node.
|
||||||
|
|
||||||
|
return CreateResFromNode(refNode, parent, instance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// In the more complicated (but rare) case, <object_ref> has
|
||||||
|
// subnodes that partially overwrite content of the referenced
|
||||||
|
// object. In this case, we need to merge both XML trees and
|
||||||
|
// load the resource from result of the merge.
|
||||||
|
|
||||||
wxXmlNode copy(*refNode);
|
wxXmlNode copy(*refNode);
|
||||||
MergeNodesOver(copy, *node, GetFileNameFromNode(node, Data()));
|
MergeNodesOver(copy, *node, GetFileNameFromNode(node, Data()));
|
||||||
|
|
||||||
@@ -853,6 +869,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
|
|||||||
|
|
||||||
return CreateResFromNode(©, parent, instance);
|
return CreateResFromNode(©, parent, instance);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (handlerToUse)
|
if (handlerToUse)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user