| OLD | NEW |
| 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, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 m_SVGRareData.clear(); | 100 m_SVGRareData.clear(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // With Oilpan, either removedFrom has been called or the document is dead | 103 // With Oilpan, either removedFrom has been called or the document is dead |
| 104 // as well and there is no reason to clear out the extensions. | 104 // as well and there is no reason to clear out the extensions. |
| 105 document().accessSVGExtensions().rebuildAllElementReferencesForTarget(this); | 105 document().accessSVGExtensions().rebuildAllElementReferencesForTarget(this); |
| 106 document().accessSVGExtensions().removeAllElementReferencesForTarget(this); | 106 document().accessSVGExtensions().removeAllElementReferencesForTarget(this); |
| 107 #endif | 107 #endif |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SVGElement::detach(const AttachContext& context) |
| 111 { |
| 112 Element::detach(context); |
| 113 if (SVGElement* element = correspondingElement()) |
| 114 element->removeInstanceMapping(this); |
| 115 } |
| 116 |
| 117 void SVGElement::attach(const AttachContext& context) |
| 118 { |
| 119 Element::attach(context); |
| 120 if (SVGElement* element = correspondingElement()) |
| 121 element->mapInstanceToElement(this); |
| 122 } |
| 123 |
| 110 short SVGElement::tabIndex() const | 124 short SVGElement::tabIndex() const |
| 111 { | 125 { |
| 112 if (supportsFocus()) | 126 if (supportsFocus()) |
| 113 return Element::tabIndex(); | 127 return Element::tabIndex(); |
| 114 return -1; | 128 return -1; |
| 115 } | 129 } |
| 116 | 130 |
| 117 void SVGElement::willRecalcStyle(StyleRecalcChange change) | 131 void SVGElement::willRecalcStyle(StyleRecalcChange change) |
| 118 { | 132 { |
| 119 if (!hasSVGRareData()) | 133 if (!hasSVGRareData()) |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 document().accessSVGExtensions().removeAllElementReferencesForTarget(thi
s); | 337 document().accessSVGExtensions().removeAllElementReferencesForTarget(thi
s); |
| 324 } | 338 } |
| 325 | 339 |
| 326 invalidateInstances(); | 340 invalidateInstances(); |
| 327 } | 341 } |
| 328 | 342 |
| 329 void SVGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node*
afterChange, int childCountDelta) | 343 void SVGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node*
afterChange, int childCountDelta) |
| 330 { | 344 { |
| 331 Element::childrenChanged(changedByParser, beforeChange, afterChange, childCo
untDelta); | 345 Element::childrenChanged(changedByParser, beforeChange, afterChange, childCo
untDelta); |
| 332 | 346 |
| 333 // Invalidate all SVGElementInstances associated with us. | 347 // Invalidate all instances associated with us. |
| 334 if (!changedByParser) | 348 if (!changedByParser) |
| 335 invalidateInstances(); | 349 invalidateInstances(); |
| 336 } | 350 } |
| 337 | 351 |
| 338 CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName&
attrName) | 352 CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName&
attrName) |
| 339 { | 353 { |
| 340 if (!attrName.namespaceURI().isNull()) | 354 if (!attrName.namespaceURI().isNull()) |
| 341 return CSSPropertyInvalid; | 355 return CSSPropertyInvalid; |
| 342 | 356 |
| 343 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; | 357 static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 ASSERT(!instances.contains(instance)); | 532 ASSERT(!instances.contains(instance)); |
| 519 | 533 |
| 520 instances.add(instance); | 534 instances.add(instance); |
| 521 } | 535 } |
| 522 | 536 |
| 523 void SVGElement::removeInstanceMapping(SVGElement* instance) | 537 void SVGElement::removeInstanceMapping(SVGElement* instance) |
| 524 { | 538 { |
| 525 ASSERT(instance); | 539 ASSERT(instance); |
| 526 ASSERT(instance->inUseShadowTree()); | 540 ASSERT(instance->inUseShadowTree()); |
| 527 | 541 |
| 542 if (!hasSVGRareData()) |
| 543 return; |
| 544 |
| 528 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareD
ata()->elementInstances(); | 545 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareD
ata()->elementInstances(); |
| 529 ASSERT(instances.contains(instance)); | 546 ASSERT(instances.contains(instance)); |
| 530 | 547 |
| 531 instances.remove(instance); | 548 instances.remove(instance); |
| 532 } | 549 } |
| 533 | 550 |
| 534 static WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& emptyInstances() | 551 static WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& emptyInstances() |
| 535 { | 552 { |
| 536 #if ENABLE(OILPAN) | 553 #if ENABLE(OILPAN) |
| 537 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<WeakMember<SVGElement> > >, empty
Instances, (new HeapHashSet<WeakMember<SVGElement> >)); | 554 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<WeakMember<SVGElement> > >, empty
Instances, (new HeapHashSet<WeakMember<SVGElement> >)); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = set.end(); | 1052 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = set.end(); |
| 1036 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = set.begin(); it != end; ++it) { | 1053 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = set.begin(); it != end; ++it) { |
| 1037 (*it)->setCorrespondingElement(0); | 1054 (*it)->setCorrespondingElement(0); |
| 1038 | 1055 |
| 1039 if (SVGUseElement* element = (*it)->correspondingUseElement()) { | 1056 if (SVGUseElement* element = (*it)->correspondingUseElement()) { |
| 1040 ASSERT(element->inDocument()); | 1057 ASSERT(element->inDocument()); |
| 1041 element->invalidateShadowTree(); | 1058 element->invalidateShadowTree(); |
| 1042 } | 1059 } |
| 1043 } | 1060 } |
| 1044 | 1061 |
| 1062 svgRareData()->elementInstances().clear(); |
| 1063 |
| 1045 document().updateRenderTreeIfNeeded(); | 1064 document().updateRenderTreeIfNeeded(); |
| 1046 } | 1065 } |
| 1047 | 1066 |
| 1048 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme
nt) | 1067 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme
nt) |
| 1049 : m_targetElement(targetElement) | 1068 : m_targetElement(targetElement) |
| 1050 { | 1069 { |
| 1051 if (m_targetElement) | 1070 if (m_targetElement) |
| 1052 m_targetElement->setInstanceUpdatesBlocked(true); | 1071 m_targetElement->setInstanceUpdatesBlocked(true); |
| 1053 } | 1072 } |
| 1054 | 1073 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 #endif | 1185 #endif |
| 1167 | 1186 |
| 1168 void SVGElement::trace(Visitor* visitor) | 1187 void SVGElement::trace(Visitor* visitor) |
| 1169 { | 1188 { |
| 1170 visitor->trace(m_elementsWithRelativeLengths); | 1189 visitor->trace(m_elementsWithRelativeLengths); |
| 1171 visitor->trace(m_SVGRareData); | 1190 visitor->trace(m_SVGRareData); |
| 1172 Element::trace(visitor); | 1191 Element::trace(visitor); |
| 1173 } | 1192 } |
| 1174 | 1193 |
| 1175 } | 1194 } |
| OLD | NEW |