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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGUseElement.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 28 matching lines...) Expand all
39 #include "core/svg/SVGGElement.h" 39 #include "core/svg/SVGGElement.h"
40 #include "core/svg/SVGLengthContext.h" 40 #include "core/svg/SVGLengthContext.h"
41 #include "core/svg/SVGSVGElement.h" 41 #include "core/svg/SVGSVGElement.h"
42 #include "core/xml/parser/XMLDocumentParser.h" 42 #include "core/xml/parser/XMLDocumentParser.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 static SVGUseEventSender& svgUseLoadEventSender() 47 static SVGUseEventSender& svgUseLoadEventSender()
48 { 48 {
49 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SVGUseEventSender>, sharedLoadEve ntSender, (SVGUseEventSender::create(EventTypeNames::load))); 49 DEFINE_STATIC_LOCAL(Persistent<SVGUseEventSender>, sharedLoadEventSender, (S VGUseEventSender::create(EventTypeNames::load)));
50 return *sharedLoadEventSender; 50 return *sharedLoadEventSender;
51 } 51 }
52 52
53 inline SVGUseElement::SVGUseElement(Document& document) 53 inline SVGUseElement::SVGUseElement(Document& document)
54 : SVGGraphicsElement(SVGNames::useTag, document) 54 : SVGGraphicsElement(SVGNames::useTag, document)
55 , SVGURIReference(this) 55 , SVGURIReference(this)
56 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width))) 56 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width)))
57 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height))) 57 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height)))
58 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width))) 58 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width)))
59 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(SVGLengthMode::Height))) 59 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(SVGLengthMode::Height)))
60 , m_haveFiredLoadEvent(false) 60 , m_haveFiredLoadEvent(false)
61 , m_needsShadowTreeRecreation(false) 61 , m_needsShadowTreeRecreation(false)
62 { 62 {
63 ASSERT(hasCustomStyleCallbacks()); 63 ASSERT(hasCustomStyleCallbacks());
64 64
65 addToPropertyMap(m_x); 65 addToPropertyMap(m_x);
66 addToPropertyMap(m_y); 66 addToPropertyMap(m_y);
67 addToPropertyMap(m_width); 67 addToPropertyMap(m_width);
68 addToPropertyMap(m_height); 68 addToPropertyMap(m_height);
69 69
70 #if ENABLE(OILPAN) 70 #if ENABLE(OILPAN)
71 ThreadState::current()->registerPreFinalizer(this); 71 ThreadState::current()->registerPreFinalizer(this);
72 #endif 72 #endif
73 } 73 }
74 74
75 PassRefPtrWillBeRawPtr<SVGUseElement> SVGUseElement::create(Document& document) 75 RawPtr<SVGUseElement> SVGUseElement::create(Document& document)
76 { 76 {
77 // Always build a user agent #shadow-root for SVGUseElement. 77 // Always build a user agent #shadow-root for SVGUseElement.
78 RefPtrWillBeRawPtr<SVGUseElement> use = adoptRefWillBeNoop(new SVGUseElement (document)); 78 RawPtr<SVGUseElement> use = (new SVGUseElement(document));
79 use->ensureUserAgentShadowRoot(); 79 use->ensureUserAgentShadowRoot();
80 return use.release(); 80 return use.release();
81 } 81 }
82 82
83 SVGUseElement::~SVGUseElement() 83 SVGUseElement::~SVGUseElement()
84 { 84 {
85 #if !ENABLE(OILPAN) 85 #if !ENABLE(OILPAN)
86 clearShadowTree(); 86 clearShadowTree();
87 cancelShadowTreeRecreation(); 87 cancelShadowTreeRecreation();
88 svgUseLoadEventSender().cancelEvent(this); 88 svgUseLoadEventSender().cancelEvent(this);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 if (target->isSVGElement()) { 366 if (target->isSVGElement()) {
367 buildShadowAndInstanceTree(toSVGElement(target)); 367 buildShadowAndInstanceTree(toSVGElement(target));
368 invalidateDependentShadowTrees(); 368 invalidateDependentShadowTrees();
369 } 369 }
370 370
371 ASSERT(!m_needsShadowTreeRecreation); 371 ASSERT(!m_needsShadowTreeRecreation);
372 } 372 }
373 373
374 static PassRefPtrWillBeRawPtr<Node> cloneNodeAndAssociate(Node& toClone) 374 static RawPtr<Node> cloneNodeAndAssociate(Node& toClone)
375 { 375 {
376 RefPtrWillBeRawPtr<Node> clone = toClone.cloneNode(false); 376 RawPtr<Node> clone = toClone.cloneNode(false);
377 if (!clone->isSVGElement()) 377 if (!clone->isSVGElement())
378 return clone.release(); 378 return clone.release();
379 379
380 SVGElement& svgElement = toSVGElement(toClone); 380 SVGElement& svgElement = toSVGElement(toClone);
381 ASSERT(!svgElement.correspondingElement()); 381 ASSERT(!svgElement.correspondingElement());
382 toSVGElement(clone.get())->setCorrespondingElement(&svgElement); 382 toSVGElement(clone.get())->setCorrespondingElement(&svgElement);
383 if (EventTargetData* data = toClone.eventTargetData()) 383 if (EventTargetData* data = toClone.eventTargetData())
384 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(cl one.get()); 384 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(cl one.get());
385 TrackExceptionState exceptionState; 385 TrackExceptionState exceptionState;
386 for (RefPtrWillBeRawPtr<Node> node = toClone.firstChild(); node && !exceptio nState.hadException(); node = node->nextSibling()) 386 for (RawPtr<Node> node = toClone.firstChild(); node && !exceptionState.hadEx ception(); node = node->nextSibling())
387 clone->appendChild(cloneNodeAndAssociate(*node), exceptionState); 387 clone->appendChild(cloneNodeAndAssociate(*node), exceptionState);
388 return clone.release(); 388 return clone.release();
389 } 389 }
390 390
391 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) 391 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
392 { 392 {
393 ASSERT(!m_targetElementInstance); 393 ASSERT(!m_targetElementInstance);
394 ASSERT(!m_needsShadowTreeRecreation); 394 ASSERT(!m_needsShadowTreeRecreation);
395 395
396 // <use> creates a "user agent" shadow root. Do not build the shadow/instanc e tree for <use> 396 // <use> creates a "user agent" shadow root. Do not build the shadow/instanc e tree for <use>
397 // elements living in a user agent shadow tree because they will get expande d in a second 397 // elements living in a user agent shadow tree because they will get expande d in a second
398 // pass -- see expandUseElementsInShadowTree(). 398 // pass -- see expandUseElementsInShadowTree().
399 if (inUseShadowTree()) 399 if (inUseShadowTree())
400 return; 400 return;
401 401
402 // Do not allow self-referencing. 402 // Do not allow self-referencing.
403 // 'target' may be null, if it's a non SVG namespaced element. 403 // 'target' may be null, if it's a non SVG namespaced element.
404 if (!target || target == this || isDisallowedElement(target)) 404 if (!target || target == this || isDisallowedElement(target))
405 return; 405 return;
406 406
407 // Set up root SVG element in shadow tree. 407 // Set up root SVG element in shadow tree.
408 RefPtrWillBeRawPtr<Element> newChild = target->cloneElementWithoutChildren() ; 408 RawPtr<Element> newChild = target->cloneElementWithoutChildren();
409 m_targetElementInstance = toSVGElement(newChild.get()); 409 m_targetElementInstance = toSVGElement(newChild.get());
410 ShadowRoot* shadowTreeRootElement = userAgentShadowRoot(); 410 ShadowRoot* shadowTreeRootElement = userAgentShadowRoot();
411 shadowTreeRootElement->appendChild(newChild.release()); 411 shadowTreeRootElement->appendChild(newChild.release());
412 412
413 // Clone the target subtree into the shadow tree, not handling <use> and <sy mbol> yet. 413 // Clone the target subtree into the shadow tree, not handling <use> and <sy mbol> yet.
414 414
415 // SVG specification does not say a word about <use> & cycles. My view on th is is: just ignore it! 415 // SVG specification does not say a word about <use> & cycles. My view on th is is: just ignore it!
416 // Non-appearing <use> content is easier to debug, then half-appearing conte nt. 416 // Non-appearing <use> content is easier to debug, then half-appearing conte nt.
417 if (!buildShadowTree(target, m_targetElementInstance.get(), false)) { 417 if (!buildShadowTree(target, m_targetElementInstance.get(), false)) {
418 clearShadowTree(); 418 clearShadowTree();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 foundUse = true; 520 foundUse = true;
521 } 521 }
522 } else if (isDisallowedElement(target)) { 522 } else if (isDisallowedElement(target)) {
523 return false; 523 return false;
524 } 524 }
525 525
526 targetInstance->setCorrespondingElement(target); 526 targetInstance->setCorrespondingElement(target);
527 if (EventTargetData* data = target->eventTargetData()) 527 if (EventTargetData* data = target->eventTargetData())
528 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(ta rgetInstance); 528 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(ta rgetInstance);
529 529
530 for (RefPtrWillBeRawPtr<Node> child = target->firstChild(); child; child = c hild->nextSibling()) { 530 for (RawPtr<Node> child = target->firstChild(); child; child = child->nextSi bling()) {
531 // Skip any disallowed element. 531 // Skip any disallowed element.
532 if (isDisallowedElement(child.get())) 532 if (isDisallowedElement(child.get()))
533 continue; 533 continue;
534 534
535 RefPtrWillBeRawPtr<Node> newChild = child->cloneNode(false); 535 RawPtr<Node> newChild = child->cloneNode(false);
536 targetInstance->appendChild(newChild.get()); 536 targetInstance->appendChild(newChild.get());
537 if (newChild->isSVGElement()) { 537 if (newChild->isSVGElement()) {
538 // Enter recursion, appending new instance tree nodes to the "instan ce" object. 538 // Enter recursion, appending new instance tree nodes to the "instan ce" object.
539 if (!buildShadowTree(toSVGElement(child), toSVGElement(newChild), fo undUse)) 539 if (!buildShadowTree(toSVGElement(child), toSVGElement(newChild), fo undUse))
540 return false; 540 return false;
541 } 541 }
542 } 542 }
543 return true; 543 return true;
544 } 544 }
545 545
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 ASSERT(!use->resourceIsStillLoading()); 601 ASSERT(!use->resourceIsStillLoading());
602 602
603 SVGElement* target = 0; 603 SVGElement* target = 0;
604 if (hasCycleUseReferencing(toSVGUseElement(use->correspondingElement()), use, target)) 604 if (hasCycleUseReferencing(toSVGUseElement(use->correspondingElement()), use, target))
605 return false; 605 return false;
606 606
607 if (target && isDisallowedElement(target)) 607 if (target && isDisallowedElement(target))
608 return false; 608 return false;
609 // Don't ASSERT(target) here, it may be "pending", too. 609 // Don't ASSERT(target) here, it may be "pending", too.
610 // Setup sub-shadow tree root node 610 // Setup sub-shadow tree root node
611 RefPtrWillBeRawPtr<SVGGElement> cloneParent = SVGGElement::create(refere ncedScope()->document()); 611 RawPtr<SVGGElement> cloneParent = SVGGElement::create(referencedScope()- >document());
612 cloneParent->setCorrespondingElement(use->correspondingElement()); 612 cloneParent->setCorrespondingElement(use->correspondingElement());
613 613
614 // Move already cloned elements to the new <g> element 614 // Move already cloned elements to the new <g> element
615 for (RefPtrWillBeRawPtr<Node> child = use->firstChild(); child; ) { 615 for (RawPtr<Node> child = use->firstChild(); child; ) {
616 RefPtrWillBeRawPtr<Node> nextChild = child->nextSibling(); 616 RawPtr<Node> nextChild = child->nextSibling();
617 cloneParent->appendChild(child); 617 cloneParent->appendChild(child);
618 child = nextChild.release(); 618 child = nextChild.release();
619 } 619 }
620 620
621 // Spec: In the generated content, the 'use' will be replaced by 'g', wh ere all attributes from the 621 // Spec: In the generated content, the 'use' will be replaced by 'g', wh ere all attributes from the
622 // 'use' element except for x, y, width, height and xlink:href are trans ferred to the generated 'g' element. 622 // 'use' element except for x, y, width, height and xlink:href are trans ferred to the generated 'g' element.
623 transferUseAttributesToReplacedElement(use, cloneParent.get()); 623 transferUseAttributesToReplacedElement(use, cloneParent.get());
624 624
625 if (target) { 625 if (target) {
626 RefPtrWillBeRawPtr<Node> newChild = cloneNodeAndAssociate(*target); 626 RawPtr<Node> newChild = cloneNodeAndAssociate(*target);
627 ASSERT(newChild->isSVGElement()); 627 ASSERT(newChild->isSVGElement());
628 transferUseWidthAndHeightIfNeeded(*use, toSVGElement(newChild.get()) , *target); 628 transferUseWidthAndHeightIfNeeded(*use, toSVGElement(newChild.get()) , *target);
629 cloneParent->appendChild(newChild.release()); 629 cloneParent->appendChild(newChild.release());
630 } 630 }
631 631
632 // We don't walk the target tree element-by-element, and clone each elem ent, 632 // We don't walk the target tree element-by-element, and clone each elem ent,
633 // but instead use cloneElementWithChildren(). This is an optimization f or the common 633 // but instead use cloneElementWithChildren(). This is an optimization f or the common
634 // case where <use> doesn't contain disallowed elements (ie. <foreignObj ect>). 634 // case where <use> doesn't contain disallowed elements (ie. <foreignObj ect>).
635 // Though if there are disallowed elements in the subtree, we have to re move them. 635 // Though if there are disallowed elements in the subtree, we have to re move them.
636 // For instance: <use> on <g> containing <foreignObject> (indirect case) . 636 // For instance: <use> on <g> containing <foreignObject> (indirect case) .
637 if (subtreeContainsDisallowedElement(cloneParent.get())) 637 if (subtreeContainsDisallowedElement(cloneParent.get()))
638 removeDisallowedElementsFromSubtree(*cloneParent); 638 removeDisallowedElementsFromSubtree(*cloneParent);
639 639
640 RefPtrWillBeRawPtr<SVGElement> replacingElement(cloneParent.get()); 640 RawPtr<SVGElement> replacingElement(cloneParent.get());
641 641
642 // Replace <use> with referenced content. 642 // Replace <use> with referenced content.
643 ASSERT(use->parentNode()); 643 ASSERT(use->parentNode());
644 use->parentNode()->replaceChild(cloneParent.release(), use); 644 use->parentNode()->replaceChild(cloneParent.release(), use);
645 645
646 // Expand the siblings because the *element* is replaced and we will 646 // Expand the siblings because the *element* is replaced and we will
647 // lose the sibling chain when we are back from recursion. 647 // lose the sibling chain when we are back from recursion.
648 element = replacingElement.get(); 648 element = replacingElement.get();
649 for (RefPtrWillBeRawPtr<SVGElement> sibling = Traversal<SVGElement>::nex tSibling(*element); sibling; sibling = Traversal<SVGElement>::nextSibling(*sibli ng)) { 649 for (RawPtr<SVGElement> sibling = Traversal<SVGElement>::nextSibling(*el ement); sibling; sibling = Traversal<SVGElement>::nextSibling(*sibling)) {
650 if (!expandUseElementsInShadowTree(sibling.get())) 650 if (!expandUseElementsInShadowTree(sibling.get()))
651 return false; 651 return false;
652 } 652 }
653 } 653 }
654 654
655 for (RefPtrWillBeRawPtr<SVGElement> child = Traversal<SVGElement>::firstChil d(*element); child; child = Traversal<SVGElement>::nextSibling(*child)) { 655 for (RawPtr<SVGElement> child = Traversal<SVGElement>::firstChild(*element); child; child = Traversal<SVGElement>::nextSibling(*child)) {
656 if (!expandUseElementsInShadowTree(child.get())) 656 if (!expandUseElementsInShadowTree(child.get()))
657 return false; 657 return false;
658 } 658 }
659 return true; 659 return true;
660 } 660 }
661 661
662 void SVGUseElement::expandSymbolElementsInShadowTree(SVGElement* element) 662 void SVGUseElement::expandSymbolElementsInShadowTree(SVGElement* element)
663 { 663 {
664 ASSERT(element); 664 ASSERT(element);
665 if (isSVGSymbolElement(*element)) { 665 if (isSVGSymbolElement(*element)) {
666 // Spec: The referenced 'symbol' and its contents are deep-cloned into t he generated tree, 666 // Spec: The referenced 'symbol' and its contents are deep-cloned into t he generated tree,
667 // with the exception that the 'symbol' is replaced by an 'svg'. This ge nerated 'svg' will 667 // with the exception that the 'symbol' is replaced by an 'svg'. This ge nerated 'svg' will
668 // always have explicit values for attributes width and height. If attri butes width and/or 668 // always have explicit values for attributes width and height. If attri butes width and/or
669 // height are provided on the 'use' element, then these attributes will be transferred to 669 // height are provided on the 'use' element, then these attributes will be transferred to
670 // the generated 'svg'. If attributes width and/or height are not specif ied, the generated 670 // the generated 'svg'. If attributes width and/or height are not specif ied, the generated
671 // 'svg' element will use values of 100% for these attributes. 671 // 'svg' element will use values of 100% for these attributes.
672 ASSERT(referencedScope()); 672 ASSERT(referencedScope());
673 RefPtrWillBeRawPtr<SVGSVGElement> svgElement = SVGSVGElement::create(ref erencedScope()->document()); 673 RawPtr<SVGSVGElement> svgElement = SVGSVGElement::create(referencedScope ()->document());
674 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e lement. 674 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e lement.
675 svgElement->cloneDataFromElement(*element); 675 svgElement->cloneDataFromElement(*element);
676 svgElement->setCorrespondingElement(element->correspondingElement()); 676 svgElement->setCorrespondingElement(element->correspondingElement());
677 677
678 // Move already cloned elements to the new <svg> element 678 // Move already cloned elements to the new <svg> element
679 for (RefPtrWillBeRawPtr<Node> child = element->firstChild(); child; ) { 679 for (RawPtr<Node> child = element->firstChild(); child; ) {
680 RefPtrWillBeRawPtr<Node> nextChild = child->nextSibling(); 680 RawPtr<Node> nextChild = child->nextSibling();
681 svgElement->appendChild(child); 681 svgElement->appendChild(child);
682 child = nextChild.release(); 682 child = nextChild.release();
683 } 683 }
684 684
685 // We don't walk the target tree element-by-element, and clone each elem ent, 685 // We don't walk the target tree element-by-element, and clone each elem ent,
686 // but instead use cloneNode(deep=true). This is an optimization for the common 686 // but instead use cloneNode(deep=true). This is an optimization for the common
687 // case where <use> doesn't contain disallowed elements (ie. <foreignObj ect>). 687 // case where <use> doesn't contain disallowed elements (ie. <foreignObj ect>).
688 // Though if there are disallowed elements in the subtree, we have to re move them. 688 // Though if there are disallowed elements in the subtree, we have to re move them.
689 // For instance: <use> on <g> containing <foreignObject> (indirect case) . 689 // For instance: <use> on <g> containing <foreignObject> (indirect case) .
690 if (subtreeContainsDisallowedElement(svgElement.get())) 690 if (subtreeContainsDisallowedElement(svgElement.get()))
691 removeDisallowedElementsFromSubtree(*svgElement); 691 removeDisallowedElementsFromSubtree(*svgElement);
692 692
693 RefPtrWillBeRawPtr<SVGElement> replacingElement(svgElement.get()); 693 RawPtr<SVGElement> replacingElement(svgElement.get());
694 694
695 // Replace <symbol> with <svg>. 695 // Replace <symbol> with <svg>.
696 ASSERT(element->parentNode()); 696 ASSERT(element->parentNode());
697 element->parentNode()->replaceChild(svgElement.release(), element); 697 element->parentNode()->replaceChild(svgElement.release(), element);
698 698
699 // Expand the siblings because the *element* is replaced and we will 699 // Expand the siblings because the *element* is replaced and we will
700 // lose the sibling chain when we are back from recursion. 700 // lose the sibling chain when we are back from recursion.
701 element = replacingElement.get(); 701 element = replacingElement.get();
702 } 702 }
703 703
704 for (RefPtrWillBeRawPtr<SVGElement> child = Traversal<SVGElement>::firstChil d(*element); child; child = Traversal<SVGElement>::nextSibling(*child)) 704 for (RawPtr<SVGElement> child = Traversal<SVGElement>::firstChild(*element); child; child = Traversal<SVGElement>::nextSibling(*child))
705 expandSymbolElementsInShadowTree(child.get()); 705 expandSymbolElementsInShadowTree(child.get());
706 } 706 }
707 707
708 void SVGUseElement::invalidateShadowTree() 708 void SVGUseElement::invalidateShadowTree()
709 { 709 {
710 if (!inActiveDocument() || m_needsShadowTreeRecreation) 710 if (!inActiveDocument() || m_needsShadowTreeRecreation)
711 return; 711 return;
712 clearInstanceRoot(); 712 clearInstanceRoot();
713 scheduleShadowTreeRecreation(); 713 scheduleShadowTreeRecreation();
714 invalidateDependentShadowTrees(); 714 invalidateDependentShadowTrees();
715 } 715 }
716 716
717 void SVGUseElement::invalidateDependentShadowTrees() 717 void SVGUseElement::invalidateDependentShadowTrees()
718 { 718 {
719 // Recursively invalidate dependent <use> shadow trees 719 // Recursively invalidate dependent <use> shadow trees
720 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& rawInstances = instancesForElement(); 720 const HeapHashSet<WeakMember<SVGElement>>& rawInstances = instancesForElemen t();
721 WillBeHeapVector<RefPtrWillBeMember<SVGElement>> instances; 721 HeapVector<Member<SVGElement>> instances;
722 instances.appendRange(rawInstances.begin(), rawInstances.end()); 722 instances.appendRange(rawInstances.begin(), rawInstances.end());
723 for (auto& instance : instances) { 723 for (auto& instance : instances) {
724 if (RefPtrWillBeRawPtr<SVGUseElement> element = instance->correspondingU seElement()) { 724 if (RawPtr<SVGUseElement> element = instance->correspondingUseElement()) {
725 ASSERT(element->inDocument()); 725 ASSERT(element->inDocument());
726 element->invalidateShadowTree(); 726 element->invalidateShadowTree();
727 } 727 }
728 } 728 }
729 } 729 }
730 730
731 void SVGUseElement::transferUseAttributesToReplacedElement(SVGElement* from, SVG Element* to) const 731 void SVGUseElement::transferUseAttributesToReplacedElement(SVGElement* from, SVG Element* to) const
732 { 732 {
733 ASSERT(from); 733 ASSERT(from);
734 ASSERT(to); 734 ASSERT(to);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 812
813 bool SVGUseElement::instanceTreeIsLoading(const SVGElement* targetInstance) 813 bool SVGUseElement::instanceTreeIsLoading(const SVGElement* targetInstance)
814 { 814 {
815 for (const SVGElement* element = targetInstance; element; element = Traversa l<SVGElement>::next(*element, targetInstance)) { 815 for (const SVGElement* element = targetInstance; element; element = Traversa l<SVGElement>::next(*element, targetInstance)) {
816 if (isSVGUseElement(*element) && toSVGUseElement(*element).resourceIsSti llLoading()) 816 if (isSVGUseElement(*element) && toSVGUseElement(*element).resourceIsSti llLoading())
817 return true; 817 return true;
818 } 818 }
819 return false; 819 return false;
820 } 820 }
821 821
822 void SVGUseElement::setDocumentResource(PassRefPtrWillBeRawPtr<DocumentResource> resource) 822 void SVGUseElement::setDocumentResource(RawPtr<DocumentResource> resource)
823 { 823 {
824 if (m_resource == resource) 824 if (m_resource == resource)
825 return; 825 return;
826 826
827 if (m_resource) 827 if (m_resource)
828 m_resource->removeClient(this); 828 m_resource->removeClient(this);
829 829
830 m_resource = resource; 830 m_resource = resource;
831 if (m_resource) 831 if (m_resource)
832 m_resource->addClient(this); 832 m_resource->addClient(this);
833 } 833 }
834 834
835 } // namespace blink 835 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698