Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2574)

Unified Diff: WebCore/svg/SVGUseElement.cpp

Issue 3960005: Merge 69936 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/svg/custom/use-nested-children-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/svg/SVGUseElement.cpp
===================================================================
--- WebCore/svg/SVGUseElement.cpp (revision 70351)
+++ WebCore/svg/SVGUseElement.cpp (working copy)
@@ -797,6 +797,7 @@
// Don't ASSERT(target) here, it may be "pending", too.
// Setup sub-shadow tree root node
RefPtr<SVGShadowTreeContainerElement> cloneParent = SVGShadowTreeContainerElement::create(document());
+ use->cloneChildNodes(cloneParent.get());
// Spec: In the generated content, the 'use' will be replaced by 'g', where all attributes from the
// 'use' element except for x, y, width, height and xlink:href are transferred to the generated 'g' element.
@@ -806,14 +807,6 @@
if (target && !isDisallowedElement(target)) {
RefPtr<Element> newChild = target->cloneElementWithChildren();
- // We don't walk the target tree element-by-element, and clone each element,
- // but instead use cloneElementWithChildren(). This is an optimization for the common
- // case where <use> doesn't contain disallowed elements (ie. <foreignObject>).
- // Though if there are disallowed elements in the subtree, we have to remove them.
- // For instance: <use> on <g> containing <foreignObject> (indirect case).
- if (subtreeContainsDisallowedElement(newChild.get()))
- removeDisallowedElementsFromSubtree(newChild.get());
-
SVGElement* newChildPtr = 0;
if (newChild->isSVGElement())
newChildPtr = static_cast<SVGElement*>(newChild.get());
@@ -823,6 +816,14 @@
ASSERT(!ec);
}
+ // We don't walk the target tree element-by-element, and clone each element,
+ // but instead use cloneElementWithChildren(). This is an optimization for the common
+ // case where <use> doesn't contain disallowed elements (ie. <foreignObject>).
+ // Though if there are disallowed elements in the subtree, we have to remove them.
+ // For instance: <use> on <g> containing <foreignObject> (indirect case).
+ if (subtreeContainsDisallowedElement(cloneParent.get()))
+ removeDisallowedElementsFromSubtree(cloneParent.get());
+
// Replace <use> with referenced content.
ASSERT(use->parentNode());
use->parentNode()->replaceChild(cloneParent.release(), use, ec);
« no previous file with comments | « LayoutTests/svg/custom/use-nested-children-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698