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

Side by Side Diff: Source/core/svg/SVGElement.cpp

Issue 272523002: Remove SVGElementInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix TestExpectations Created 6 years, 6 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { 81 {
82 ScriptWrappable::init(this); 82 ScriptWrappable::init(this);
83 addToPropertyMap(m_className); 83 addToPropertyMap(m_className);
84 setHasCustomStyleCallbacks(); 84 setHasCustomStyleCallbacks();
85 } 85 }
86 86
87 SVGElement::~SVGElement() 87 SVGElement::~SVGElement()
88 { 88 {
89 ASSERT(inDocument() || !hasRelativeLengths()); 89 ASSERT(inDocument() || !hasRelativeLengths());
90 90
91 if (correspondingElement() && correspondingElement()->instancesForElement(). contains(this))
92 correspondingElement()->removeInstanceMapping(this);
91 // The below teardown is all handled by weak pointer processing in oilpan. 93 // The below teardown is all handled by weak pointer processing in oilpan.
92 #if !ENABLE(OILPAN) 94 #if !ENABLE(OILPAN)
93 if (hasSVGRareData()) { 95 if (hasSVGRareData()) {
94 if (SVGCursorElement* cursorElement = svgRareData()->cursorElement()) 96 if (SVGCursorElement* cursorElement = svgRareData()->cursorElement())
95 cursorElement->removeReferencedElement(this); 97 cursorElement->removeReferencedElement(this);
96 if (CSSCursorImageValue* cursorImageValue = svgRareData()->cursorImageVa lue()) 98 if (CSSCursorImageValue* cursorImageValue = svgRareData()->cursorImageVa lue())
97 cursorImageValue->removeReferencedElement(this); 99 cursorImageValue->removeReferencedElement(this);
98 // Clear the rare data now so that we are in a consistent state when 100 // Clear the rare data now so that we are in a consistent state when
99 // calling rebuildAllElementReferencesForTarget() below. 101 // calling rebuildAllElementReferencesForTarget() below.
100 m_SVGRareData.clear(); 102 m_SVGRareData.clear();
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 518
517 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = ensureSV GRareData()->elementInstances(); 519 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = ensureSV GRareData()->elementInstances();
518 ASSERT(!instances.contains(instance)); 520 ASSERT(!instances.contains(instance));
519 521
520 instances.add(instance); 522 instances.add(instance);
521 } 523 }
522 524
523 void SVGElement::removeInstanceMapping(SVGElement* instance) 525 void SVGElement::removeInstanceMapping(SVGElement* instance)
524 { 526 {
525 ASSERT(instance); 527 ASSERT(instance);
526 ASSERT(instance->inUseShadowTree()); 528 // ASSERT(instance->inUseShadowTree());
eseidel 2014/06/03 18:20:25 Why commit commented out code?
527 529
528 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareD ata()->elementInstances(); 530 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareD ata()->elementInstances();
529 ASSERT(instances.contains(instance)); 531 ASSERT(instances.contains(instance));
530 532
531 instances.remove(instance); 533 instances.remove(instance);
532 } 534 }
533 535
534 static WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& emptyInstances() 536 static WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& emptyInstances()
535 { 537 {
536 #if ENABLE(OILPAN) 538 #if ENABLE(OILPAN)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 593
592 #if !ENABLE(OILPAN) 594 #if !ENABLE(OILPAN)
593 void SVGElement::cursorImageValueRemoved() 595 void SVGElement::cursorImageValueRemoved()
594 { 596 {
595 svgRareData()->setCursorImageValue(0); 597 svgRareData()->setCursorImageValue(0);
596 } 598 }
597 #endif 599 #endif
598 600
599 SVGElement* SVGElement::correspondingElement() 601 SVGElement* SVGElement::correspondingElement()
600 { 602 {
601 ASSERT(!hasSVGRareData() || !svgRareData()->correspondingElement() || contai ningShadowRoot()); 603 // ASSERT(!hasSVGRareData() || !svgRareData()->correspondingElement() || cont ainingShadowRoot());
602 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0; 604 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0;
603 } 605 }
604 606
605 SVGUseElement* SVGElement::correspondingUseElement() const 607 SVGUseElement* SVGElement::correspondingUseElement() const
606 { 608 {
607 if (ShadowRoot* root = containingShadowRoot()) { 609 if (ShadowRoot* root = containingShadowRoot()) {
608 if (isSVGUseElement(root->host()) && (root->type() == ShadowRoot::UserAg entShadowRoot)) 610 if (isSVGUseElement(root->host()) && (root->type() == ShadowRoot::UserAg entShadowRoot))
609 return toSVGUseElement(root->host()); 611 return toSVGUseElement(root->host());
610 } 612 }
611 return 0; 613 return 0;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); 1037 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end();
1036 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { 1038 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) {
1037 (*it)->setCorrespondingElement(0); 1039 (*it)->setCorrespondingElement(0);
1038 1040
1039 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 1041 if (SVGUseElement* element = (*it)->correspondingUseElement()) {
1040 ASSERT(element->inDocument()); 1042 ASSERT(element->inDocument());
1041 element->invalidateShadowTree(); 1043 element->invalidateShadowTree();
1042 } 1044 }
1043 } 1045 }
1044 1046
1047 svgRareData()->elementInstances().clear();
1048
1045 document().updateRenderTreeIfNeeded(); 1049 document().updateRenderTreeIfNeeded();
1046 } 1050 }
1047 1051
1048 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt) 1052 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt)
1049 : m_targetElement(targetElement) 1053 : m_targetElement(targetElement)
1050 { 1054 {
1051 if (m_targetElement) 1055 if (m_targetElement)
1052 m_targetElement->setInstanceUpdatesBlocked(true); 1056 m_targetElement->setInstanceUpdatesBlocked(true);
1053 } 1057 }
1054 1058
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 #endif 1170 #endif
1167 1171
1168 void SVGElement::trace(Visitor* visitor) 1172 void SVGElement::trace(Visitor* visitor)
1169 { 1173 {
1170 visitor->trace(m_elementsWithRelativeLengths); 1174 visitor->trace(m_elementsWithRelativeLengths);
1171 visitor->trace(m_SVGRareData); 1175 visitor->trace(m_SVGRareData);
1172 Element::trace(visitor); 1176 Element::trace(visitor);
1173 } 1177 }
1174 1178
1175 } 1179 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698