Title: [224615] trunk/Source/WebCore
Revision
224615
Author
[email protected]
Date
2017-11-08 19:55:05 -0800 (Wed, 08 Nov 2017)

Log Message

Replace some stack raw pointers with RefPtrs within WebCore/svg
https://bugs.webkit.org/show_bug.cgi?id=179314
<rdar://problem/34842204>

Reviewed by Ryosuke Niwa.

Besides replacing pointers directly, some of the methods are changed to return
RefPtrs as well.

No changes in behaviors.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
* dom/EventPath.h:
(WebCore::EventPath::eventTargetRespectingTargetRules):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToAnchor):
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
* svg/SVGAltGlyphElement.cpp:
(WebCore::SVGAltGlyphElement::hasValidGlyphElements const):
* svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::hasValidAttributeType):
(WebCore::SVGAnimateElementBase::calculateAnimatedValue):
(WebCore::SVGAnimateElementBase::calculateFromAndToValues):
(WebCore::SVGAnimateElementBase::calculateFromAndByValues):
(WebCore::SVGAnimateElementBase::resetAnimatedType):
(WebCore::SVGAnimateElementBase::applyResultsToTarget):
(WebCore::SVGAnimateElementBase::calculateDistance):
* svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::hasValidAttributeType):
(WebCore::SVGAnimateMotionElement::updateAnimationPath):
(WebCore::SVGAnimateMotionElement::resetAnimatedType):
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
(WebCore::SVGAnimateMotionElement::applyResultsToTarget):
* svg/SVGAnimateTransformElement.cpp:
(WebCore::SVGAnimateTransformElement::hasValidAttributeType):
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::adjustForInheritance):
(WebCore::SVGAnimationElement::determinePropertyValueTypes):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::rootElement):
(WebCore::SVGDocument::zoomAndPanEnabled const):
(WebCore::SVGDocument::startPan):
(WebCore::SVGDocument::updatePan const):
* svg/SVGDocument.h:
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap):
* svg/SVGDocumentExtensions.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::correspondingUseElement const):
(WebCore::SVGElement::setCorrespondingElement):
(WebCore::SVGElement::resolveCustomStyle):
(WebCore::SVGElement::computedStyle):
(WebCore::SVGElement::buildPendingResourcesIfNeeded):
(WebCore::SVGElement::updateRelativeLengthsInformation):
(WebCore::SVGElement::invalidateInstances):
* svg/SVGElement.h:
* svg/SVGFEBlendElement.cpp:
(WebCore::SVGFEBlendElement::build):
* svg/SVGFEColorMatrixElement.cpp:
(WebCore::SVGFEColorMatrixElement::build):
* svg/SVGFEComponentTransferElement.cpp:
(WebCore::SVGFEComponentTransferElement::build):
* svg/SVGFECompositeElement.cpp:
(WebCore::SVGFECompositeElement::build):
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::build):
* svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::build):
* svg/SVGFEDisplacementMapElement.cpp:
(WebCore::SVGFEDisplacementMapElement::build):
* svg/SVGFEDropShadowElement.cpp:
(WebCore::SVGFEDropShadowElement::build):
* svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::build):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::buildPendingResource):
(WebCore::SVGFEImageElement::notifyFinished):
* svg/SVGFELightElement.cpp:
(WebCore::SVGFELightElement::findLightSource):
(WebCore::SVGFELightElement::svgAttributeChanged):
(WebCore::SVGFELightElement::childrenChanged):
* svg/SVGFEMergeElement.cpp:
(WebCore::SVGFEMergeElement::build):
* svg/SVGFEMorphologyElement.cpp:
(WebCore::SVGFEMorphologyElement::build):
* svg/SVGFEOffsetElement.cpp:
(WebCore::SVGFEOffsetElement::build):
* svg/SVGFESpecularLightingElement.cpp:
(WebCore::SVGFESpecularLightingElement::build):
* svg/SVGFETileElement.cpp:
(WebCore::SVGFETileElement::build):
* svg/SVGFilterPrimitiveStandardAttributes.cpp:
(WebCore::invalidateFilterPrimitiveParent):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):
* svg/SVGFontFaceFormatElement.cpp:
(WebCore::SVGFontFaceFormatElement::childrenChanged):
* svg/SVGFontFaceUriElement.cpp:
(WebCore::SVGFontFaceUriElement::childrenChanged):
* svg/SVGForeignObjectElement.cpp:
(WebCore::SVGForeignObjectElement::rendererIsNeeded):
* svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::determineViewport const):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::collectGradientAttributes):
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::buildPendingResource):
(WebCore::SVGMPathElement::pathElement):
* svg/SVGMPathElement.h:
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::collectGradientAttributes):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::frameForCurrentScale const):
(WebCore::SVGSVGElement::currentScale const):
(WebCore::SVGSVGElement::setCurrentScale):
(WebCore::SVGSVGElement::deselectAll):
(WebCore::SVGSVGElement::localCoordinateSpaceTransform const):
(WebCore::SVGSVGElement::scrollToAnchor):
(WebCore::SVGSVGElement::getElementById):
* svg/SVGSVGElement.h:
* svg/SVGStyleElement.cpp:
(WebCore::SVGStyleElement::setDisabled):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::elementFromRenderer):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::buildPendingResource):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):
(WebCore::SVGUseElement::svgAttributeChanged):
(WebCore::SVGUseElement::targetClone const):
(WebCore::SVGUseElement::toClipPath):
(WebCore::SVGUseElement::rendererClipChild const):
(WebCore::SVGUseElement::findTarget const):
(WebCore::SVGUseElement::invalidateDependentShadowTrees):
(WebCore::SVGUseElement::selfHasRelativeLengths const):
* svg/SVGUseElement.h:
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::updateAnimations):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::buildPendingResource):
(WebCore::SVGSMILElement::insertedIntoAncestor):
(WebCore::SVGSMILElement::connectConditions):
(WebCore::SVGSMILElement::disconnectConditions):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::rootElement const):
(WebCore::SVGImage::hasSingleSecurityOrigin const):
(WebCore::SVGImage::setContainerSize):
(WebCore::SVGImage::containerSize const):
(WebCore::SVGImage::draw):
(WebCore::SVGImage::embeddedContentBox const):
(WebCore::SVGImage::hasRelativeWidth const):
(WebCore::SVGImage::hasRelativeHeight const):
(WebCore::SVGImage::computeIntrinsicDimensions):
(WebCore::SVGImage::startAnimation):
(WebCore::SVGImage::stopAnimation):
(WebCore::SVGImage::isAnimating const):
(WebCore::SVGImage::reportApproximateMemoryCost const):
* svg/graphics/SVGImage.h:
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):
* svg/graphics/filters/SVGFilterBuilder.cpp:
(WebCore::SVGFilterBuilder::getEffectById const):
* svg/graphics/filters/SVGFilterBuilder.h:
* svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
* svg/properties/SVGListPropertyTearOff.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224614 => 224615)


--- trunk/Source/WebCore/ChangeLog	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/ChangeLog	2017-11-09 03:55:05 UTC (rev 224615)
@@ -1,3 +1,178 @@
+2017-11-08  Jiewen Tan  <[email protected]>
+
+        Replace some stack raw pointers with RefPtrs within WebCore/svg
+        https://bugs.webkit.org/show_bug.cgi?id=179314
+        <rdar://problem/34842204>
+
+        Reviewed by Ryosuke Niwa.
+
+        Besides replacing pointers directly, some of the methods are changed to return
+        RefPtrs as well.
+
+        No changes in behaviors.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
+        * dom/EventPath.h:
+        (WebCore::EventPath::eventTargetRespectingTargetRules):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToAnchor):
+        * svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::defaultEventHandler):
+        * svg/SVGAltGlyphElement.cpp:
+        (WebCore::SVGAltGlyphElement::hasValidGlyphElements const):
+        * svg/SVGAnimateElementBase.cpp:
+        (WebCore::SVGAnimateElementBase::hasValidAttributeType):
+        (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
+        (WebCore::SVGAnimateElementBase::calculateFromAndToValues):
+        (WebCore::SVGAnimateElementBase::calculateFromAndByValues):
+        (WebCore::SVGAnimateElementBase::resetAnimatedType):
+        (WebCore::SVGAnimateElementBase::applyResultsToTarget):
+        (WebCore::SVGAnimateElementBase::calculateDistance):
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::SVGAnimateMotionElement::hasValidAttributeType):
+        (WebCore::SVGAnimateMotionElement::updateAnimationPath):
+        (WebCore::SVGAnimateMotionElement::resetAnimatedType):
+        (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
+        (WebCore::SVGAnimateMotionElement::applyResultsToTarget):
+        * svg/SVGAnimateTransformElement.cpp:
+        (WebCore::SVGAnimateTransformElement::hasValidAttributeType):
+        * svg/SVGAnimatedPath.cpp:
+        (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
+        * svg/SVGAnimationElement.cpp:
+        (WebCore::SVGAnimationElement::adjustForInheritance):
+        (WebCore::SVGAnimationElement::determinePropertyValueTypes):
+        * svg/SVGDocument.cpp:
+        (WebCore::SVGDocument::rootElement):
+        (WebCore::SVGDocument::zoomAndPanEnabled const):
+        (WebCore::SVGDocument::startPan):
+        (WebCore::SVGDocument::updatePan const):
+        * svg/SVGDocument.h:
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap):
+        * svg/SVGDocumentExtensions.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::~SVGElement):
+        (WebCore::SVGElement::correspondingUseElement const):
+        (WebCore::SVGElement::setCorrespondingElement):
+        (WebCore::SVGElement::resolveCustomStyle):
+        (WebCore::SVGElement::computedStyle):
+        (WebCore::SVGElement::buildPendingResourcesIfNeeded):
+        (WebCore::SVGElement::updateRelativeLengthsInformation):
+        (WebCore::SVGElement::invalidateInstances):
+        * svg/SVGElement.h:
+        * svg/SVGFEBlendElement.cpp:
+        (WebCore::SVGFEBlendElement::build):
+        * svg/SVGFEColorMatrixElement.cpp:
+        (WebCore::SVGFEColorMatrixElement::build):
+        * svg/SVGFEComponentTransferElement.cpp:
+        (WebCore::SVGFEComponentTransferElement::build):
+        * svg/SVGFECompositeElement.cpp:
+        (WebCore::SVGFECompositeElement::build):
+        * svg/SVGFEConvolveMatrixElement.cpp:
+        (WebCore::SVGFEConvolveMatrixElement::build):
+        * svg/SVGFEDiffuseLightingElement.cpp:
+        (WebCore::SVGFEDiffuseLightingElement::build):
+        * svg/SVGFEDisplacementMapElement.cpp:
+        (WebCore::SVGFEDisplacementMapElement::build):
+        * svg/SVGFEDropShadowElement.cpp:
+        (WebCore::SVGFEDropShadowElement::build):
+        * svg/SVGFEGaussianBlurElement.cpp:
+        (WebCore::SVGFEGaussianBlurElement::build):
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::buildPendingResource):
+        (WebCore::SVGFEImageElement::notifyFinished):
+        * svg/SVGFELightElement.cpp:
+        (WebCore::SVGFELightElement::findLightSource):
+        (WebCore::SVGFELightElement::svgAttributeChanged):
+        (WebCore::SVGFELightElement::childrenChanged):
+        * svg/SVGFEMergeElement.cpp:
+        (WebCore::SVGFEMergeElement::build):
+        * svg/SVGFEMorphologyElement.cpp:
+        (WebCore::SVGFEMorphologyElement::build):
+        * svg/SVGFEOffsetElement.cpp:
+        (WebCore::SVGFEOffsetElement::build):
+        * svg/SVGFESpecularLightingElement.cpp:
+        (WebCore::SVGFESpecularLightingElement::build):
+        * svg/SVGFETileElement.cpp:
+        (WebCore::SVGFETileElement::build):
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+        (WebCore::invalidateFilterPrimitiveParent):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::rebuildFontFace):
+        * svg/SVGFontFaceFormatElement.cpp:
+        (WebCore::SVGFontFaceFormatElement::childrenChanged):
+        * svg/SVGFontFaceUriElement.cpp:
+        (WebCore::SVGFontFaceUriElement::childrenChanged):
+        * svg/SVGForeignObjectElement.cpp:
+        (WebCore::SVGForeignObjectElement::rendererIsNeeded):
+        * svg/SVGLengthContext.cpp:
+        (WebCore::SVGLengthContext::determineViewport const):
+        * svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::collectGradientAttributes):
+        * svg/SVGMPathElement.cpp:
+        (WebCore::SVGMPathElement::buildPendingResource):
+        (WebCore::SVGMPathElement::pathElement):
+        * svg/SVGMPathElement.h:
+        * svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::collectGradientAttributes):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::frameForCurrentScale const):
+        (WebCore::SVGSVGElement::currentScale const):
+        (WebCore::SVGSVGElement::setCurrentScale):
+        (WebCore::SVGSVGElement::deselectAll):
+        (WebCore::SVGSVGElement::localCoordinateSpaceTransform const):
+        (WebCore::SVGSVGElement::scrollToAnchor):
+        (WebCore::SVGSVGElement::getElementById):
+        * svg/SVGSVGElement.h:
+        * svg/SVGStyleElement.cpp:
+        (WebCore::SVGStyleElement::setDisabled):
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::detachTarget):
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::elementFromRenderer):
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::buildPendingResource):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):
+        (WebCore::SVGUseElement::svgAttributeChanged):
+        (WebCore::SVGUseElement::targetClone const):
+        (WebCore::SVGUseElement::toClipPath):
+        (WebCore::SVGUseElement::rendererClipChild const):
+        (WebCore::SVGUseElement::findTarget const):
+        (WebCore::SVGUseElement::invalidateDependentShadowTrees):
+        (WebCore::SVGUseElement::selfHasRelativeLengths const):
+        * svg/SVGUseElement.h:
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::updateAnimations):
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::buildPendingResource):
+        (WebCore::SVGSMILElement::insertedIntoAncestor):
+        (WebCore::SVGSMILElement::connectConditions):
+        (WebCore::SVGSMILElement::disconnectConditions):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::rootElement const):
+        (WebCore::SVGImage::hasSingleSecurityOrigin const):
+        (WebCore::SVGImage::setContainerSize):
+        (WebCore::SVGImage::containerSize const):
+        (WebCore::SVGImage::draw):
+        (WebCore::SVGImage::embeddedContentBox const):
+        (WebCore::SVGImage::hasRelativeWidth const):
+        (WebCore::SVGImage::hasRelativeHeight const):
+        (WebCore::SVGImage::computeIntrinsicDimensions):
+        (WebCore::SVGImage::startAnimation):
+        (WebCore::SVGImage::stopAnimation):
+        (WebCore::SVGImage::isAnimating const):
+        (WebCore::SVGImage::reportApproximateMemoryCost const):
+        * svg/graphics/SVGImage.h:
+        * svg/graphics/filters/SVGFEImage.cpp:
+        (WebCore::FEImage::platformApplySoftware):
+        * svg/graphics/filters/SVGFilterBuilder.cpp:
+        (WebCore::SVGFilterBuilder::getEffectById const):
+        * svg/graphics/filters/SVGFilterBuilder.h:
+        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
+        * svg/properties/SVGListPropertyTearOff.h:
+
 2017-11-08  Zalan Bujtas  <[email protected]>
 
         [LayoutState cleanup] LayoutContext should own the stack of LayoutState objects

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (224614 => 224615)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -3061,7 +3061,7 @@
     if (!is<SVGDocument>(document))
         return nullptr;
     
-    SVGSVGElement* rootElement = SVGDocument::rootElement(*document);
+    auto rootElement = SVGDocument::rootElement(*document);
     if (!rootElement)
         return nullptr;
     RenderObject* rendererRoot = rootElement->renderer();

Modified: trunk/Source/WebCore/dom/EventPath.h (224614 => 224615)


--- trunk/Source/WebCore/dom/EventPath.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/dom/EventPath.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -63,8 +63,8 @@
 
     // Events sent to elements inside an SVG use element's shadow tree go to the use element.
     if (is<SVGElement>(referenceNode)) {
-        if (auto* useElement = downcast<SVGElement>(referenceNode).correspondingUseElement())
-            return useElement;
+        if (auto useElement = downcast<SVGElement>(referenceNode).correspondingUseElement())
+            return useElement.get();
     }
 
     return &referenceNode;

Modified: trunk/Source/WebCore/page/FrameView.cpp (224614 => 224615)


--- trunk/Source/WebCore/page/FrameView.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/page/FrameView.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -2126,7 +2126,7 @@
     document.setCSSTarget(anchorElement);
 
     if (is<SVGDocument>(document)) {
-        if (auto* rootElement = SVGDocument::rootElement(document)) {
+        if (auto rootElement = SVGDocument::rootElement(document)) {
             rootElement->scrollToAnchor(name, anchorElement);
             if (!anchorElement)
                 return true;

Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -125,7 +125,7 @@
             String url = ""
 
             if (url[0] == '#') {
-                Element* targetElement = treeScope().getElementById(url.substringSharingImpl(1));
+                auto targetElement = makeRefPtr(treeScope().getElementById(url.substringSharingImpl(1)));
                 if (is<SVGSMILElement>(targetElement)) {
                     downcast<SVGSMILElement>(*targetElement).beginByLinkActivation();
                     event.setDefaultHandled();
@@ -141,7 +141,7 @@
                 target = "_blank";
             event.setDefaultHandled();
 
-            Frame* frame = document().frame();
+            auto frame = makeRefPtr(document().frame());
             if (!frame)
                 return;
             frame->loader().urlSelected(document().completeURL(url), target, &event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());

Modified: trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -87,7 +87,7 @@
 bool SVGAltGlyphElement::hasValidGlyphElements(Vector<String>& glyphNames) const
 {
     String target;
-    auto* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target);
+    auto element = makeRefPtr(targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target));
 
     if (is<SVGGlyphElement>(element)) {
         glyphNames.append(target);

Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -46,8 +46,7 @@
 
 bool SVGAnimateElementBase::hasValidAttributeType()
 {
-    SVGElement* targetElement = this->targetElement();
-    if (!targetElement)
+    if (!this->targetElement())
         return false;
 
     return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeType();
@@ -85,7 +84,7 @@
 void SVGAnimateElementBase::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement* resultElement)
 {
     ASSERT(resultElement);
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return;
 
@@ -111,7 +110,7 @@
         percentage = percentage < 0.5 ? 0 : 1;
 
     // Target element might have changed.
-    m_animator->setContextElement(targetElement);
+    m_animator->setContextElement(targetElement.get());
 
     // Be sure to detach list wrappers before we modfiy their underlying value. If we'd do
     // if after calculateAnimatedValue() ran the cached pointers in the list propery tear
@@ -135,8 +134,7 @@
 
 bool SVGAnimateElementBase::calculateFromAndToValues(const String& fromString, const String& toString)
 {
-    SVGElement* targetElement = this->targetElement();
-    if (!targetElement)
+    if (!this->targetElement())
         return false;
 
     determinePropertyValueTypes(fromString, toString);
@@ -147,8 +145,7 @@
 
 bool SVGAnimateElementBase::calculateFromAndByValues(const String& fromString, const String& byString)
 {
-    SVGElement* targetElement = this->targetElement();
-    if (!targetElement)
+    if (!this->targetElement())
         return false;
 
     if (animationMode() == ByAnimation && !isAdditive())
@@ -189,12 +186,12 @@
     SVGAnimatedTypeAnimator* animator = ensureAnimator();
     ASSERT(m_animatedPropertyType == animator->type());
 
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return;
 
     const QualifiedName& attributeName = this->attributeName();
-    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName);
+    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement.get(), attributeName);
 
     if (shouldApply == DontApplyAnimation)
         return;
@@ -220,8 +217,8 @@
     String baseValue;
 
     if (shouldApply == ApplyCSSAnimation) {
-        ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName));
-        computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue);
+        ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement.get(), attributeName));
+        computeCSSPropertyValue(targetElement.get(), cssPropertyID(attributeName.localName()), baseValue);
     }
 
     if (!m_animatedType)
@@ -339,7 +336,7 @@
     if (!m_animatedType)
         return;
 
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     const QualifiedName& attributeName = this->attributeName();
 
     ASSERT(targetElement);
@@ -352,7 +349,7 @@
     }
 
     // We do update the style and the animation property independent of each other.
-    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName);
+    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement.get(), attributeName);
     if (shouldApply == ApplyXMLandCSSAnimation)
         applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->valueAsString());
 
@@ -406,8 +403,7 @@
 float SVGAnimateElementBase::calculateDistance(const String& fromString, const String& toString)
 {
     // FIXME: A return value of float is not enough to support paced animations on lists.
-    SVGElement* targetElement = this->targetElement();
-    if (!targetElement)
+    if (!this->targetElement())
         return -1;
 
     return ensureAnimator()->calculateDistance(fromString, toString);

Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -56,7 +56,7 @@
 
 bool SVGAnimateMotionElement::hasValidAttributeType()
 {
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return false;
 
@@ -122,9 +122,9 @@
     bool foundMPath = false;
 
     for (auto& mPath : childrenOfType<SVGMPathElement>(*this)) {
-        SVGPathElement* pathElement = mPath.pathElement();
+        auto pathElement = mPath.pathElement();
         if (pathElement) {
-            m_animationPath = pathFromGraphicsElement(pathElement);
+            m_animationPath = pathFromGraphicsElement(pathElement.get());
             foundMPath = true;
             break;
         }
@@ -165,7 +165,7 @@
 {
     if (!hasValidAttributeType())
         return;
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return;
     if (AffineTransform* transform = targetElement->supplementalTransform())
@@ -231,7 +231,7 @@
 
 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*)
 {
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return;
     AffineTransform* transform = targetElement->supplementalTransform();
@@ -271,7 +271,7 @@
 void SVGAnimateMotionElement::applyResultsToTarget()
 {
     // We accumulate to the target element transform list so there is not much to do here.
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     if (!targetElement)
         return;
 

Modified: trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -42,8 +42,7 @@
 
 bool SVGAnimateTransformElement::hasValidAttributeType()
 {
-    SVGElement* targetElement = this->targetElement();
-    if (!targetElement)
+    if (!this->targetElement())
         return false;
 
     if (attributeType() == AttributeType::CSS)

Modified: trunk/Source/WebCore/svg/SVGAnimatedPath.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAnimatedPath.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAnimatedPath.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -55,7 +55,7 @@
 
 void SVGAnimatedPathAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGPathByteStream* byteStream)
 {
-    SVGAnimatedPathSegListPropertyTearOff* property = castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(animatedTypes[0].properties[0].get());
+    RefPtr<SVGAnimatedPathSegListPropertyTearOff> property = castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(animatedTypes[0].properties[0].get());
     const auto& baseValue = property->currentBaseValue();
 
     buildSVGPathByteStreamFromSVGPathSegListValues(baseValue, *byteStream, UnalteredParsing);

Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -643,7 +643,7 @@
     // In the future we might want to work with the value type directly to avoid the String parsing.
     ASSERT(targetElement);
 
-    Element* parent = targetElement->parentElement();
+    auto parent = makeRefPtr(targetElement->parentElement());
     if (!parent || !parent->isSVGElement())
         return;
 
@@ -662,13 +662,13 @@
 
 void SVGAnimationElement::determinePropertyValueTypes(const String& from, const String& to)
 {
-    SVGElement* targetElement = this->targetElement();
+    auto targetElement = makeRefPtr(this->targetElement());
     ASSERT(targetElement);
 
     const QualifiedName& attributeName = this->attributeName();
-    if (inheritsFromProperty(targetElement, attributeName, from))
+    if (inheritsFromProperty(targetElement.get(), attributeName, from))
         m_fromPropertyValueType = InheritValue;
-    if (inheritsFromProperty(targetElement, attributeName, to))
+    if (inheritsFromProperty(targetElement.get(), attributeName, to))
         m_toPropertyValueType = InheritValue;
 }
 void SVGAnimationElement::resetAnimatedPropertyType()

Modified: trunk/Source/WebCore/svg/SVGDocument.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGDocument.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGDocument.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -32,7 +32,7 @@
 {
 }
 
-SVGSVGElement* SVGDocument::rootElement(const Document& document)
+RefPtr<SVGSVGElement> SVGDocument::rootElement(const Document& document)
 {
     auto* element = document.documentElement();
     if (!is<SVGSVGElement>(element))
@@ -42,7 +42,7 @@
 
 bool SVGDocument::zoomAndPanEnabled() const
 {
-    auto* element = rootElement(*this);
+    auto element = rootElement(*this);
     if (!element)
         return false;
     return (element->useCurrentView() ? element->currentView().zoomAndPan() : element->zoomAndPan()) == SVGZoomAndPanMagnify;
@@ -50,7 +50,7 @@
 
 void SVGDocument::startPan(const FloatPoint& start)
 {
-    auto* element = rootElement(*this);
+    auto element = rootElement(*this);
     if (!element)
         return;
     m_panningOffset = start - element->currentTranslateValue();
@@ -58,7 +58,7 @@
 
 void SVGDocument::updatePan(const FloatPoint& position) const
 {
-    auto* element = rootElement(*this);
+    auto element = rootElement(*this);
     if (!element)
         return;
     element->setCurrentTranslate(position - m_panningOffset);

Modified: trunk/Source/WebCore/svg/SVGDocument.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGDocument.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGDocument.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -31,7 +31,7 @@
 public:
     static Ref<SVGDocument> create(Frame*, const URL&);
 
-    static SVGSVGElement* rootElement(const Document&);
+    static RefPtr<SVGSVGElement> rootElement(const Document&);
 
     bool zoomAndPanEnabled() const;
     void startPan(const FloatPoint& start);

Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -262,7 +262,7 @@
         m_pendingResourcesForRemoval.add(id, WTFMove(existing));
 }
 
-Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap(const AtomicString& id)
+RefPtr<Element> SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap(const AtomicString& id)
 {
     if (id.isEmpty())
         return 0;
@@ -272,7 +272,7 @@
         return 0;
 
     auto firstElement = resourceSet->begin();
-    Element* element = *firstElement;
+    RefPtr<Element> element = *firstElement;
 
     resourceSet->remove(firstElement);
 

Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGDocumentExtensions.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -104,7 +104,7 @@
 
     // The following two functions are used for scheduling a pending resource to be removed.
     void markPendingResourcesForRemoval(const AtomicString&);
-    Element* removeElementFromPendingResourcesForRemovalMap(const AtomicString&);
+    RefPtr<Element> removeElementFromPendingResourcesForRemovalMap(const AtomicString&);
 
 private:
     bool isElementWithPendingResources(Element*) const;

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -288,7 +288,7 @@
     if (m_svgRareData) {
         for (SVGElement* instance : m_svgRareData->instances())
             instance->m_svgRareData->setCorrespondingElement(nullptr);
-        if (SVGElement* correspondingElement = m_svgRareData->correspondingElement())
+        if (auto correspondingElement = makeRefPtr(m_svgRareData->correspondingElement()))
             correspondingElement->m_svgRareData->instances().remove(this);
 
         m_svgRareData = nullptr;
@@ -430,7 +430,7 @@
     return m_svgRareData ? m_svgRareData->correspondingElement() : nullptr;
 }
 
-SVGUseElement* SVGElement::correspondingUseElement() const
+RefPtr<SVGUseElement> SVGElement::correspondingUseElement() const
 {
     auto* root = containingShadowRoot();
     if (!root)
@@ -446,7 +446,7 @@
 void SVGElement::setCorrespondingElement(SVGElement* correspondingElement)
 {
     if (m_svgRareData) {
-        if (SVGElement* oldCorrespondingElement = m_svgRareData->correspondingElement())
+        if (auto oldCorrespondingElement = makeRefPtr(m_svgRareData->correspondingElement()))
             oldCorrespondingElement->m_svgRareData->instances().remove(this);
     }
     if (m_svgRareData || correspondingElement)
@@ -729,7 +729,7 @@
 std::optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
 {
     // If the element is in a <use> tree we get the style from the definition tree.
-    if (auto* styleElement = this->correspondingElement())
+    if (auto styleElement = makeRefPtr(this->correspondingElement()))
         return styleElement->resolveStyle(&parentStyle);
 
     return resolveStyle(&parentStyle);
@@ -759,7 +759,7 @@
         return Element::computedStyle(pseudoElementSpecifier);
 
     const RenderStyle* parentStyle = nullptr;
-    if (Element* parent = parentOrShadowHostElement()) {
+    if (auto parent = makeRefPtr(parentOrShadowHostElement())) {
         if (auto renderer = parent->renderer())
             parentStyle = &renderer->style();
     }
@@ -1003,11 +1003,11 @@
     extensions.markPendingResourcesForRemoval(resourceId);
 
     // Rebuild pending resources for each client of a pending resource that is being removed.
-    while (Element* clientElement = extensions.removeElementFromPendingResourcesForRemovalMap(resourceId)) {
+    while (auto clientElement = extensions.removeElementFromPendingResourcesForRemovalMap(resourceId)) {
         ASSERT(clientElement->hasPendingResources());
         if (clientElement->hasPendingResources()) {
             clientElement->buildPendingResource();
-            extensions.clearHasPendingResourcesIfPossible(clientElement);
+            extensions.clearHasPendingResourcesIfPossible(clientElement.get());
         }
     }
 }
@@ -1086,7 +1086,7 @@
         return;
 
     // Find first styled parent node, and notify it that we've changed our relative length state.
-    ContainerNode* node = parentNode();
+    auto node = makeRefPtr(parentNode());
     while (node) {
         if (!node->isSVGElement())
             break;
@@ -1129,8 +1129,8 @@
 
     auto& instances = this->instances();
     while (!instances.isEmpty()) {
-        SVGElement* instance = *instances.begin();
-        if (SVGUseElement* useElement = instance->correspondingUseElement())
+        auto instance = makeRefPtr(*instances.begin());
+        if (auto useElement = instance->correspondingUseElement())
             useElement->invalidateShadowTree();
         instance->setCorrespondingElement(nullptr);
     } while (!instances.isEmpty());

Modified: trunk/Source/WebCore/svg/SVGElement.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGElement.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGElement.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -99,7 +99,7 @@
     bool getBoundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate);
 
     SVGElement* correspondingElement() const;
-    SVGUseElement* correspondingUseElement() const;
+    RefPtr<SVGUseElement> correspondingUseElement() const;
 
     void setCorrespondingElement(SVGElement*);
 

Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEBlendElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -105,8 +105,8 @@
 
 RefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    auto input1 = filterBuilder->getEffectById(in1());
+    auto input2 = filterBuilder->getEffectById(in2());
 
     if (!input1 || !input2)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -108,7 +108,7 @@
 
 RefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -64,7 +64,7 @@
 
 RefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
     
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFECompositeElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -140,8 +140,8 @@
 
 RefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    auto input1 = filterBuilder->getEffectById(in1());
+    auto input2 = filterBuilder->getEffectById(in2());
     
     if (!input1 || !input2)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -234,7 +234,7 @@
 
 RefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    auto* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -172,7 +172,7 @@
 
 RefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -123,8 +123,8 @@
 
 RefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    auto input1 = filterBuilder->getEffectById(in1());
+    auto input2 = filterBuilder->getEffectById(in2());
     
     if (!input1 || !input2)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -133,7 +133,7 @@
     const Color& color = svgStyle.floodColor();
     float opacity = svgStyle.floodOpacity();
 
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
     if (!input1)
         return nullptr;
 

Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -115,7 +115,7 @@
 
 RefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -102,7 +102,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(href(), document(), &id));
     if (!target) {
         if (id.isEmpty())
             requestImageResource();
@@ -113,7 +113,7 @@
     } 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.get()));
     }
 
     invalidate();
@@ -173,7 +173,7 @@
     if (!isConnected())
         return;
 
-    Element* parent = parentElement();
+    auto parent = makeRefPtr(parentElement());
 
     if (!parent || !parent->hasTagName(SVGNames::filterTag))
         return;

Modified: trunk/Source/WebCore/svg/SVGFELightElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFELightElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFELightElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -79,7 +79,7 @@
 
 RefPtr<LightSource> SVGFELightElement::findLightSource(const SVGElement* svgElement)
 {
-    SVGFELightElement* lightNode = findLightElement(svgElement);
+    auto lightNode = makeRefPtr(findLightElement(svgElement));
     if (!lightNode)
         return 0;
     return lightNode->lightSource();
@@ -147,7 +147,7 @@
         || attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr
         || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::limitingConeAngleAttr) {
 
-        auto* parent = parentElement();
+        auto parent = makeRefPtr(parentElement());
         if (!parent)
             return;
 
@@ -175,7 +175,7 @@
 
     if (change.source == ChildChangeSource::Parser)
         return;
-    ContainerNode* parent = parentNode();
+    auto parent = makeRefPtr(parentNode());
     if (!parent)
         return;
     RenderElement* renderer = parent->renderer();

Modified: trunk/Source/WebCore/svg/SVGFEMergeElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEMergeElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEMergeElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -47,10 +47,10 @@
     FilterEffectVector& mergeInputs = effect->inputEffects();
 
     for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) {
-        FilterEffect* mergeEffect = filterBuilder->getEffectById(mergeNode.in1());
+        auto mergeEffect = filterBuilder->getEffectById(mergeNode.in1());
         if (!mergeEffect)
             return nullptr;
-        mergeInputs.append(mergeEffect);
+        mergeInputs.append(WTFMove(mergeEffect));
     }
 
     if (mergeInputs.isEmpty())

Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -134,7 +134,7 @@
 
 RefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
     float xRadius = radiusX();
     float yRadius = radiusY();
 

Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -85,7 +85,7 @@
 
 RefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -183,7 +183,7 @@
 
 RefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFETileElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFETileElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFETileElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -72,7 +72,7 @@
 
 RefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    auto input1 = filterBuilder->getEffectById(in1());
 
     if (!input1)
         return nullptr;

Modified: trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -154,7 +154,7 @@
     if (!element)
         return;
 
-    ContainerNode* parent = element->parentNode();
+    auto parent = makeRefPtr(element->parentNode());
 
     if (!parent)
         return;

Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -263,7 +263,7 @@
 
         unsigned srcLength = srcList ? srcList->length() : 0;
         for (unsigned i = 0; i < srcLength; ++i) {
-            if (CSSFontFaceSrcValue* item = downcast<CSSFontFaceSrcValue>(srcList->itemWithoutBoundsCheck(i)))
+            if (auto item = makeRefPtr(downcast<CSSFontFaceSrcValue>(srcList->itemWithoutBoundsCheck(i))))
                 item->setSVGFontFaceElement(this);
         }
     }

Modified: trunk/Source/WebCore/svg/SVGFontFaceFormatElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFontFaceFormatElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFontFaceFormatElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -47,7 +47,7 @@
     if (!parentNode() || !parentNode()->hasTagName(font_face_uriTag))
         return;
     
-    ContainerNode* ancestor = parentNode()->parentNode();
+    auto ancestor = makeRefPtr(parentNode()->parentNode());
     if (!ancestor || !ancestor->hasTagName(font_face_srcTag))
         return;
     

Modified: trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -76,7 +76,7 @@
     if (!parentNode() || !parentNode()->hasTagName(font_face_srcTag))
         return;
     
-    ContainerNode* grandparent = parentNode()->parentNode();
+    auto grandparent = makeRefPtr(parentNode()->parentNode());
     if (grandparent && grandparent->hasTagName(font_faceTag))
         downcast<SVGFontFaceElement>(*grandparent).rebuildFontFace();
 }

Modified: trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -142,7 +142,7 @@
     // Note that we currently do not support foreignObject instantiation via <use>, hence it is safe
     // to use parentElement() here. If that changes, this method should be updated to use
     // parentOrShadowHostElement() instead.
-    Element* ancestor = parentElement();
+    auto ancestor = makeRefPtr(parentElement());
     while (ancestor && ancestor->isSVGElement()) {
         if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer())
             return false;

Modified: trunk/Source/WebCore/svg/SVGLengthContext.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGLengthContext.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGLengthContext.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -301,7 +301,7 @@
     }
 
     // Take size from nearest viewport element.
-    SVGElement* viewportElement = m_context->viewportElement();
+    auto viewportElement = makeRefPtr(m_context->viewportElement());
     if (!is<SVGSVGElement>(viewportElement))
         return false;
 

Modified: trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -162,9 +162,9 @@
 
     while (true) {
         // Respect xlink:href, take attributes from referenced element
-        Node* refNode = SVGURIReference::targetElementFromIRIString(current->href(), document());
+        auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->href(), document()));
         if (is<SVGGradientElement>(refNode)) {
-            current = downcast<SVGGradientElement>(refNode);
+            current = downcast<SVGGradientElement>(refNode.get());
 
             // Cycle detection
             if (processedGradients.contains(current))

Modified: trunk/Source/WebCore/svg/SVGMPathElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGMPathElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGMPathElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -62,7 +62,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    auto target = makeRefPtr(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))
@@ -75,7 +75,7 @@
     } 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.get()));
     }
 
     targetPathChanged();
@@ -125,7 +125,7 @@
     SVGElement::svgAttributeChanged(attrName);
 }
 
-SVGPathElement* SVGMPathElement::pathElement()
+RefPtr<SVGPathElement> SVGMPathElement::pathElement()
 {
     Element* target = targetElementFromIRIString(href(), document());
     if (is<SVGPathElement>(target))

Modified: trunk/Source/WebCore/svg/SVGMPathElement.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGMPathElement.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGMPathElement.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -36,7 +36,7 @@
 
     virtual ~SVGMPathElement();
 
-    SVGPathElement* pathElement();
+    RefPtr<SVGPathElement> pathElement();
 
     void targetPathChanged();
 

Modified: trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -178,9 +178,9 @@
 
     while (true) {
         // Respect xlink:href, take attributes from referenced element
-        Node* refNode = SVGURIReference::targetElementFromIRIString(current->href(), document());
+        auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->href(), document()));
         if (is<SVGGradientElement>(refNode)) {
-            current = downcast<SVGGradientElement>(refNode);
+            current = downcast<SVGGradientElement>(refNode.get());
 
             // Cycle detection
             if (processedGradients.contains(current))

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -166,13 +166,13 @@
     return *m_viewSpec;
 }
 
-Frame* SVGSVGElement::frameForCurrentScale() const
+RefPtr<Frame> SVGSVGElement::frameForCurrentScale() const
 {
     // The behavior of currentScale() is undefined when we're dealing with non-standalone SVG documents.
     // If the document is embedded, the scaling is handled by the host renderer.
     if (!isConnected() || !isOutermostSVGSVGElement())
         return nullptr;
-    Frame* frame = document().frame();
+    auto frame = makeRefPtr(document().frame());
     return frame && frame->isMainFrame() ? frame : nullptr;
 }
 
@@ -180,13 +180,13 @@
 {
     // When asking from inside an embedded SVG document, a scale value of 1 seems reasonable, as it doesn't
     // know anything about the parent scale.
-    Frame* frame = frameForCurrentScale();
+    auto frame = frameForCurrentScale();
     return frame ? frame->pageZoomFactor() : 1;
 }
 
 void SVGSVGElement::setCurrentScale(float scale)
 {
-    if (Frame* frame = frameForCurrentScale())
+    if (auto frame = frameForCurrentScale())
         frame->setPageZoomFactor(scale);
 }
 
@@ -373,7 +373,7 @@
 
 void SVGSVGElement::deselectAll()
 {
-    if (Frame* frame = document().frame())
+    if (auto frame = makeRefPtr(document().frame()))
         frame->selection().clear();
 }
 
@@ -453,7 +453,7 @@
             transform.translate(location.x() - viewBoxTransform.e(), location.y() - viewBoxTransform.f());
 
             // Respect scroll offset.
-            if (FrameView* view = document().view()) {
+            if (auto view = makeRefPtr(document().view())) {
                 LayoutPoint scrollPosition = view->scrollPosition();
                 scrollPosition.scale(zoomFactor);
                 transform.translate(-scrollPosition);
@@ -638,7 +638,7 @@
 void SVGSVGElement::scrollToAnchor(const String& fragmentIdentifier, Element* anchorNode)
 {
     auto renderer = this->renderer();
-    SVGViewSpec* view = m_viewSpec.get();
+    auto view = m_viewSpec;
     if (view)
         view->reset();
 
@@ -670,7 +670,7 @@
     // attributes on the closest ancestor "svg" element.
     if (is<SVGViewElement>(anchorNode)) {
         auto& viewElement = downcast<SVGViewElement>(*anchorNode);
-        auto* viewportElement = SVGLocatable::nearestViewportElement(&viewElement);
+        auto viewportElement = makeRefPtr(SVGLocatable::nearestViewportElement(&viewElement));
         if (is<SVGSVGElement>(viewportElement)) {
             auto& element = downcast<SVGSVGElement>(*viewportElement);
             element.inheritViewAttributes(viewElement);
@@ -722,9 +722,9 @@
     if (id.isNull())
         return nullptr;
 
-    Element* element = treeScope().getElementById(id);
+    auto element = makeRefPtr(treeScope().getElementById(id));
     if (element && element->isDescendantOf(*this))
-        return element;
+        return element.get();
     if (treeScope().containsMultipleElementsWithId(id)) {
         for (auto* element : *treeScope().getAllElementsById(id)) {
             if (element->isDescendantOf(*this))

Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGSVGElement.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -151,7 +151,7 @@
     void resumeFromDocumentSuspension() override;
     AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
 
-    Frame* frameForCurrentScale() const;
+    RefPtr<Frame> frameForCurrentScale() const;
     void inheritViewAttributes(const SVGViewElement&);
     Ref<NodeList> collectIntersectionOrEnclosureList(SVGRect&, SVGElement*, bool (*checkFunction)(SVGElement&, SVGRect&));
 

Modified: trunk/Source/WebCore/svg/SVGStyleElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGStyleElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGStyleElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -55,7 +55,7 @@
 
 void SVGStyleElement::setDisabled(bool setDisabled)
 {
-    if (CSSStyleSheet* styleSheet = sheet())
+    if (auto styleSheet = makeRefPtr(sheet()))
         styleSheet->setDisabled(setDisabled);
 }
 

Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGTRefElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -163,7 +163,7 @@
     String emptyContent;
 
     ASSERT(shadowRoot());
-    Node* container = shadowRoot()->firstChild();
+    auto container = makeRefPtr(shadowRoot()->firstChild());
     if (container)
         container->setTextContent(emptyContent);
 

Modified: trunk/Source/WebCore/svg/SVGTextContentElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGTextContentElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGTextContentElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -272,7 +272,7 @@
     SVGElement* element = downcast<SVGElement>(renderer->node());
     ASSERT(element);
 
-    if (!is<SVGTextContentElement>(*element))
+    if (!is<SVGTextContentElement>(element))
         return nullptr;
 
     return downcast<SVGTextContentElement>(element);

Modified: trunk/Source/WebCore/svg/SVGTextPathElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGTextPathElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGTextPathElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -156,7 +156,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    auto target = makeRefPtr(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))
@@ -169,7 +169,7 @@
     } 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.get()));
     }
 }
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -142,7 +142,7 @@
     } else if (is<SVGSVGElement>(shadowElement)) {
         // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these
         // values will override the corresponding attributes on the 'svg' in the generated tree.
-        SVGElement* correspondingElement = shadowElement.correspondingElement();
+        auto correspondingElement = makeRefPtr(shadowElement.correspondingElement());
         shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));
         shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));
     }
@@ -156,7 +156,7 @@
         updateRelativeLengthsInformation();
         if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
             // FIXME: It's unnecessarily inefficient to update both width and height each time either is changed.
-            if (auto* targetClone = this->targetClone())
+            if (auto targetClone = this->targetClone())
                 transferSizeAttributesToTargetClone(*targetClone);
         }
         if (auto* renderer = this->renderer())
@@ -266,7 +266,7 @@
     m_shadowTreeNeedsUpdate = false;
 }
 
-SVGElement* SVGUseElement::targetClone() const
+RefPtr<SVGElement> SVGUseElement::targetClone() const
 {
     auto root = userAgentShadowRoot();
     if (!root)
@@ -293,7 +293,7 @@
 
 Path SVGUseElement::toClipPath()
 {
-    auto* targetClone = this->targetClone();
+    auto targetClone = this->targetClone();
     if (!is<SVGGraphicsElement>(targetClone))
         return { };
 
@@ -313,7 +313,7 @@
 
 RenderElement* SVGUseElement::rendererClipChild() const
 {
-    auto* targetClone = this->targetClone();
+    auto targetClone = this->targetClone();
     if (!targetClone)
         return nullptr;
     if (!isDirectReference(*targetClone))
@@ -405,7 +405,7 @@
     auto* correspondingElement = this->correspondingElement();
     auto& original = correspondingElement ? downcast<SVGUseElement>(*correspondingElement) : *this;
 
-    auto* targetCandidate = targetElementFromIRIString(original.href(), original.document(), targetID, original.externalDocument());
+    auto targetCandidate = makeRefPtr(targetElementFromIRIString(original.href(), original.document(), targetID, original.externalDocument()));
     if (targetID && !targetID->isNull()) {
         // If the reference is external, don't return the target ID to the caller.
         // The caller would use the target ID to wait for a pending resource on the wrong document.
@@ -538,7 +538,7 @@
 void SVGUseElement::invalidateDependentShadowTrees()
 {
     for (auto* instance : instances()) {
-        if (auto* element = instance->correspondingUseElement())
+        if (auto element = instance->correspondingUseElement())
             element->invalidateShadowTree();
     }
 }
@@ -548,7 +548,7 @@
     if (x().isRelative() || y().isRelative() || width().isRelative() || height().isRelative())
         return true;
 
-    auto* targetClone = this->targetClone();
+    auto targetClone = this->targetClone();
     return targetClone && targetClone->hasRelativeLengths();
 }
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.h (224614 => 224615)


--- trunk/Source/WebCore/svg/SVGUseElement.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/SVGUseElement.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -79,7 +79,7 @@
     SVGElement* findTarget(String* targetID = nullptr) const;
 
     void cloneTarget(ContainerNode&, SVGElement& target) const;
-    SVGElement* targetClone() const;
+    RefPtr<SVGElement> targetClone() const;
 
     void updateShadowTree();
     void expandUseElementsInShadowTree() const;

Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -288,7 +288,7 @@
         // have higher priority.
         sortByPriority(*scheduled, elapsed);
 
-        SVGSMILElement* resultElement = nullptr;
+        RefPtr<SVGSMILElement> resultElement;
         for (auto& animation : *scheduled) {
             ASSERT(animation->timeContainer() == this);
             ASSERT(animation->targetElement());
@@ -302,7 +302,7 @@
             }
 
             // This will calculate the contribution from the animation and add it to the resultsElement.
-            if (!animation->progress(elapsed, resultElement, seekToTime) && resultElement == animation)
+            if (!animation->progress(elapsed, resultElement.get(), seekToTime) && resultElement == animation)
                 resultElement = nullptr;
 
             SMILTime nextFireTime = animation->nextProgressTime();
@@ -311,7 +311,7 @@
         }
 
         if (resultElement)
-            animationsToApply.append(resultElement);
+            animationsToApply.append(resultElement.get());
     }
 
     if (animationsToApply.isEmpty()) {

Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -176,13 +176,13 @@
     }
 
     String id;
-    Element* target;
+    RefPtr<Element> target;
     auto& href = ""
     if (href.isEmpty())
         target = parentElement();
     else
         target = SVGURIReference::targetElementFromIRIString(href.string(), document(), &id);
-    SVGElement* svgTarget = is<SVGElement>(target) ? downcast<SVGElement>(target) : nullptr;
+    SVGElement* svgTarget = is<SVGElement>(target) ? downcast<SVGElement>(target.get()) : nullptr;
 
     if (svgTarget && !svgTarget->isConnected())
         svgTarget = nullptr;
@@ -263,7 +263,7 @@
 
     updateAttributeName();
 
-    SVGSVGElement* owner = ownerSVGElement();
+    auto owner = makeRefPtr(ownerSVGElement());
     if (!owner)
         return InsertedIntoAncestorResult::Done;
 
@@ -544,7 +544,7 @@
     for (auto& condition : m_conditions) {
         if (condition.m_type == Condition::EventBase) {
             ASSERT(!condition.m_syncbase);
-            Element* eventBase = eventBaseFor(condition);
+            auto eventBase = makeRefPtr(eventBaseFor(condition));
             if (!eventBase)
                 continue;
             ASSERT(!condition.m_eventListener);
@@ -579,7 +579,7 @@
             // no guarantee that eventBaseFor() will be able to find our condition's
             // original eventBase. So, we also have to disconnect ourselves from
             // our condition event listener, in case it later fires.
-            Element* eventBase = eventBaseFor(condition);
+            auto eventBase = makeRefPtr(eventBaseFor(condition));
             if (eventBase)
                 eventBase->removeEventListener(condition.m_name, *condition.m_eventListener, false);
             condition.m_eventListener->disconnectAnimation();

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -84,7 +84,7 @@
     ASSERT(!m_chromeClient || !m_chromeClient->image());
 }
 
-inline SVGSVGElement* SVGImage::rootElement() const
+inline RefPtr<SVGSVGElement> SVGImage::rootElement() const
 {
     if (!m_page)
         return nullptr;
@@ -93,7 +93,7 @@
 
 bool SVGImage::hasSingleSecurityOrigin() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return true;
 
@@ -122,7 +122,7 @@
     if (!usesContainerSize())
         return;
 
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return;
     auto* renderer = downcast<RenderSVGRoot>(rootElement->renderer());
@@ -129,7 +129,7 @@
     if (!renderer)
         return;
 
-    FrameView* view = frameView();
+    auto view = makeRefPtr(frameView());
     view->resize(this->containerSize());
 
     renderer->setContainerSize(IntSize(size));
@@ -137,7 +137,7 @@
 
 IntSize SVGImage::containerSize() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return IntSize();
 
@@ -285,7 +285,7 @@
     if (!m_page)
         return ImageDrawResult::DidNothing;
 
-    FrameView* view = frameView();
+    auto view = makeRefPtr(frameView());
     ASSERT(view);
 
     GraphicsContextStateSaver stateSaver(context);
@@ -332,7 +332,7 @@
 
 RenderBox* SVGImage::embeddedContentBox() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return nullptr;
     return downcast<RenderBox>(rootElement->renderer());
@@ -347,7 +347,7 @@
 
 bool SVGImage::hasRelativeWidth() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return false;
     return rootElement->intrinsicWidth().isPercentOrCalculated();
@@ -355,7 +355,7 @@
 
 bool SVGImage::hasRelativeHeight() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return false;
     return rootElement->intrinsicHeight().isPercentOrCalculated();
@@ -363,7 +363,7 @@
 
 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return;
 
@@ -379,7 +379,7 @@
 
 void SVGImage::startAnimation()
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement || !rootElement->animationsPaused())
         return;
     rootElement->unpauseAnimations();
@@ -388,7 +388,7 @@
 
 void SVGImage::stopAnimation()
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return;
     rootElement->pauseAnimations();
@@ -401,7 +401,7 @@
 
 bool SVGImage::isAnimating() const
 {
-    SVGSVGElement* rootElement = this->rootElement();
+    auto rootElement = this->rootElement();
     if (!rootElement)
         return false;
     return rootElement->hasActiveAnimation();
@@ -409,10 +409,10 @@
 
 void SVGImage::reportApproximateMemoryCost() const
 {
-    Document* document = m_page->mainFrame().document();
+    auto document = makeRefPtr(m_page->mainFrame().document());
     size_t decodedImageMemoryCost = 0;
 
-    for (Node* node = document; node; node = NodeTraversal::next(*node))
+    for (RefPtr<Node> node = document; node; node = NodeTraversal::next(*node))
         decodedImageMemoryCost += node->approximateMemoryCost();
 
     JSC::VM& vm = commonVM();

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (224614 => 224615)


--- trunk/Source/WebCore/svg/graphics/SVGImage.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -95,7 +95,7 @@
     void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing,
         CompositeOperator, const FloatRect&, BlendMode);
 
-    SVGSVGElement* rootElement() const;
+    RefPtr<SVGSVGElement> rootElement() const;
 
     std::unique_ptr<SVGImageChromeClient> m_chromeClient;
     std::unique_ptr<Page> m_page;

Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -118,9 +118,9 @@
         const AffineTransform& absoluteTransform = filter().absoluteTransform();
         resultImage->context().concatCTM(absoluteTransform);
 
-        SVGElement* contextNode = downcast<SVGElement>(renderer->element());
+        auto contextNode = makeRefPtr(downcast<SVGElement>(renderer->element()));
         if (contextNode->hasRelativeLengths()) {
-            SVGLengthContext lengthContext(contextNode);
+            SVGLengthContext lengthContext(contextNode.get());
             FloatSize viewportSize;
 
             // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport.

Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp (224614 => 224615)


--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp	2017-11-09 03:55:05 UTC (rev 224615)
@@ -47,11 +47,11 @@
     m_namedEffects.set(id, m_lastEffect);
 }
 
-FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const
+RefPtr<FilterEffect> SVGFilterBuilder::getEffectById(const AtomicString& id) const
 {
     if (id.isEmpty()) {
         if (m_lastEffect)
-            return m_lastEffect.get();
+            return m_lastEffect;
 
         return m_builtinEffects.get(SourceGraphic::effectName());
     }

Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h (224614 => 224615)


--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -38,7 +38,7 @@
 
     void add(const AtomicString& id, RefPtr<FilterEffect>);
 
-    FilterEffect* getEffectById(const AtomicString& id) const;
+    RefPtr<FilterEffect> getEffectById(const AtomicString& id) const;
     FilterEffect* lastEffect() const { return m_lastEffect.get(); }
 
     void appendEffectToEffectReferences(RefPtr<FilterEffect>&&, RenderObject*);

Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (224614 => 224615)


--- trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -90,7 +90,7 @@
     void animValDidChange()
     {
         ASSERT(m_animatedPathByteStream);
-        SVGPathElement* pathElement = downcast<SVGPathElement>(contextElement());
+        auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement()));
 
         // If the animVal is observed from JS, we have to update it on each animation step.
         // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running.

Modified: trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h (224614 => 224615)


--- trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h	2017-11-09 01:47:56 UTC (rev 224614)
+++ trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h	2017-11-09 03:55:05 UTC (rev 224615)
@@ -141,7 +141,7 @@
         unsigned size = m_wrappers->size();
         ASSERT(size == m_values->size());
         for (unsigned i = 0; i < size; ++i) {
-            ListItemTearOff* item = m_wrappers->at(i);
+            auto item = makeRefPtr(m_wrappers->at(i));
             if (!item)
                 continue;
             item->setAnimatedProperty(m_animatedProperty.ptr());
@@ -159,7 +159,7 @@
 
     bool processIncomingListItemWrapper(Ref<ListItemTearOff>& newItem, unsigned* indexToModify) override
     {
-        SVGAnimatedProperty* animatedPropertyOfItem = newItem->animatedProperty();
+        auto animatedPropertyOfItem = makeRefPtr(newItem->animatedProperty());
 
         // newItem has been created manually, it doesn't belong to any SVGElement.
         // (for example: "textElement.x.baseVal.appendItem(svgsvgElement.createSVGLength())")
@@ -181,7 +181,7 @@
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
         // 'newItem' is already living in another list. If it's not our list, synchronize the other lists wrappers after the removal.
         bool livesInOtherList = animatedPropertyOfItem != m_animatedProperty.ptr();
-        AnimatedListPropertyTearOff* propertyTearOff = static_cast<AnimatedListPropertyTearOff*>(animatedPropertyOfItem);
+        AnimatedListPropertyTearOff* propertyTearOff = static_cast<AnimatedListPropertyTearOff*>(animatedPropertyOfItem.get());
         int indexToRemove = propertyTearOff->findItem(newItem.ptr());
         ASSERT(indexToRemove != -1);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to