Have Document::accessSVGExtensions() return a reference
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Sep 2014 18:44:41 +0000 (18:44 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Sep 2014 18:44:41 +0000 (18:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137030

Reviewed by Ryosuke Niwa.

Have Document::accessSVGExtensions() return a reference instead of a
pointer as it can never return null.

No new tests, no behavior change.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeChild):
(WebCore::ContainerNode::removeChildren):
* dom/Document.cpp:
(WebCore::Document::commonTeardown):
(WebCore::Document::implicitClose):
(WebCore::Document::accessSVGExtensions):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::~Element):
(WebCore::Element::removedFrom):
* editing/markup.cpp:
(WebCore::isPlainTextMarkup):
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::buildReferenceFilter):
* rendering/svg/RenderSVGResource.cpp:
(WebCore::removeFromCacheAndInvalidateDependencies):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::svgExtensionsFromElement):
* rendering/svg/RenderSVGResourceContainer.h:
(WebCore::getRenderSVGResourceContainerById):
(WebCore::getRenderSVGResourceById):
* rendering/svg/SVGResources.cpp:
(WebCore::registerPendingResource):
(WebCore::SVGResources::buildCachedResources):
* rendering/svg/SVGResourcesCache.cpp:
(WebCore::resourcesCacheFromRenderer):
(WebCore::SVGResourcesCache::resourceDestroyed):
* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::reportAttributeParsingError):
(WebCore::SVGElement::removedFrom):
(WebCore::SVGElement::viewportElement):
(WebCore::SVGElement::attributeChanged):
(WebCore::SVGElement::buildPendingResourcesIfNeeded):
(WebCore::SVGElement::accessDocumentSVGExtensions): Deleted.
* svg/SVGElement.h:
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::parseAttribute):
* svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::parseAttribute):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::clearResourceReferences):
(WebCore::SVGFEImageElement::buildPendingResource):
* svg/SVGFitToViewBox.cpp:
(WebCore::SVGFitToViewBox::parseViewBox):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::insertedInto):
(WebCore::SVGFontFaceElement::removedFrom):
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::buildPendingResource):
(WebCore::SVGMPathElement::clearResourceReferences):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::invalidateMPathDependencies):
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::parseAttribute):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::~SVGSVGElement):
(WebCore::SVGSVGElement::insertedInto):
(WebCore::SVGSVGElement::removedFrom):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):
(WebCore::SVGTRefElement::buildPendingResource):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::clearResourceReferences):
(WebCore::SVGTextPathElement::buildPendingResource):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::clearResourceReferences):
(WebCore::SVGUseElement::buildPendingResource):
(WebCore::SVGUseElement::toClipPath):
(WebCore::SVGUseElement::buildInstanceTree):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::clearResourceReferences):
(WebCore::SVGSMILElement::buildPendingResource):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173883 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/svg/RenderSVGResource.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
Source/WebCore/rendering/svg/SVGResources.cpp
Source/WebCore/rendering/svg/SVGResourcesCache.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp
Source/WebCore/svg/SVGFEGaussianBlurElement.cpp
Source/WebCore/svg/SVGFEImageElement.cpp
Source/WebCore/svg/SVGFitToViewBox.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebCore/svg/SVGMPathElement.cpp
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPolyElement.cpp
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGTRefElement.cpp
Source/WebCore/svg/SVGTextPathElement.cpp
Source/WebCore/svg/SVGUseElement.cpp
Source/WebCore/svg/animation/SVGSMILElement.cpp

index 228174f..bc3111c 100644 (file)
@@ -1,3 +1,93 @@
+2014-09-23  Chris Dumez  <cdumez@apple.com>
+
+        Have Document::accessSVGExtensions() return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=137030
+
+        Reviewed by Ryosuke Niwa.
+
+        Have Document::accessSVGExtensions() return a reference instead of a
+        pointer as it can never return null.
+
+        No new tests, no behavior change.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeChild):
+        (WebCore::ContainerNode::removeChildren):
+        * dom/Document.cpp:
+        (WebCore::Document::commonTeardown):
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::accessSVGExtensions):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::~Element):
+        (WebCore::Element::removedFrom):
+        * editing/markup.cpp:
+        (WebCore::isPlainTextMarkup):
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore):
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::buildReferenceFilter):
+        * rendering/svg/RenderSVGResource.cpp:
+        (WebCore::removeFromCacheAndInvalidateDependencies):
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        (WebCore::svgExtensionsFromElement):
+        * rendering/svg/RenderSVGResourceContainer.h:
+        (WebCore::getRenderSVGResourceContainerById):
+        (WebCore::getRenderSVGResourceById):
+        * rendering/svg/SVGResources.cpp:
+        (WebCore::registerPendingResource):
+        (WebCore::SVGResources::buildCachedResources):
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::resourcesCacheFromRenderer):
+        (WebCore::SVGResourcesCache::resourceDestroyed):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::~SVGElement):
+        (WebCore::SVGElement::reportAttributeParsingError):
+        (WebCore::SVGElement::removedFrom):
+        (WebCore::SVGElement::viewportElement):
+        (WebCore::SVGElement::attributeChanged):
+        (WebCore::SVGElement::buildPendingResourcesIfNeeded):
+        (WebCore::SVGElement::accessDocumentSVGExtensions): Deleted.
+        * svg/SVGElement.h:
+        * svg/SVGFEConvolveMatrixElement.cpp:
+        (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
+        * svg/SVGFEGaussianBlurElement.cpp:
+        (WebCore::SVGFEGaussianBlurElement::parseAttribute):
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::clearResourceReferences):
+        (WebCore::SVGFEImageElement::buildPendingResource):
+        * svg/SVGFitToViewBox.cpp:
+        (WebCore::SVGFitToViewBox::parseViewBox):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::insertedInto):
+        (WebCore::SVGFontFaceElement::removedFrom):
+        * svg/SVGMPathElement.cpp:
+        (WebCore::SVGMPathElement::buildPendingResource):
+        (WebCore::SVGMPathElement::clearResourceReferences):
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::parseAttribute):
+        (WebCore::SVGPathElement::invalidateMPathDependencies):
+        * svg/SVGPolyElement.cpp:
+        (WebCore::SVGPolyElement::parseAttribute):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::~SVGSVGElement):
+        (WebCore::SVGSVGElement::insertedInto):
+        (WebCore::SVGSVGElement::removedFrom):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::detachTarget):
+        (WebCore::SVGTRefElement::buildPendingResource):
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::clearResourceReferences):
+        (WebCore::SVGTextPathElement::buildPendingResource):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::clearResourceReferences):
+        (WebCore::SVGUseElement::buildPendingResource):
+        (WebCore::SVGUseElement::toClipPath):
+        (WebCore::SVGUseElement::buildInstanceTree):
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::clearResourceReferences):
+        (WebCore::SVGSMILElement::buildPendingResource):
+
 2014-09-23  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Should be able to attach a debugger to a JSContext before anything is executed
index d5ce05d..ae855ec 100644 (file)
@@ -573,7 +573,7 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
     if (document().svgExtensions()) {
         Element* shadowHost = this->shadowHost();
         if (!shadowHost || !shadowHost->hasTagName(SVGNames::useTag))
-            document().accessSVGExtensions()->rebuildElements();
+            document().accessSVGExtensions().rebuildElements();
     }
 
     dispatchSubtreeModifiedEvent();
@@ -670,7 +670,7 @@ void ContainerNode::removeChildren()
     if (document().svgExtensions()) {
         Element* shadowHost = this->shadowHost();
         if (!shadowHost || !shadowHost->hasTagName(SVGNames::useTag))
-            document().accessSVGExtensions()->rebuildElements();
+            document().accessSVGExtensions().rebuildElements();
     }
 
     dispatchSubtreeModifiedEvent();
index 42d0e0d..157ebe9 100644 (file)
@@ -693,7 +693,7 @@ void Document::removedLastRef()
 void Document::commonTeardown()
 {
     if (svgExtensions())
-        accessSVGExtensions()->pauseAnimations();
+        accessSVGExtensions().pauseAnimations();
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     clearScriptedAnimationController();
@@ -2440,7 +2440,7 @@ void Document::implicitClose()
     // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
     // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
     if (svgExtensions())
-        accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements();
+        accessSVGExtensions().dispatchSVGLoadEventToOutermostSVGElements();
 
     dispatchWindowLoadEvent();
     enqueuePageshowEvent(PageshowEventNotPersisted);
@@ -2505,7 +2505,7 @@ void Document::implicitClose()
 #endif
 
     if (svgExtensions())
-        accessSVGExtensions()->startAnimations();
+        accessSVGExtensions().startAnimations();
 }
 
 void Document::setParsing(bool b)
@@ -4464,11 +4464,11 @@ const SVGDocumentExtensions* Document::svgExtensions()
     return m_svgExtensions.get();
 }
 
-SVGDocumentExtensions* Document::accessSVGExtensions()
+SVGDocumentExtensions& Document::accessSVGExtensions()
 {
     if (!m_svgExtensions)
         m_svgExtensions = std::make_unique<SVGDocumentExtensions>(this);
-    return m_svgExtensions.get();
+    return *m_svgExtensions;
 }
 
 bool Document::hasSVGRootNode() const
index 90df070..cdd2082 100644 (file)
@@ -1094,7 +1094,7 @@ public:
     virtual void removeAllEventListeners() override;
 
     WEBCORE_EXPORT const SVGDocumentExtensions* svgExtensions();
-    WEBCORE_EXPORT SVGDocumentExtensions* accessSVGExtensions();
+    WEBCORE_EXPORT SVGDocumentExtensions& accessSVGExtensions();
 
     void initSecurityContext();
     void initContentSecurityPolicy();
index 3e06ed7..e7da674 100644 (file)
@@ -168,7 +168,7 @@ Element::~Element()
         detachAllAttrNodesFromElement();
 
     if (hasPendingResources()) {
-        document().accessSVGExtensions()->removeElementFromPendingResources(this);
+        document().accessSVGExtensions().removeElementFromPendingResources(this);
         ASSERT(!hasPendingResources());
     }
 }
@@ -1410,7 +1410,7 @@ void Element::removedFrom(ContainerNode& insertionPoint)
     ContainerNode::removedFrom(insertionPoint);
 
     if (hasPendingResources())
-        document().accessSVGExtensions()->removeElementFromPendingResources(this);
+        document().accessSVGExtensions().removeElementFromPendingResources(this);
 }
 
 void Element::unregisterNamedFlowContentElement()
index 6c22bfe..43e6957 100644 (file)
@@ -746,7 +746,7 @@ bool isPlainTextMarkup(Node* node)
     if (!isHTMLDivElement(node))
         return false;
 
-    HTMLDivElement& element = toHTMLDivElement(*node);
+    HTMLDivElement& element = downcast<HTMLDivElement>(*node);
     if (element.hasAttributes())
         return false;
 
index d3b4d8a..50e6596 100644 (file)
@@ -89,7 +89,7 @@ void CachedFrameBase::restore()
     m_cachedFrameScriptData->restore(frame);
 
     if (m_document->svgExtensions())
-        m_document->accessSVGExtensions()->unpauseAnimations();
+        m_document->accessSVGExtensions().unpauseAnimations();
 
     frame.animation().resumeAnimationsForDocument(m_document.get());
     m_document->resumeActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive);
index f31e7b9..aef902d 100644 (file)
@@ -87,7 +87,7 @@ GraphicsContext* FilterEffectRenderer::inputContext()
 PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElement* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
 {
     if (!renderer)
-        return 0;
+        return nullptr;
 
     Document* document = &renderer->document();
 
@@ -100,15 +100,15 @@ PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElemen
         document = cachedSVGDocument->document();
 
     if (!document)
-        return 0;
+        return nullptr;
 
     Element* filter = document->getElementById(filterOperation->fragment());
     if (!filter) {
         // Although we did not find the referenced filter, it might exist later in the document.
         // FIXME: This skips anonymous RenderObjects. <https://webkit.org/b/131085>
         if (Element* element = renderer->element())
-            document->accessSVGExtensions()->addPendingResource(filterOperation->fragment(), element);
-        return 0;
+            document->accessSVGExtensions().addPendingResource(filterOperation->fragment(), element);
+        return nullptr;
     }
 
     RefPtr<FilterEffect> effect;
index 0fa519e..75b7c0c 100644 (file)
@@ -169,7 +169,7 @@ static inline void removeFromCacheAndInvalidateDependencies(RenderElement& rende
 
     if (!renderer.element() || !renderer.element()->isSVGElement())
         return;
-    HashSet<SVGElement*>* dependencies = renderer.document().accessSVGExtensions()->setOfElementsReferencingTarget(downcast<SVGElement>(renderer.element()));
+    HashSet<SVGElement*>* dependencies = renderer.document().accessSVGExtensions().setOfElementsReferencingTarget(downcast<SVGElement>(renderer.element()));
     if (!dependencies)
         return;
     for (auto* element : *dependencies) {
index c1a4b55..6ae5217 100644 (file)
@@ -31,8 +31,7 @@ namespace WebCore {
 
 static inline SVGDocumentExtensions& svgExtensionsFromElement(SVGElement& element)
 {
-    // FIXME: accessSVGExtensions() should return a reference.
-    return *element.document().accessSVGExtensions();
+    return element.document().accessSVGExtensions();
 }
 
 RenderSVGResourceContainer::RenderSVGResourceContainer(SVGElement& element, PassRef<RenderStyle> style)
index 4a873b4..a3806e6 100644 (file)
@@ -80,12 +80,12 @@ RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContainer())
 inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document& document, const AtomicString& id)
 {
     if (id.isEmpty())
-        return 0;
+        return nullptr;
 
-    if (RenderSVGResourceContainer* renderResource = document.accessSVGExtensions()->resourceById(id))
+    if (RenderSVGResourceContainer* renderResource = document.accessSVGExtensions().resourceById(id))
         return renderResource;
 
-    return 0;
+    return nullptr;
 }
 
 template<typename Renderer>
@@ -94,7 +94,7 @@ Renderer* getRenderSVGResourceById(Document& document, const AtomicString& id)
     if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(document, id))
         return container->cast<Renderer>();
 
-    return 0;
+    return nullptr;
 }
 
 }
index 4f3d45f..8cdc862 100644 (file)
@@ -172,9 +172,9 @@ static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document&
     return container;
 }
 
-static inline void registerPendingResource(SVGDocumentExtensions* extensions, const AtomicString& id, SVGElement& element)
+static inline void registerPendingResource(SVGDocumentExtensions& extensions, const AtomicString& id, SVGElement& element)
 {
-    extensions->addPendingResource(id, &element);
+    extensions.addPendingResource(id, &element);
 }
 
 bool SVGResources::buildCachedResources(const RenderElement& renderer, const SVGRenderStyle& svgStyle)
@@ -189,8 +189,7 @@ bool SVGResources::buildCachedResources(const RenderElement& renderer, const SVG
 
     Document& document = element.document();
 
-    SVGDocumentExtensions* extensions = document.accessSVGExtensions();
-    ASSERT(extensions);
+    SVGDocumentExtensions& extensions = document.accessSVGExtensions();
 
     const AtomicString& tagName = element.localName();
     if (tagName.isNull())
index f926601..a950c40 100644 (file)
@@ -77,9 +77,7 @@ void SVGResourcesCache::removeResourcesFromRenderer(RenderElement& renderer)
 
 static inline SVGResourcesCache& resourcesCacheFromRenderer(const RenderElement& renderer)
 {
-    SVGDocumentExtensions* extensions = renderer.document().accessSVGExtensions();
-    ASSERT(extensions);
-    return extensions->resourcesCache();
+    return renderer.document().accessSVGExtensions().resourcesCache();
 }
 
 SVGResources* SVGResourcesCache::cachedResourcesForRenderer(const RenderElement& renderer)
@@ -175,9 +173,7 @@ void SVGResourcesCache::resourceDestroyed(RenderSVGResourceContainer& resource)
         // Mark users of destroyed resources as pending resolution based on the id of the old resource.
         Element& resourceElement = resource.element();
         Element* clientElement = it.key->element();
-        SVGDocumentExtensions* extensions = clientElement->document().accessSVGExtensions();
-
-        extensions->addPendingResource(resourceElement.getIdAttribute(), clientElement);
+        clientElement->document().accessSVGExtensions().addPendingResource(resourceElement.getIdAttribute(), clientElement);
     }
 }
 
index d2f6949..25c1160 100644 (file)
@@ -289,8 +289,8 @@ SVGElement::~SVGElement()
 
         m_svgRareData = nullptr;
     }
-    document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(*this);
-    document().accessSVGExtensions()->removeAllElementReferencesForTarget(this);
+    document().accessSVGExtensions().rebuildAllElementReferencesForTarget(*this);
+    document().accessSVGExtensions().removeAllElementReferencesForTarget(this);
 }
 
 short SVGElement::tabIndex() const
@@ -347,15 +347,15 @@ 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);
+        extensions.reportError("Invalid negative value for " + errorString);
         return;
     }
 
     if (error == ParsingAttributeFailedError) {
-        extensions->reportError("Invalid value for " + errorString);
+        extensions.reportError("Invalid value for " + errorString);
         return;
     }
 
@@ -386,8 +386,8 @@ void SVGElement::removedFrom(ContainerNode& rootParent)
     StyledElement::removedFrom(rootParent);
 
     if (wasInDocument) {
-        document().accessSVGExtensions()->clearTargetDependencies(*this);
-        document().accessSVGExtensions()->removeAllElementReferencesForTarget(this);
+        document().accessSVGExtensions().clearTargetDependencies(*this);
+        document().accessSVGExtensions().removeAllElementReferencesForTarget(this);
     }
     SVGElementInstance::invalidateAllInstancesOfElement(this);
 }
@@ -419,13 +419,6 @@ SVGElement* SVGElement::viewportElement() const
 
     return nullptr;
 }
-
-SVGDocumentExtensions* SVGElement::accessDocumentSVGExtensions()
-{
-    // This function is provided for use by SVGAnimatedProperty to avoid
-    // global inclusion of Document.h in SVG code.
-    return document().accessSVGExtensions();
-}
  
 void SVGElement::mapInstanceToElement(SVGElementInstance* instance)
 {
@@ -744,7 +737,7 @@ void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString&
     StyledElement::attributeChanged(name, oldValue, newValue);
 
     if (name == HTMLNames::idAttr)
-        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.
@@ -1081,20 +1074,20 @@ void SVGElement::buildPendingResourcesIfNeeded()
     if (!needsPendingResourceHandling() || !inDocument() || isInShadowTree())
         return;
 
-    SVGDocumentExtensions* extensions = document().accessSVGExtensions();
+    SVGDocumentExtensions& extensions = document().accessSVGExtensions();
     String resourceId = getIdAttribute();
-    if (!extensions->isIdOfPendingResource(resourceId))
+    if (!extensions.isIdOfPendingResource(resourceId))
         return;
 
     // Mark pending resources as pending for removal.
-    extensions->markPendingResourcesForRemoval(resourceId);
+    extensions.markPendingResourcesForRemoval(resourceId);
 
     // Rebuild pending resources for each client of a pending resource that is being removed.
-    while (Element* clientElement = extensions->removeElementFromPendingResourcesForRemovalMap(resourceId)) {
+    while (Element* clientElement = extensions.removeElementFromPendingResourcesForRemovalMap(resourceId)) {
         ASSERT(clientElement->hasPendingResources());
         if (clientElement->hasPendingResources()) {
             clientElement->buildPendingResource();
-            extensions->clearHasPendingResourcesIfPossible(clientElement);
+            extensions.clearHasPendingResourcesIfPossible(clientElement);
         }
     }
 }
index b09b71d..6bde7bc 100644 (file)
@@ -74,8 +74,6 @@ public:
     void setInstanceUpdatesBlocked(bool);
     virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
 
-    SVGDocumentExtensions* accessDocumentSVGExtensions();
-
     virtual bool isSVGGraphicsElement() const { return false; }
     virtual bool isFilterEffect() const { return false; }
     virtual bool isGradientStop() const { return false; }
index 81af5d1..a259210 100644 (file)
@@ -136,7 +136,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
             setOrderXBaseValue(x);
             setOrderYBaseValue(y);
         } else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feConvolveMatrix: problem parsing order=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
@@ -147,7 +147,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
         if (propertyValue > 0)
             setEdgeModeBaseValue(propertyValue);
         else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feConvolveMatrix: problem parsing edgeMode=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
@@ -166,7 +166,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
         if (divisor)
             setDivisorBaseValue(divisor);
         else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feConvolveMatrix: problem parsing divisor=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
@@ -193,7 +193,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
             setKernelUnitLengthXBaseValue(x);
             setKernelUnitLengthYBaseValue(y);
         } else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feConvolveMatrix: problem parsing kernelUnitLength=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
@@ -205,7 +205,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
         else if (value == "false")
             setPreserveAlphaBaseValue(false);
         else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
index 84544bf..f8bc8a1 100644 (file)
@@ -114,7 +114,7 @@ void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const A
         if (propertyValue > 0)
             setEdgeModeBaseValue(propertyValue);
         else
-            document().accessSVGExtensions()->reportWarning(
+            document().accessSVGExtensions().reportWarning(
                 "feGaussianBlur: problem parsing edgeMode=\"" + value
                 + "\". Filtered element will not be displayed.");
         return;
index 70450d8..df7bad2 100644 (file)
@@ -75,7 +75,7 @@ void SVGFEImageElement::clearResourceReferences()
         m_cachedImage = 0;
     }
 
-    document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
 }
 
 void SVGFEImageElement::requestImageResource()
@@ -100,13 +100,13 @@ void SVGFEImageElement::buildPendingResource()
         if (id.isEmpty())
             requestImageResource();
         else {
-            document().accessSVGExtensions()->addPendingResource(id, this);
+            document().accessSVGExtensions().addPendingResource(id, this);
             ASSERT(hasPendingResources());
         }
     } else if (target->isSVGElement()) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions()->addElementReferencingTarget(this, downcast<SVGElement>(target));
+        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target));
     }
 
     invalidate();
index e30e270..fccb3a2 100644 (file)
@@ -56,21 +56,21 @@ bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar*
         return true;
     }
     if (!valid) {
-        doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\"");
+        doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
         return false;
     }
 
     if (width < 0.0) { // check that width is positive
-        doc->accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed");
+        doc->accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed");
         return false;
     }
     if (height < 0.0) { // check that height is positive
-        doc->accessSVGExtensions()->reportError("A negative value for ViewBox height is not allowed");
+        doc->accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed");
         return false;
     }
     skipOptionalSVGSpaces(c, end);
     if (c < end) { // nothing should come after the last, fourth number
-        doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\"");
+        doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
         return false;
     }
 
index 947008a..58403ce 100644 (file)
@@ -272,7 +272,7 @@ Node::InsertionNotificationRequest SVGFontFaceElement::insertedInto(ContainerNod
         ASSERT(!m_fontElement);
         return InsertionDone;
     }
-    document().accessSVGExtensions()->registerSVGFontFaceElement(this);
+    document().accessSVGExtensions().registerSVGFontFaceElement(this);
 
     rebuildFontFace();
     return InsertionDone;
@@ -284,7 +284,7 @@ void SVGFontFaceElement::removedFrom(ContainerNode& rootParent)
 
     if (rootParent.inDocument()) {
         m_fontElement = 0;
-        document().accessSVGExtensions()->unregisterSVGFontFaceElement(this);
+        document().accessSVGExtensions().unregisterSVGFontFaceElement(this);
         m_fontFaceRule->mutableProperties().clear();
 
         document().styleResolverChanged(DeferRecalcStyle);
index ffbac89..2c3ce7a 100644 (file)
@@ -66,17 +66,17 @@ void SVGMPathElement::buildPendingResource()
     Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
     if (!target) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions()->isPendingResource(this, id))
+        if (document().accessSVGExtensions().isPendingResource(this, id))
             return;
 
         if (!id.isEmpty()) {
-            document().accessSVGExtensions()->addPendingResource(id, this);
+            document().accessSVGExtensions().addPendingResource(id, this);
             ASSERT(hasPendingResources());
         }
     } else if (target->isSVGElement()) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions()->addElementReferencingTarget(this, downcast<SVGElement>(target));
+        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target));
     }
 
     targetPathChanged();
@@ -84,7 +84,7 @@ void SVGMPathElement::buildPendingResource()
 
 void SVGMPathElement::clearResourceReferences()
 {
-    document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
 }
 
 Node::InsertionNotificationRequest SVGMPathElement::insertedInto(ContainerNode& rootParent)
index 012983d..f323998 100644 (file)
@@ -233,14 +233,14 @@ void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
 
     if (name == SVGNames::dAttr) {
         if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), UnalteredParsing))
-            document().accessSVGExtensions()->reportError("Problem parsing d=\"" + value + "\"");
+            document().accessSVGExtensions().reportError("Problem parsing d=\"" + value + "\"");
         return;
     }
 
     if (name == SVGNames::pathLengthAttr) {
         setPathLengthBaseValue(value.toFloat());
         if (pathLengthBaseValue() < 0)
-            document().accessSVGExtensions()->reportError("A negative value for path attribute <pathLength> is not allowed");
+            document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed");
         return;
     }
 
@@ -284,7 +284,7 @@ void SVGPathElement::invalidateMPathDependencies()
 {
     // <mpath> can only reference <path> but this dependency is not handled in
     // markForLayoutAndParentResourceInvalidation so we update any mpath dependencies manually.
-    if (HashSet<SVGElement*>* dependencies = document().accessSVGExtensions()->setOfElementsReferencingTarget(this)) {
+    if (HashSet<SVGElement*>* dependencies = document().accessSVGExtensions().setOfElementsReferencingTarget(this)) {
         for (auto* element : *dependencies) {
             if (isSVGMPathElement(element))
                 downcast<SVGMPathElement>(*element).targetPathChanged();
index 95ef950..112c20f 100644 (file)
@@ -85,7 +85,7 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
     if (name == SVGNames::pointsAttr) {
         SVGPointList newList;
         if (!pointsListFromSVGData(newList, value))
-            document().accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\"");
+            document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\"");
 
         if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
             static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newList.size());
index 8d3494f..7d08d18 100644 (file)
@@ -107,7 +107,7 @@ SVGSVGElement::~SVGSVGElement()
     document().unregisterForPageCacheSuspensionCallbacks(this);
     // There are cases where removedFromDocument() is not called.
     // see ContainerNode::removeAllChildren, called by its destructor.
-    document().accessSVGExtensions()->removeTimeContainer(this);
+    document().accessSVGExtensions().removeTimeContainer(this);
 }
 
 void SVGSVGElement::didMoveToNewDocument(Document* oldDocument)
@@ -481,7 +481,7 @@ RenderPtr<RenderElement> SVGSVGElement::createElementRenderer(PassRef<RenderStyl
 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode& rootParent)
 {
     if (rootParent.inDocument()) {
-        document().accessSVGExtensions()->addTimeContainer(this);
+        document().accessSVGExtensions().addTimeContainer(this);
 
         // Animations are started at the end of document parsing and after firing the load event,
         // but if we miss that train (deferred programmatic element insertion for example) we need
@@ -495,7 +495,7 @@ Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode& ro
 void SVGSVGElement::removedFrom(ContainerNode& rootParent)
 {
     if (rootParent.inDocument())
-        document().accessSVGExtensions()->removeTimeContainer(this);
+        document().accessSVGExtensions().removeTimeContainer(this);
     SVGGraphicsElement::removedFrom(rootParent);
 }
 
index fab0221..b01248c 100644 (file)
@@ -175,7 +175,7 @@ void SVGTRefElement::detachTarget()
     String id;
     SVGURIReference::targetElementFromIRIString(href(), document(), &id);
     if (!id.isEmpty())
-        document().accessSVGExtensions()->addPendingResource(id, this);
+        document().accessSVGExtensions().addPendingResource(id, this);
 }
 
 bool SVGTRefElement::isSupportedAttribute(const QualifiedName& attrName)
@@ -263,7 +263,7 @@ void SVGTRefElement::buildPendingResource()
         if (id.isEmpty())
             return;
 
-        document().accessSVGExtensions()->addPendingResource(id, this);
+        document().accessSVGExtensions().addPendingResource(id, this);
         ASSERT(hasPendingResources());
         return;
     }
index 3677120..cdb995b 100644 (file)
@@ -67,7 +67,7 @@ SVGTextPathElement::~SVGTextPathElement()
 
 void SVGTextPathElement::clearResourceReferences()
 {
-    document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
 }
 
 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)
@@ -162,17 +162,17 @@ void SVGTextPathElement::buildPendingResource()
     Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
     if (!target) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions()->isPendingResource(this, id))
+        if (document().accessSVGExtensions().isPendingResource(this, id))
             return;
 
         if (!id.isEmpty()) {
-            document().accessSVGExtensions()->addPendingResource(id, this);
+            document().accessSVGExtensions().addPendingResource(id, this);
             ASSERT(hasPendingResources());
         }
     } else if (target->hasTagName(SVGNames::pathTag)) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions()->addElementReferencingTarget(this, downcast<SVGElement>(target));
+        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target));
     }
 }
 
index 556caff..de0ac8d 100644 (file)
@@ -390,7 +390,7 @@ void SVGUseElement::clearResourceReferences()
 
     m_needsShadowTreeRecreation = false;
 
-    document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
 }
 
 void SVGUseElement::buildPendingResource()
@@ -411,7 +411,7 @@ void SVGUseElement::buildPendingResource()
         if (id.isEmpty())
             return;
 
-        referencedDocument()->accessSVGExtensions()->addPendingResource(id, this);
+        referencedDocument()->accessSVGExtensions().addPendingResource(id, this);
         ASSERT(hasPendingResources());
         return;
     }
@@ -550,7 +550,7 @@ void SVGUseElement::toClipPath(Path& path)
     if (node->isSVGElement() && downcast<SVGElement>(*node).isSVGGraphicsElement()) {
         if (!isDirectReference(downcast<SVGElement>(*node))) {
             // Spec: Indirect references are an error (14.3.5)
-            document().accessSVGExtensions()->reportError("Not allowed to use indirect reference in <clip-path>");
+            document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>");
         } else {
             toSVGGraphicsElement(*node).toClipPath(path);
             // FIXME: Avoid manual resolution of x/y here. Its potentially harmful.
@@ -593,7 +593,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta
         // We only need to track first degree <use> dependencies. Indirect references are handled
         // as the invalidation bubbles up the dependency chain.
         if (!foundUse) {
-            document().accessSVGExtensions()->addElementReferencingTarget(this, target);
+            document().accessSVGExtensions().addElementReferencingTarget(this, target);
             foundUse = true;
         }
     } else if (isDisallowedElement(*target)) {
index 97cb226..f0a0851 100644 (file)
@@ -143,7 +143,7 @@ SVGSMILElement::~SVGSMILElement()
 
 void SVGSMILElement::clearResourceReferences()
 {
-    document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
 }
 
 void SVGSMILElement::clearTarget()
@@ -178,17 +178,17 @@ void SVGSMILElement::buildPendingResource()
 
     if (!svgTarget) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions()->isPendingResource(this, id))
+        if (document().accessSVGExtensions().isPendingResource(this, id))
             return;
 
         if (!id.isEmpty()) {
-            document().accessSVGExtensions()->addPendingResource(id, this);
+            document().accessSVGExtensions().addPendingResource(id, this);
             ASSERT(hasPendingResources());
         }
     } else {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions()->addElementReferencingTarget(this, svgTarget);
+        document().accessSVGExtensions().addElementReferencingTarget(this, svgTarget);
     }
 }