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

Unified Diff: Source/core/svg/SVGElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGCursorElement.cpp ('k') | Source/core/svg/SVGElementInstance.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGElement.cpp
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index 0e63172ff7d267b54546b9443eaeeeb6904dd0f6..4ee576f65e50c4f8a625e7b09cd3b852aeba475e 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -88,7 +88,6 @@ SVGElement::~SVGElement()
if (!hasSVGRareData())
ASSERT(!SVGElementRareData::rareDataMap().contains(this));
else {
- ASSERT(document());
SVGElementRareData::SVGElementRareDataMap& rareDataMap = SVGElementRareData::rareDataMap();
SVGElementRareData::SVGElementRareDataMap::iterator it = rareDataMap.find(this);
ASSERT(it != rareDataMap.end());
@@ -111,9 +110,8 @@ SVGElement::~SVGElement()
// removeAllElementReferencesForTarget() below.
clearHasSVGRareData();
}
- ASSERT(document());
- document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
- document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this);
+ document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
+ document().accessSVGExtensions()->removeAllElementReferencesForTarget(this);
}
void SVGElement::willRecalcStyle(StyleChange change)
@@ -132,11 +130,11 @@ void SVGElement::willRecalcStyle(StyleChange change)
void SVGElement::buildPendingResourcesIfNeeded()
{
- Document* document = this->document();
- if (!needsPendingResourceHandling() || !document || !inDocument() || isInShadowTree())
+ Document& document = this->document();
+ if (!needsPendingResourceHandling() || !inDocument() || isInShadowTree())
return;
- SVGDocumentExtensions* extensions = document->accessSVGExtensions();
+ SVGDocumentExtensions* extensions = document.accessSVGExtensions();
String resourceId = getIdAttribute();
if (!extensions->hasPendingResource(resourceId))
return;
@@ -214,7 +212,7 @@ void SVGElement::reportAttributeParsingError(SVGParsingError error, const Qualif
return;
String errorString = "<" + tagName() + "> attribute " + name.toString() + "=\"" + value + "\"";
- SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
+ SVGDocumentExtensions* extensions = document().accessSVGExtensions();
if (error == NegativeValueForbiddenError) {
extensions->reportError("Invalid negative value for " + errorString);
@@ -342,8 +340,8 @@ void SVGElement::removedFrom(ContainerNode* rootParent)
Element::removedFrom(rootParent);
if (wasInDocument) {
- document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
- document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this);
+ document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
+ document().accessSVGExtensions()->removeAllElementReferencesForTarget(this);
}
SVGElementInstance::invalidateAllInstancesOfElement(this);
@@ -501,7 +499,7 @@ SVGDocumentExtensions* SVGElement::accessDocumentSVGExtensions()
{
// This function is provided for use by SVGAnimatedProperty to avoid
// global inclusion of core/dom/Document.h in SVG code.
- return document() ? document()->accessSVGExtensions() : 0;
+ return document().accessSVGExtensions();
}
void SVGElement::mapInstanceToElement(SVGElementInstance* instance)
@@ -858,7 +856,7 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents)
// If the load event was not sent yet by Document::implicitClose(), but the <image> from the example
// above, just appeared, don't send the SVGLoad event to the outermost <svg>, but wait for the document
// to be "ready to render", first.
- if (!document()->loadEventFinished())
+ if (!document().loadEventFinished())
break;
}
}
@@ -919,7 +917,7 @@ void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString&
Element::attributeChanged(name, newValue);
if (isIdAttributeName(name))
- document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
+ document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
// Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods),
// so we don't want changes to the style attribute to result in extra work here.
@@ -987,7 +985,7 @@ void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement)
PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer()
{
if (!correspondingElement())
- return document()->styleResolver()->styleForElement(this);
+ return document().styleResolver()->styleForElement(this);
RenderStyle* style = 0;
if (Element* parent = parentOrShadowHostElement()) {
@@ -995,7 +993,7 @@ PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer()
style = renderer->style();
}
- return document()->styleResolver()->styleForElement(correspondingElement(), style, DisallowStyleSharing);
+ return document().styleResolver()->styleForElement(correspondingElement(), style, DisallowStyleSharing);
}
MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const
« no previous file with comments | « Source/core/svg/SVGCursorElement.cpp ('k') | Source/core/svg/SVGElementInstance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698