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

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

Issue 272623003: Stop using SVGElementInstance in SVGElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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/svg/SVGElement.h ('k') | Source/core/svg/SVGElementInstance.cpp » ('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 24 matching lines...) Expand all
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/ElementTraversal.h" 36 #include "core/dom/ElementTraversal.h"
37 #include "core/dom/shadow/ShadowRoot.h" 37 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/html/HTMLElement.h" 40 #include "core/html/HTMLElement.h"
41 #include "core/rendering/RenderObject.h" 41 #include "core/rendering/RenderObject.h"
42 #include "core/rendering/svg/RenderSVGResourceContainer.h" 42 #include "core/rendering/svg/RenderSVGResourceContainer.h"
43 #include "core/svg/SVGCursorElement.h" 43 #include "core/svg/SVGCursorElement.h"
44 #include "core/svg/SVGDocumentExtensions.h" 44 #include "core/svg/SVGDocumentExtensions.h"
45 #include "core/svg/SVGElementInstance.h"
46 #include "core/svg/SVGElementRareData.h" 45 #include "core/svg/SVGElementRareData.h"
47 #include "core/svg/SVGGraphicsElement.h" 46 #include "core/svg/SVGGraphicsElement.h"
48 #include "core/svg/SVGSVGElement.h" 47 #include "core/svg/SVGSVGElement.h"
49 #include "core/svg/SVGTitleElement.h" 48 #include "core/svg/SVGTitleElement.h"
50 #include "core/svg/SVGUseElement.h" 49 #include "core/svg/SVGUseElement.h"
51 50
52 #include "wtf/TemporaryChange.h" 51 #include "wtf/TemporaryChange.h"
53 52
54 namespace WebCore { 53 namespace WebCore {
55 54
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 return 0; 520 return 0;
522 } 521 }
523 522
524 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions() 523 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions()
525 { 524 {
526 // This function is provided for use by SVGAnimatedProperty to avoid 525 // This function is provided for use by SVGAnimatedProperty to avoid
527 // global inclusion of core/dom/Document.h in SVG code. 526 // global inclusion of core/dom/Document.h in SVG code.
528 return document().accessSVGExtensions(); 527 return document().accessSVGExtensions();
529 } 528 }
530 529
531 void SVGElement::mapInstanceToElement(SVGElementInstance* instance) 530 void SVGElement::mapInstanceToElement(SVGElement* instance)
532 { 531 {
533 ASSERT(instance); 532 ASSERT(instance);
534 533
535 HashSet<SVGElement*>& instances = ensureSVGRareData()->elementInstances(); 534 HashSet<SVGElement*>& instances = ensureSVGRareData()->elementInstances();
536 ASSERT(!instances.contains(instance->shadowTreeElement())); 535 ASSERT(!instances.contains(instance));
537 536
pdr. 2014/05/07 22:27:23 I think the assertion here was useful (similarly i
538 instances.add(instance->shadowTreeElement()); 537 instances.add(instance);
539 } 538 }
540 539
541 void SVGElement::removeInstanceMapping(SVGElementInstance* instance) 540 void SVGElement::removeInstanceMapping(SVGElement* instance)
542 { 541 {
543 ASSERT(instance); 542 ASSERT(instance);
544 ASSERT(hasSVGRareData()); 543 ASSERT(hasSVGRareData());
545 544
546 if (!instance->shadowTreeElement()) 545 HashSet<SVGElement*>& instances = svgRareData()->elementInstances();
547 return; 546 ASSERT(instances.contains(instance));
548 547
549 HashSet<SVGElement*>& instances = svgRareData()->elementInstances(); 548 instances.remove(instance);
550 ASSERT(instances.contains(instance->shadowTreeElement()));
551
552 instances.remove(instance->shadowTreeElement());
553 } 549 }
554 550
555 const HashSet<SVGElement*>& SVGElement::instancesForElement() const 551 const HashSet<SVGElement*>& SVGElement::instancesForElement() const
556 { 552 {
557 if (!hasSVGRareData()) { 553 if (!hasSVGRareData()) {
558 DEFINE_STATIC_LOCAL(HashSet<SVGElement*>, emptyInstances, ()); 554 DEFINE_STATIC_LOCAL(HashSet<SVGElement*>, emptyInstances, ());
559 return emptyInstances; 555 return emptyInstances;
560 } 556 }
561 return svgRareData()->elementInstances(); 557 return svgRareData()->elementInstances();
562 } 558 }
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 animatableAttributes.add(SVGNames::zAttr); 1182 animatableAttributes.add(SVGNames::zAttr);
1187 } 1183 }
1188 1184
1189 if (name == classAttr) 1185 if (name == classAttr)
1190 return true; 1186 return true;
1191 1187
1192 return animatableAttributes.contains(name); 1188 return animatableAttributes.contains(name);
1193 } 1189 }
1194 #endif 1190 #endif
1195 } 1191 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGElementInstance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698