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

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

Issue 181713003: Have Document::accessSVGExtensions() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGPathElement.cpp ('k') | Source/core/svg/SVGTextPathElement.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 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return adoptRef(new SVGSVGElement(document)); 99 return adoptRef(new SVGSVGElement(document));
100 } 100 }
101 101
102 SVGSVGElement::~SVGSVGElement() 102 SVGSVGElement::~SVGSVGElement()
103 { 103 {
104 if (m_viewSpec) 104 if (m_viewSpec)
105 m_viewSpec->detachContextElement(); 105 m_viewSpec->detachContextElement();
106 106
107 // There are cases where removedFromDocument() is not called. 107 // There are cases where removedFromDocument() is not called.
108 // see ContainerNode::removeAllChildren, called by its destructor. 108 // see ContainerNode::removeAllChildren, called by its destructor.
109 document().accessSVGExtensions()->removeTimeContainer(this); 109 document().accessSVGExtensions().removeTimeContainer(this);
110 110
111 ASSERT(inDocument() || !accessDocumentSVGExtensions()->isSVGRootWithRelative LengthDescendents(this)); 111 ASSERT(inDocument() || !accessDocumentSVGExtensions().isSVGRootWithRelativeL engthDescendents(this));
112 } 112 }
113 113
114 const AtomicString& SVGSVGElement::contentScriptType() const 114 const AtomicString& SVGSVGElement::contentScriptType() const
115 { 115 {
116 DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/ecmascript", At omicString::ConstructFromLiteral)); 116 DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/ecmascript", At omicString::ConstructFromLiteral));
117 const AtomicString& n = fastGetAttribute(SVGNames::contentScriptTypeAttr); 117 const AtomicString& n = fastGetAttribute(SVGNames::contentScriptTypeAttr);
118 return n.isNull() ? defaultValue : n; 118 return n.isNull() ? defaultValue : n;
119 } 119 }
120 120
121 void SVGSVGElement::setContentScriptType(const AtomicString& type) 121 void SVGSVGElement::setContentScriptType(const AtomicString& type)
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 return new RenderSVGRoot(this); 484 return new RenderSVGRoot(this);
485 485
486 return new RenderSVGViewportContainer(this); 486 return new RenderSVGViewportContainer(this);
487 } 487 }
488 488
489 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro otParent) 489 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro otParent)
490 { 490 {
491 if (rootParent->inDocument()) { 491 if (rootParent->inDocument()) {
492 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); 492 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument);
493 493
494 document().accessSVGExtensions()->addTimeContainer(this); 494 document().accessSVGExtensions().addTimeContainer(this);
495 495
496 // Animations are started at the end of document parsing and after firin g the load event, 496 // Animations are started at the end of document parsing and after firin g the load event,
497 // but if we miss that train (deferred programmatic element insertion fo r example) we need 497 // but if we miss that train (deferred programmatic element insertion fo r example) we need
498 // to initialize the time container here. 498 // to initialize the time container here.
499 if (!document().parsing() && !document().processingLoadEvent() && docume nt().loadEventFinished() && !timeContainer()->isStarted()) 499 if (!document().parsing() && !document().processingLoadEvent() && docume nt().loadEventFinished() && !timeContainer()->isStarted())
500 timeContainer()->begin(); 500 timeContainer()->begin();
501 } 501 }
502 return SVGGraphicsElement::insertedInto(rootParent); 502 return SVGGraphicsElement::insertedInto(rootParent);
503 } 503 }
504 504
505 void SVGSVGElement::removedFrom(ContainerNode* rootParent) 505 void SVGSVGElement::removedFrom(ContainerNode* rootParent)
506 { 506 {
507 if (rootParent->inDocument()) { 507 if (rootParent->inDocument()) {
508 SVGDocumentExtensions* svgExtensions = document().accessSVGExtensions(); 508 SVGDocumentExtensions& svgExtensions = document().accessSVGExtensions();
509 svgExtensions->removeTimeContainer(this); 509 svgExtensions.removeTimeContainer(this);
510 svgExtensions->removeSVGRootWithRelativeLengthDescendents(this); 510 svgExtensions.removeSVGRootWithRelativeLengthDescendents(this);
511 } 511 }
512 512
513 SVGGraphicsElement::removedFrom(rootParent); 513 SVGGraphicsElement::removedFrom(rootParent);
514 } 514 }
515 515
516 void SVGSVGElement::pauseAnimations() 516 void SVGSVGElement::pauseAnimations()
517 { 517 {
518 if (!m_timeContainer->isPaused()) 518 if (!m_timeContainer->isPaused())
519 m_timeContainer->pause(); 519 m_timeContainer->pause();
520 } 520 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 Vector<Element*>::const_iterator end = elements.end(); 780 Vector<Element*>::const_iterator end = elements.end();
781 for (Vector<Element*>::const_iterator it = elements.begin(); it != end; ++it ) { 781 for (Vector<Element*>::const_iterator it = elements.begin(); it != end; ++it ) {
782 if ((*it)->isDescendantOf(this)) 782 if ((*it)->isDescendantOf(this))
783 return *it; 783 return *it;
784 } 784 }
785 785
786 return 0; 786 return 0;
787 } 787 }
788 788
789 } 789 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPathElement.cpp ('k') | Source/core/svg/SVGTextPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698