Commit 2bfed054 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

don't add subtree of a document to parent document and small performance improvement

parent cf4a475b
Showing with 16 additions and 10 deletions
+16 -10
......@@ -81,14 +81,18 @@ namespace Svg
{
if (!this._mock)
{
if (this._owner.OwnerDocument != null)
{
this._owner.OwnerDocument.IdManager.AddAndFixID(item, autoFixID, logElementOldIDNewID);
foreach (var child in item.Children)
{
child.ApplyRecursive(e => this._owner.OwnerDocument.IdManager.AddAndFixID(e, autoFixChildrenID, logElementOldIDNewID));
}
}
if (this._owner.OwnerDocument != null)
{
this._owner.OwnerDocument.IdManager.AddAndFixID(item, autoFixID, logElementOldIDNewID);
if(!(item is SvgDocument)) //don't add subtree of a document to parent document
{
foreach (var child in item.Children)
{
child.ApplyRecursive(e => this._owner.OwnerDocument.IdManager.AddAndFixID(e, autoFixChildrenID, logElementOldIDNewID));
}
}
}
item._parent = this._owner;
}
......
......@@ -57,10 +57,12 @@ namespace Svg
{
action(elem);
foreach (var element in elem.Children)
if(!(elem is SvgDocument)) //don't apply action to subtree of documents
{
if(!(elem is SvgDocument))
foreach (var element in elem.Children)
{
element.ApplyRecursive(action);
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment