| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann |
| 3 * <zimmermann@kde.org> | 3 * <zimmermann@kde.org> |
| 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Document& document, | 64 Document& document, |
| 65 ConstructionType constructionType) | 65 ConstructionType constructionType) |
| 66 : Element(tagName, &document, constructionType), | 66 : Element(tagName, &document, constructionType), |
| 67 m_SVGRareData(nullptr), | 67 m_SVGRareData(nullptr), |
| 68 m_className(SVGAnimatedString::create(this, HTMLNames::classAttr)) { | 68 m_className(SVGAnimatedString::create(this, HTMLNames::classAttr)) { |
| 69 addToPropertyMap(m_className); | 69 addToPropertyMap(m_className); |
| 70 setHasCustomStyleCallbacks(); | 70 setHasCustomStyleCallbacks(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 SVGElement::~SVGElement() { | 73 SVGElement::~SVGElement() { |
| 74 ASSERT(isConnected() || !hasRelativeLengths()); | 74 DCHECK(isConnected() || !hasRelativeLengths()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void SVGElement::detachLayoutTree(const AttachContext& context) { | 77 void SVGElement::detachLayoutTree(const AttachContext& context) { |
| 78 Element::detachLayoutTree(context); | 78 Element::detachLayoutTree(context); |
| 79 if (SVGElement* element = correspondingElement()) | 79 if (SVGElement* element = correspondingElement()) |
| 80 element->removeInstanceMapping(this); | 80 element->removeInstanceMapping(this); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SVGElement::attachLayoutTree(const AttachContext& context) { | 83 void SVGElement::attachLayoutTree(const AttachContext& context) { |
| 84 Element::attachLayoutTree(context); | 84 Element::attachLayoutTree(context); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 void SVGElement::removedFrom(ContainerNode* rootParent) { | 388 void SVGElement::removedFrom(ContainerNode* rootParent) { |
| 389 bool wasInDocument = rootParent->isConnected(); | 389 bool wasInDocument = rootParent->isConnected(); |
| 390 | 390 |
| 391 if (wasInDocument && hasRelativeLengths()) { | 391 if (wasInDocument && hasRelativeLengths()) { |
| 392 // The root of the subtree being removed should take itself out from its | 392 // The root of the subtree being removed should take itself out from its |
| 393 // parent's relative length set. For the other nodes in the subtree we don't | 393 // parent's relative length set. For the other nodes in the subtree we don't |
| 394 // need to do anything: they will get their own removedFrom() notification | 394 // need to do anything: they will get their own removedFrom() notification |
| 395 // and just clear their sets. | 395 // and just clear their sets. |
| 396 if (rootParent->isSVGElement() && !parentNode()) { | 396 if (rootParent->isSVGElement() && !parentNode()) { |
| 397 ASSERT(toSVGElement(rootParent) | 397 DCHECK(toSVGElement(rootParent) |
| 398 ->m_elementsWithRelativeLengths.contains(this)); | 398 ->m_elementsWithRelativeLengths.contains(this)); |
| 399 toSVGElement(rootParent)->updateRelativeLengthsInformation(false, this); | 399 toSVGElement(rootParent)->updateRelativeLengthsInformation(false, this); |
| 400 } | 400 } |
| 401 | 401 |
| 402 m_elementsWithRelativeLengths.clear(); | 402 m_elementsWithRelativeLengths.clear(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 SECURITY_DCHECK( | 405 SECURITY_DCHECK( |
| 406 !rootParent->isSVGElement() || | 406 !rootParent->isSVGElement() || |
| 407 !toSVGElement(rootParent)->m_elementsWithRelativeLengths.contains(this)); | 407 !toSVGElement(rootParent)->m_elementsWithRelativeLengths.contains(this)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 &text_renderingAttr, | 489 &text_renderingAttr, |
| 490 &transform_originAttr, | 490 &transform_originAttr, |
| 491 &unicode_bidiAttr, | 491 &unicode_bidiAttr, |
| 492 &vector_effectAttr, | 492 &vector_effectAttr, |
| 493 &visibilityAttr, | 493 &visibilityAttr, |
| 494 &word_spacingAttr, | 494 &word_spacingAttr, |
| 495 &writing_modeAttr, | 495 &writing_modeAttr, |
| 496 }; | 496 }; |
| 497 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrNames); i++) { | 497 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrNames); i++) { |
| 498 CSSPropertyID propertyId = cssPropertyID(attrNames[i]->localName()); | 498 CSSPropertyID propertyId = cssPropertyID(attrNames[i]->localName()); |
| 499 ASSERT(propertyId > 0); | 499 DCHECK_GT(propertyId, 0); |
| 500 propertyNameToIdMap->set(attrNames[i]->localName().impl(), propertyId); | 500 propertyNameToIdMap->set(attrNames[i]->localName().impl(), propertyId); |
| 501 } | 501 } |
| 502 } | 502 } |
| 503 | 503 |
| 504 return propertyNameToIdMap->at(attrName.localName().impl()); | 504 return propertyNameToIdMap->at(attrName.localName().impl()); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths, | 507 void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths, |
| 508 SVGElement* clientElement) { | 508 SVGElement* clientElement) { |
| 509 ASSERT(clientElement); | 509 DCHECK(clientElement); |
| 510 | 510 |
| 511 // If we're not yet in a document, this function will be called again from | 511 // If we're not yet in a document, this function will be called again from |
| 512 // insertedInto(). Do nothing now. | 512 // insertedInto(). Do nothing now. |
| 513 if (!isConnected()) | 513 if (!isConnected()) |
| 514 return; | 514 return; |
| 515 | 515 |
| 516 // An element wants to notify us that its own relative lengths state changed. | 516 // An element wants to notify us that its own relative lengths state changed. |
| 517 // Register it in the relative length map, and register us in the parent | 517 // Register it in the relative length map, and register us in the parent |
| 518 // relative length map. Register the parent in the grandparents map, etc. | 518 // relative length map. Register the parent in the grandparents map, etc. |
| 519 // Repeat procedure until the root of the SVG tree. | 519 // Repeat procedure until the root of the SVG tree. |
| 520 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) { | 520 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) { |
| 521 if (!currentNode.isSVGElement()) | 521 if (!currentNode.isSVGElement()) |
| 522 break; | 522 break; |
| 523 SVGElement& currentElement = toSVGElement(currentNode); | 523 SVGElement& currentElement = toSVGElement(currentNode); |
| 524 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation); | 524 #if DCHECK_IS_ON() |
| 525 DCHECK(!currentElement.m_inRelativeLengthClientsInvalidation); |
| 526 #endif |
| 525 | 527 |
| 526 bool hadRelativeLengths = currentElement.hasRelativeLengths(); | 528 bool hadRelativeLengths = currentElement.hasRelativeLengths(); |
| 527 if (clientHasRelativeLengths) | 529 if (clientHasRelativeLengths) |
| 528 currentElement.m_elementsWithRelativeLengths.insert(clientElement); | 530 currentElement.m_elementsWithRelativeLengths.insert(clientElement); |
| 529 else | 531 else |
| 530 currentElement.m_elementsWithRelativeLengths.erase(clientElement); | 532 currentElement.m_elementsWithRelativeLengths.erase(clientElement); |
| 531 | 533 |
| 532 // If the relative length state hasn't changed, we can stop propagating the | 534 // If the relative length state hasn't changed, we can stop propagating the |
| 533 // notification. | 535 // notification. |
| 534 if (hadRelativeLengths == currentElement.hasRelativeLengths()) | 536 if (hadRelativeLengths == currentElement.hasRelativeLengths()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 548 svgExtensions.removeSVGRootWithRelativeLengthDescendents( | 550 svgExtensions.removeSVGRootWithRelativeLengthDescendents( |
| 549 toSVGSVGElement(clientElement)); | 551 toSVGSVGElement(clientElement)); |
| 550 } | 552 } |
| 551 } | 553 } |
| 552 | 554 |
| 553 void SVGElement::invalidateRelativeLengthClients( | 555 void SVGElement::invalidateRelativeLengthClients( |
| 554 SubtreeLayoutScope* layoutScope) { | 556 SubtreeLayoutScope* layoutScope) { |
| 555 if (!isConnected()) | 557 if (!isConnected()) |
| 556 return; | 558 return; |
| 557 | 559 |
| 558 ASSERT(!m_inRelativeLengthClientsInvalidation); | |
| 559 #if DCHECK_IS_ON() | 560 #if DCHECK_IS_ON() |
| 561 DCHECK(!m_inRelativeLengthClientsInvalidation); |
| 560 AutoReset<bool> inRelativeLengthClientsInvalidationChange( | 562 AutoReset<bool> inRelativeLengthClientsInvalidationChange( |
| 561 &m_inRelativeLengthClientsInvalidation, true); | 563 &m_inRelativeLengthClientsInvalidation, true); |
| 562 #endif | 564 #endif |
| 563 | 565 |
| 564 if (LayoutObject* layoutObject = this->layoutObject()) { | 566 if (LayoutObject* layoutObject = this->layoutObject()) { |
| 565 if (hasRelativeLengths() && layoutObject->isSVGResourceContainer()) | 567 if (hasRelativeLengths() && layoutObject->isSVGResourceContainer()) |
| 566 toLayoutSVGResourceContainer(layoutObject) | 568 toLayoutSVGResourceContainer(layoutObject) |
| 567 ->invalidateCacheAndMarkForLayout(layoutScope); | 569 ->invalidateCacheAndMarkForLayout(layoutScope); |
| 568 else if (selfHasRelativeLengths()) | 570 else if (selfHasRelativeLengths()) |
| 569 layoutObject->setNeedsLayoutAndFullPaintInvalidation( | 571 layoutObject->setNeedsLayoutAndFullPaintInvalidation( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 597 if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(*n)) | 599 if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(*n)) |
| 598 return toSVGElement(n); | 600 return toSVGElement(n); |
| 599 | 601 |
| 600 n = n->parentOrShadowHostNode(); | 602 n = n->parentOrShadowHostNode(); |
| 601 } | 603 } |
| 602 | 604 |
| 603 return nullptr; | 605 return nullptr; |
| 604 } | 606 } |
| 605 | 607 |
| 606 void SVGElement::mapInstanceToElement(SVGElement* instance) { | 608 void SVGElement::mapInstanceToElement(SVGElement* instance) { |
| 607 ASSERT(instance); | 609 DCHECK(instance); |
| 608 ASSERT(instance->inUseShadowTree()); | 610 DCHECK(instance->inUseShadowTree()); |
| 609 | 611 |
| 610 HeapHashSet<WeakMember<SVGElement>>& instances = | 612 HeapHashSet<WeakMember<SVGElement>>& instances = |
| 611 ensureSVGRareData()->elementInstances(); | 613 ensureSVGRareData()->elementInstances(); |
| 612 ASSERT(!instances.contains(instance)); | 614 DCHECK(!instances.contains(instance)); |
| 613 | 615 |
| 614 instances.insert(instance); | 616 instances.insert(instance); |
| 615 } | 617 } |
| 616 | 618 |
| 617 void SVGElement::removeInstanceMapping(SVGElement* instance) { | 619 void SVGElement::removeInstanceMapping(SVGElement* instance) { |
| 618 ASSERT(instance); | 620 DCHECK(instance); |
| 619 ASSERT(instance->inUseShadowTree()); | 621 DCHECK(instance->inUseShadowTree()); |
| 620 | 622 |
| 621 if (!hasSVGRareData()) | 623 if (!hasSVGRareData()) |
| 622 return; | 624 return; |
| 623 | 625 |
| 624 HeapHashSet<WeakMember<SVGElement>>& instances = | 626 HeapHashSet<WeakMember<SVGElement>>& instances = |
| 625 svgRareData()->elementInstances(); | 627 svgRareData()->elementInstances(); |
| 626 | 628 |
| 627 instances.erase(instance); | 629 instances.erase(instance); |
| 628 } | 630 } |
| 629 | 631 |
| 630 static HeapHashSet<WeakMember<SVGElement>>& emptyInstances() { | 632 static HeapHashSet<WeakMember<SVGElement>>& emptyInstances() { |
| 631 DEFINE_STATIC_LOCAL(HeapHashSet<WeakMember<SVGElement>>, emptyInstances, | 633 DEFINE_STATIC_LOCAL(HeapHashSet<WeakMember<SVGElement>>, emptyInstances, |
| 632 (new HeapHashSet<WeakMember<SVGElement>>)); | 634 (new HeapHashSet<WeakMember<SVGElement>>)); |
| 633 return emptyInstances; | 635 return emptyInstances; |
| 634 } | 636 } |
| 635 | 637 |
| 636 const HeapHashSet<WeakMember<SVGElement>>& SVGElement::instancesForElement() | 638 const HeapHashSet<WeakMember<SVGElement>>& SVGElement::instancesForElement() |
| 637 const { | 639 const { |
| 638 if (!hasSVGRareData()) | 640 if (!hasSVGRareData()) |
| 639 return emptyInstances(); | 641 return emptyInstances(); |
| 640 return svgRareData()->elementInstances(); | 642 return svgRareData()->elementInstances(); |
| 641 } | 643 } |
| 642 | 644 |
| 643 SVGElement* SVGElement::correspondingElement() const { | 645 SVGElement* SVGElement::correspondingElement() const { |
| 644 ASSERT(!hasSVGRareData() || !svgRareData()->correspondingElement() || | 646 DCHECK(!hasSVGRareData() || !svgRareData()->correspondingElement() || |
| 645 containingShadowRoot()); | 647 containingShadowRoot()); |
| 646 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0; | 648 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0; |
| 647 } | 649 } |
| 648 | 650 |
| 649 SVGUseElement* SVGElement::correspondingUseElement() const { | 651 SVGUseElement* SVGElement::correspondingUseElement() const { |
| 650 if (ShadowRoot* root = containingShadowRoot()) { | 652 if (ShadowRoot* root = containingShadowRoot()) { |
| 651 if (isSVGUseElement(root->host()) && | 653 if (isSVGUseElement(root->host()) && |
| 652 (root->type() == ShadowRootType::UserAgent)) | 654 (root->type() == ShadowRootType::UserAgent)) |
| 653 return &toSVGUseElement(root->host()); | 655 return &toSVGUseElement(root->host()); |
| 654 } | 656 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 child = Traversal<SVGElement>::nextSibling(*child)) { | 817 child = Traversal<SVGElement>::nextSibling(*child)) { |
| 816 if (!child->haveLoadedRequiredResources()) | 818 if (!child->haveLoadedRequiredResources()) |
| 817 return false; | 819 return false; |
| 818 } | 820 } |
| 819 return true; | 821 return true; |
| 820 } | 822 } |
| 821 | 823 |
| 822 static inline void collectInstancesForSVGElement( | 824 static inline void collectInstancesForSVGElement( |
| 823 SVGElement* element, | 825 SVGElement* element, |
| 824 HeapHashSet<WeakMember<SVGElement>>& instances) { | 826 HeapHashSet<WeakMember<SVGElement>>& instances) { |
| 825 ASSERT(element); | 827 DCHECK(element); |
| 826 if (element->containingShadowRoot()) | 828 if (element->containingShadowRoot()) |
| 827 return; | 829 return; |
| 828 | 830 |
| 829 ASSERT(!element->instanceUpdatesBlocked()); | 831 DCHECK(!element->instanceUpdatesBlocked()); |
| 830 | 832 |
| 831 instances = element->instancesForElement(); | 833 instances = element->instancesForElement(); |
| 832 } | 834 } |
| 833 | 835 |
| 834 void SVGElement::addedEventListener( | 836 void SVGElement::addedEventListener( |
| 835 const AtomicString& eventType, | 837 const AtomicString& eventType, |
| 836 RegisteredEventListener& registeredListener) { | 838 RegisteredEventListener& registeredListener) { |
| 837 // Add event listener to regular DOM element | 839 // Add event listener to regular DOM element |
| 838 Node::addedEventListener(eventType, registeredListener); | 840 Node::addedEventListener(eventType, registeredListener); |
| 839 | 841 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 853 const AtomicString& eventType, | 855 const AtomicString& eventType, |
| 854 const RegisteredEventListener& registeredListener) { | 856 const RegisteredEventListener& registeredListener) { |
| 855 Node::removedEventListener(eventType, registeredListener); | 857 Node::removedEventListener(eventType, registeredListener); |
| 856 | 858 |
| 857 // Remove event listener from all shadow tree DOM element instances | 859 // Remove event listener from all shadow tree DOM element instances |
| 858 HeapHashSet<WeakMember<SVGElement>> instances; | 860 HeapHashSet<WeakMember<SVGElement>> instances; |
| 859 collectInstancesForSVGElement(this, instances); | 861 collectInstancesForSVGElement(this, instances); |
| 860 EventListenerOptions options = registeredListener.options(); | 862 EventListenerOptions options = registeredListener.options(); |
| 861 const EventListener* listener = registeredListener.listener(); | 863 const EventListener* listener = registeredListener.listener(); |
| 862 for (SVGElement* shadowTreeElement : instances) { | 864 for (SVGElement* shadowTreeElement : instances) { |
| 863 ASSERT(shadowTreeElement); | 865 DCHECK(shadowTreeElement); |
| 864 | 866 |
| 865 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener, | 867 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener, |
| 866 options); | 868 options); |
| 867 } | 869 } |
| 868 } | 870 } |
| 869 | 871 |
| 870 static bool hasLoadListener(Element* element) { | 872 static bool hasLoadListener(Element* element) { |
| 871 if (element->hasEventListeners(EventTypeNames::load)) | 873 if (element->hasEventListeners(EventTypeNames::load)) |
| 872 return true; | 874 return true; |
| 873 | 875 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 | 1069 |
| 1068 bool SVGElement::hasFocusEventListeners() const { | 1070 bool SVGElement::hasFocusEventListeners() const { |
| 1069 return hasEventListeners(EventTypeNames::focusin) || | 1071 return hasEventListeners(EventTypeNames::focusin) || |
| 1070 hasEventListeners(EventTypeNames::focusout) || | 1072 hasEventListeners(EventTypeNames::focusout) || |
| 1071 hasEventListeners(EventTypeNames::focus) || | 1073 hasEventListeners(EventTypeNames::focus) || |
| 1072 hasEventListeners(EventTypeNames::blur); | 1074 hasEventListeners(EventTypeNames::blur); |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 void SVGElement::markForLayoutAndParentResourceInvalidation( | 1077 void SVGElement::markForLayoutAndParentResourceInvalidation( |
| 1076 LayoutObject* layoutObject) { | 1078 LayoutObject* layoutObject) { |
| 1077 ASSERT(layoutObject); | 1079 DCHECK(layoutObject); |
| 1078 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation( | 1080 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation( |
| 1079 layoutObject, true); | 1081 layoutObject, true); |
| 1080 } | 1082 } |
| 1081 | 1083 |
| 1082 void SVGElement::invalidateInstances() { | 1084 void SVGElement::invalidateInstances() { |
| 1083 if (instanceUpdatesBlocked()) | 1085 if (instanceUpdatesBlocked()) |
| 1084 return; | 1086 return; |
| 1085 | 1087 |
| 1086 const HeapHashSet<WeakMember<SVGElement>>& set = instancesForElement(); | 1088 const HeapHashSet<WeakMember<SVGElement>>& set = instancesForElement(); |
| 1087 if (set.isEmpty()) | 1089 if (set.isEmpty()) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 return &ensureSVGRareData()->ensureElementProxySet(); | 1238 return &ensureSVGRareData()->ensureElementProxySet(); |
| 1237 } | 1239 } |
| 1238 | 1240 |
| 1239 SVGElementSet* SVGElement::setOfIncomingReferences() const { | 1241 SVGElementSet* SVGElement::setOfIncomingReferences() const { |
| 1240 if (!hasSVGRareData()) | 1242 if (!hasSVGRareData()) |
| 1241 return nullptr; | 1243 return nullptr; |
| 1242 return &svgRareData()->incomingReferences(); | 1244 return &svgRareData()->incomingReferences(); |
| 1243 } | 1245 } |
| 1244 | 1246 |
| 1245 void SVGElement::addReferenceTo(SVGElement* targetElement) { | 1247 void SVGElement::addReferenceTo(SVGElement* targetElement) { |
| 1246 ASSERT(targetElement); | 1248 DCHECK(targetElement); |
| 1247 | 1249 |
| 1248 ensureSVGRareData()->outgoingReferences().insert(targetElement); | 1250 ensureSVGRareData()->outgoingReferences().insert(targetElement); |
| 1249 targetElement->ensureSVGRareData()->incomingReferences().insert(this); | 1251 targetElement->ensureSVGRareData()->incomingReferences().insert(this); |
| 1250 } | 1252 } |
| 1251 | 1253 |
| 1252 void SVGElement::rebuildAllIncomingReferences() { | 1254 void SVGElement::rebuildAllIncomingReferences() { |
| 1253 if (!hasSVGRareData()) | 1255 if (!hasSVGRareData()) |
| 1254 return; | 1256 return; |
| 1255 | 1257 |
| 1256 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); | 1258 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1267 sourceElement->svgAttributeChanged(SVGNames::hrefAttr); | 1269 sourceElement->svgAttributeChanged(SVGNames::hrefAttr); |
| 1268 } | 1270 } |
| 1269 } | 1271 } |
| 1270 | 1272 |
| 1271 void SVGElement::removeAllIncomingReferences() { | 1273 void SVGElement::removeAllIncomingReferences() { |
| 1272 if (!hasSVGRareData()) | 1274 if (!hasSVGRareData()) |
| 1273 return; | 1275 return; |
| 1274 | 1276 |
| 1275 SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); | 1277 SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); |
| 1276 for (SVGElement* sourceElement : incomingReferences) { | 1278 for (SVGElement* sourceElement : incomingReferences) { |
| 1277 ASSERT(sourceElement->hasSVGRareData()); | 1279 DCHECK(sourceElement->hasSVGRareData()); |
| 1278 sourceElement->ensureSVGRareData()->outgoingReferences().erase(this); | 1280 sourceElement->ensureSVGRareData()->outgoingReferences().erase(this); |
| 1279 } | 1281 } |
| 1280 incomingReferences.clear(); | 1282 incomingReferences.clear(); |
| 1281 } | 1283 } |
| 1282 | 1284 |
| 1283 void SVGElement::removeAllOutgoingReferences() { | 1285 void SVGElement::removeAllOutgoingReferences() { |
| 1284 if (!hasSVGRareData()) | 1286 if (!hasSVGRareData()) |
| 1285 return; | 1287 return; |
| 1286 | 1288 |
| 1287 SVGElementSet& outgoingReferences = svgRareData()->outgoingReferences(); | 1289 SVGElementSet& outgoingReferences = svgRareData()->outgoingReferences(); |
| 1288 for (SVGElement* targetElement : outgoingReferences) { | 1290 for (SVGElement* targetElement : outgoingReferences) { |
| 1289 ASSERT(targetElement->hasSVGRareData()); | 1291 DCHECK(targetElement->hasSVGRareData()); |
| 1290 targetElement->ensureSVGRareData()->incomingReferences().erase(this); | 1292 targetElement->ensureSVGRareData()->incomingReferences().erase(this); |
| 1291 } | 1293 } |
| 1292 outgoingReferences.clear(); | 1294 outgoingReferences.clear(); |
| 1293 } | 1295 } |
| 1294 | 1296 |
| 1295 DEFINE_TRACE(SVGElement) { | 1297 DEFINE_TRACE(SVGElement) { |
| 1296 visitor->trace(m_elementsWithRelativeLengths); | 1298 visitor->trace(m_elementsWithRelativeLengths); |
| 1297 visitor->trace(m_attributeToPropertyMap); | 1299 visitor->trace(m_attributeToPropertyMap); |
| 1298 visitor->trace(m_SVGRareData); | 1300 visitor->trace(m_SVGRareData); |
| 1299 visitor->trace(m_className); | 1301 visitor->trace(m_className); |
| 1300 Element::trace(visitor); | 1302 Element::trace(visitor); |
| 1301 } | 1303 } |
| 1302 | 1304 |
| 1303 const AtomicString& SVGElement::eventParameterName() { | 1305 const AtomicString& SVGElement::eventParameterName() { |
| 1304 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1306 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 1305 return evtString; | 1307 return evtString; |
| 1306 } | 1308 } |
| 1307 | 1309 |
| 1308 } // namespace blink | 1310 } // namespace blink |
| OLD | NEW |