This CL clean up patch in SVGElements (issue 1127773003 by hyunjune.kim@samsung.com)

0 views
Skip to first unread message

hyunju...@samsung.com

unread,
May 4, 2015, 11:26:10 PM5/4/15
to p...@chromium.org, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, kouhe...@chromium.org, f...@opera.com, ed+bli...@opera.com, fma...@chromium.org, gyuyou...@chromium.org, sche...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com
Reviewers: pdr, fs,

Message:
Hi, I'm hyunjunekim (hyunju...@samsung.com, hyki...@gamil.com).
Could you check this patch? This cl just clean up. Thank you.

Description:
This CL clean up patch in SVGElements

This CL clean up codes. Replace 0 with nullptr in SVGElements.

Please review this at https://codereview.chromium.org/1127773003/

Base URL: https://chromium.googlesource.com/chromium/blink.git@master

Affected files (+33, -33 lines):
M Source/core/svg/SVGDocumentExtensions.cpp
M Source/core/svg/SVGElement.h
M Source/core/svg/SVGElement.cpp
M Source/core/svg/SVGElementRareData.cpp
M Source/core/svg/SVGGraphicsElement.cpp
M Source/core/svg/SVGLengthContext.cpp
M Source/core/svg/SVGPathElement.h
M Source/core/svg/SVGTextContentElement.cpp
M Source/core/svg/SVGTextPositioningElement.cpp
M Source/core/svg/SVGURIReference.cpp
M Source/core/svg/SVGUseElement.cpp
M Source/core/svg/SVGViewSpec.cpp
M Source/core/svg/graphics/SVGImage.cpp
M Source/core/svg/graphics/filters/SVGFEImage.cpp


Index: Source/core/svg/SVGDocumentExtensions.cpp
diff --git a/Source/core/svg/SVGDocumentExtensions.cpp
b/Source/core/svg/SVGDocumentExtensions.cpp
index
c5680005e9d36fbbfe8b7816e942c00f8f368258..e5489b3ee23d2a142c7379f9e38e515f1831f73b
100644
--- a/Source/core/svg/SVGDocumentExtensions.cpp
+++ b/Source/core/svg/SVGDocumentExtensions.cpp
@@ -77,7 +77,7 @@ void SVGDocumentExtensions::removeResource(const
AtomicString& id)
LayoutSVGResourceContainer* SVGDocumentExtensions::resourceById(const
AtomicString& id) const
{
if (id.isEmpty())
- return 0;
+ return nullptr;

return m_resources.get(id);
}
@@ -276,11 +276,11 @@ void
SVGDocumentExtensions::markPendingResourcesForRemoval(const AtomicString& i
Element*
SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(const
AtomicString& id)
{
if (id.isEmpty())
- return 0;
+ return nullptr;

SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id);
if (!resourceSet || resourceSet->isEmpty())
- return 0;
+ return nullptr;

SVGPendingElements::iterator firstElement = resourceSet->begin();
Element* element = *firstElement;
Index: Source/core/svg/SVGElement.cpp
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index
c3e1e220fba2765be4ffafe1048dde5d442b76da..6dcba9d30584eb31629ea592ae8ac32a4a767f77
100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -442,7 +442,7 @@ SVGSVGElement* SVGElement::ownerSVGElement() const
n = n->parentOrShadowHostNode();
}

- return 0;
+ return nullptr;
}

SVGElement* SVGElement::viewportElement() const
@@ -457,7 +457,7 @@ SVGElement* SVGElement::viewportElement() const
n = n->parentOrShadowHostNode();
}

- return 0;
+ return nullptr;
}

SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions()
@@ -563,7 +563,7 @@ SVGUseElement* SVGElement::correspondingUseElement()
const
if (isSVGUseElement(root->host()) && (root->type() ==
ShadowRoot::UserAgentShadowRoot))
return toSVGUseElement(root->host());
}
- return 0;
+ return nullptr;
}

void SVGElement::setCorrespondingElement(SVGElement* correspondingElement)
@@ -843,7 +843,7 @@ void
SVGElement::svgLoadEventTimerFired(Timer<SVGElement>*)
Timer<SVGElement>* SVGElement::svgLoadEventTimer()
{
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}

void SVGElement::attributeChanged(const QualifiedName& name, const
AtomicString& newValue, AttributeModificationReason)
@@ -924,7 +924,7 @@ MutableStylePropertySet*
SVGElement::animatedSMILStyleProperties() const
{
if (hasSVGRareData())
return svgRareData()->animatedSMILStyleProperties();
- return 0;
+ return nullptr;
}

MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties()
@@ -1116,7 +1116,7 @@ bool SVGElement::isAnimatableAttribute(const
QualifiedName& name) const
SVGElementSet* SVGElement::setOfIncomingReferences() const
{
if (!hasSVGRareData())
- return 0;
+ return nullptr;
return &svgRareData()->incomingReferences();
}

Index: Source/core/svg/SVGElement.h
diff --git a/Source/core/svg/SVGElement.h b/Source/core/svg/SVGElement.h
index
700bdb118a76907c67efb4ea6adefb67b5d59d45..7fd200056ce4ea4d14efe9031f0842d4deea6d21
100644
--- a/Source/core/svg/SVGElement.h
+++ b/Source/core/svg/SVGElement.h
@@ -104,7 +104,7 @@ public:
void svgLoadEventTimerFired(Timer<SVGElement>*);
virtual Timer<SVGElement>* svgLoadEventTimer();

- virtual AffineTransform* animateMotionTransform() { return 0; }
+ virtual AffineTransform* animateMotionTransform() { return nullptr; }

void invalidateSVGAttributes() {
ensureUniqueElementData().m_animatedSVGAttributesAreDirty = true; }
void invalidateSVGPresentationAttributeStyle() {
ensureUniqueElementData().m_presentationAttributeStyleIsDirty = true; }
Index: Source/core/svg/SVGElementRareData.cpp
diff --git a/Source/core/svg/SVGElementRareData.cpp
b/Source/core/svg/SVGElementRareData.cpp
index
82c9c3c792e729113329384f8f86d2e17f02691e..5652eafa0c3fcae027618e25ab1fa99835b15bb8
100644
--- a/Source/core/svg/SVGElementRareData.cpp
+++ b/Source/core/svg/SVGElementRareData.cpp
@@ -24,7 +24,7 @@ ComputedStyle*
SVGElementRareData::overrideComputedStyle(Element* element, const
{
ASSERT(element);
if (!m_useOverrideComputedStyle)
- return 0;
+ return nullptr;
if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) {
// The style computed here contains no CSS Animations/Transitions
or SMIL induced rules - this is needed to compute the "base value" for the
SMIL animation sandwhich model.
m_overrideComputedStyle =
element->document().ensureStyleResolver().styleForElement(element,
parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);
Index: Source/core/svg/SVGGraphicsElement.cpp
diff --git a/Source/core/svg/SVGGraphicsElement.cpp
b/Source/core/svg/SVGGraphicsElement.cpp
index
313cc2e98f4e63e3eb3e3ff297f773389312d758..c4d3fd04af3cc66b9c2b1e6b502ad1e61b9edf2a
100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -217,7 +217,7 @@ SVGElement*
SVGGraphicsElement::nearestViewportElement() const
return toSVGElement(current);
}

- return 0;
+ return nullptr;
}

SVGElement* SVGGraphicsElement::farthestViewportElement() const
Index: Source/core/svg/SVGLengthContext.cpp
diff --git a/Source/core/svg/SVGLengthContext.cpp
b/Source/core/svg/SVGLengthContext.cpp
index
891fffbbb26125cf671dbf28f7b120ee6f06715f..b64cfd4b81ad9e7f96af5aeb5536c1d5ebee22b1
100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -56,7 +56,7 @@ static float convertValueFromPercentageToUserUnits(const
SVGLength& value, const
static const ComputedStyle* computedStyleForLengthResolving(const
SVGElement* context)
{
if (!context)
- return 0;
+ return nullptr;

const ContainerNode* currentContext = context;
do {
@@ -67,13 +67,13 @@ static const ComputedStyle*
computedStyleForLengthResolving(const SVGElement* co

// There must be at least a LayoutSVGRoot layoutObject, carrying a
style.
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}

static const ComputedStyle* rootElementStyle(const Node* context)
{
if (!context)
- return 0;
+ return nullptr;

const Document& document = context->document();
Node* documentElement = document.documentElement();
Index: Source/core/svg/SVGPathElement.h
diff --git a/Source/core/svg/SVGPathElement.h
b/Source/core/svg/SVGPathElement.h
index
ff240c04a051afcb2f966dece07bb3152dff89c2..629d21fd4481dd1ecd26f9d94b550037991ea618
100644
--- a/Source/core/svg/SVGPathElement.h
+++ b/Source/core/svg/SVGPathElement.h
@@ -87,8 +87,8 @@ public:
SVGPathSegListTearOff* animatedPathSegList() { return
m_pathSegList->animVal(); }

// FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement
normalized path segment lists!
- SVGPathSegListTearOff* normalizedPathSegList() { return 0; }
- SVGPathSegListTearOff* animatedNormalizedPathSegList() { return 0; }
+ SVGPathSegListTearOff* normalizedPathSegList() { return nullptr; }
+ SVGPathSegListTearOff* animatedNormalizedPathSegList() { return
nullptr; }

const SVGPathByteStream* pathByteStream() const { return
m_pathSegList->currentValue()->byteStream(); }

Index: Source/core/svg/SVGTextContentElement.cpp
diff --git a/Source/core/svg/SVGTextContentElement.cpp
b/Source/core/svg/SVGTextContentElement.cpp
index
3937d9e35d855be8a690c590f6096b4bdff01e32..898941057b8cca044d5ebf8ebdffa656d0a51cca
100644
--- a/Source/core/svg/SVGTextContentElement.cpp
+++ b/Source/core/svg/SVGTextContentElement.cpp
@@ -254,10 +254,10 @@ bool SVGTextContentElement::selfHasRelativeLengths()
const
SVGTextContentElement*
SVGTextContentElement::elementFromRenderer(LayoutObject* layoutObject)
{
if (!layoutObject)
- return 0;
+ return nullptr;

if (!layoutObject->isSVGText() && !layoutObject->isSVGInline())
- return 0;
+ return nullptr;

SVGElement* element = toSVGElement(layoutObject->node());
ASSERT(element);
Index: Source/core/svg/SVGTextPositioningElement.cpp
diff --git a/Source/core/svg/SVGTextPositioningElement.cpp
b/Source/core/svg/SVGTextPositioningElement.cpp
index
311db6ce0dc4713546c6c825d0657a89f9f0c982..c2c662f3f77a2bcc0c7b05caa32851b5fd7bf9c5
100644
--- a/Source/core/svg/SVGTextPositioningElement.cpp
+++ b/Source/core/svg/SVGTextPositioningElement.cpp
@@ -83,7 +83,7 @@ void SVGTextPositioningElement::svgAttributeChanged(const
QualifiedName& attrNam
SVGTextPositioningElement*
SVGTextPositioningElement::elementFromRenderer(LayoutObject& layoutObject)
{
if (!layoutObject.isSVGText() && !layoutObject.isSVGInline())
- return 0;
+ return nullptr;

Node* node = layoutObject.node();
ASSERT(node);
Index: Source/core/svg/SVGURIReference.cpp
diff --git a/Source/core/svg/SVGURIReference.cpp
b/Source/core/svg/SVGURIReference.cpp
index
dec5ed14655838c1aeb4504e8b509560533ee97a..382bb24f100171d44e23a4e70604741e69170e10
100644
--- a/Source/core/svg/SVGURIReference.cpp
+++ b/Source/core/svg/SVGURIReference.cpp
@@ -84,13 +84,13 @@ Element*
SVGURIReference::targetElementFromIRIString(const String& iri, const Tr
AtomicString id;
KURL url = urlFromIRIStringWithFragmentIdentifier(iri, document, id);
if (url == KURL())
- return 0;
+ return nullptr;

if (fragmentIdentifier)
*fragmentIdentifier = id;

if (id.isEmpty())
- return 0;
+ return nullptr;

if (externalDocument) {
// Enforce that the referenced url matches the url of the document
that we've loaded for it!
@@ -100,7 +100,7 @@ Element*
SVGURIReference::targetElementFromIRIString(const String& iri, const Tr

// Exit early if the referenced url is external, and we have no
externalDocument given.
if (isExternalURIReference(iri, document))
- return 0;
+ return nullptr;

return treeScope.getElementById(id);
}
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp
b/Source/core/svg/SVGUseElement.cpp
index
502f6a464299c0762d5a4ebdb5c2d40b27435852..5c53dfb07da9ae1ee4497bad25b430206b216104
100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -131,11 +131,11 @@ Document* SVGUseElement::externalDocument() const
if (m_resource && m_resource->isLoaded()) {
// Gracefully handle error condition.
if (m_resource->errorOccurred())
- return 0;
+ return nullptr;
ASSERT(m_resource->document());
return m_resource->document();
}
- return 0;
+ return nullptr;
}

void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use,
SVGElement* shadowElement, const SVGElement& originalElement)
@@ -465,7 +465,7 @@ LayoutObject* SVGUseElement::layoutObjectClipChild()
const
return n->layoutObject();
}

- return 0;
+ return nullptr;
}

bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement*
targetInstance, bool foundUse)
Index: Source/core/svg/SVGViewSpec.cpp
diff --git a/Source/core/svg/SVGViewSpec.cpp
b/Source/core/svg/SVGViewSpec.cpp
index
73e42463ef4a4f177996530a5cebf97668f3af68..fc597cf10cbb309d5de52091b40a2cca082dfe79
100644
--- a/Source/core/svg/SVGViewSpec.cpp
+++ b/Source/core/svg/SVGViewSpec.cpp
@@ -90,10 +90,10 @@ void SVGViewSpec::detachContextElement()
SVGElement* SVGViewSpec::viewTarget() const
{
if (!m_contextElement)
- return 0;
+ return nullptr;
Element* element =
m_contextElement->treeScope().getElementById(AtomicString(m_viewTargetString));
if (!element || !element->isSVGElement())
- return 0;
+ return nullptr;
return toSVGElement(element);
}

Index: Source/core/svg/graphics/SVGImage.cpp
diff --git a/Source/core/svg/graphics/SVGImage.cpp
b/Source/core/svg/graphics/SVGImage.cpp
index
8f19468ddfc89ddaaaa10b711f3bcaf86b1253a5..807f97ad8717871a1bd767240579aa60f3b77d1d
100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -128,7 +128,7 @@ bool SVGImage::currentFrameHasSingleSecurityOrigin()
const
static SVGSVGElement* svgRootElement(Page* page)
{
if (!page)
- return 0;
+ return nullptr;
LocalFrame* frame = toLocalFrame(page->mainFrame());
return frame->document()->accessSVGExtensions().rootElement();
}
@@ -329,14 +329,14 @@ LayoutBox* SVGImage::embeddedContentBox() const
{
SVGSVGElement* rootElement = svgRootElement(m_page.get());
if (!rootElement)
- return 0;
+ return nullptr;
return toLayoutBox(rootElement->layoutObject());
}

FrameView* SVGImage::frameView() const
{
if (!m_page)
- return 0;
+ return nullptr;

return toLocalFrame(m_page->mainFrame())->view();
}
Index: Source/core/svg/graphics/filters/SVGFEImage.cpp
diff --git a/Source/core/svg/graphics/filters/SVGFEImage.cpp
b/Source/core/svg/graphics/filters/SVGFEImage.cpp
index
b43827a16ec3747bdfa5102d525b1d29b9809f5d..ab461a47ba5990eee80f648678a510ccd203730c
100644
--- a/Source/core/svg/graphics/filters/SVGFEImage.cpp
+++ b/Source/core/svg/graphics/filters/SVGFEImage.cpp
@@ -132,10 +132,10 @@ FloatRect FEImage::determineAbsolutePaintRect(const
FloatRect& originalRequested
LayoutObject* FEImage::referencedLayoutObject() const
{
if (!m_treeScope)
- return 0;
+ return nullptr;
Element* hrefElement =
SVGURIReference::targetElementFromIRIString(m_href, *m_treeScope);
if (!hrefElement || !hrefElement->isSVGElement())
- return 0;
+ return nullptr;
return hrefElement->layoutObject();
}



p...@chromium.org

unread,
May 5, 2015, 12:47:04 AM5/5/15
to hyunjune....@samsung.com, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, ed+bli...@opera.com, fma...@chromium.org, f...@opera.com, gyuyou...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com, sche...@chromium.org
LGTM

Before landing please update the change description to be something like
"Refactor 0 -> nullptr in SVGElements".

https://codereview.chromium.org/1127773003/

hyunju...@samsung.com

unread,
May 5, 2015, 1:44:57 AM5/5/15
to p...@chromium.org, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, ed+bli...@opera.com, fma...@chromium.org, f...@opera.com, gyuyou...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com, sche...@chromium.org
pdr,
I modified description.

https://codereview.chromium.org/1127773003/

p...@chromium.org

unread,
May 5, 2015, 1:57:48 AM5/5/15
to hyunjune....@samsung.com, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, ed+bli...@opera.com, fma...@chromium.org, f...@opera.com, gyuyou...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com, sche...@chromium.org

commi...@chromium.org

unread,
May 5, 2015, 1:58:07 AM5/5/15
to hyunjune....@samsung.com, p...@chromium.org, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, ed+bli...@opera.com, fma...@chromium.org, f...@opera.com, gyuyou...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com, sche...@chromium.org

commi...@chromium.org

unread,
May 5, 2015, 3:48:03 AM5/5/15
to hyunjune....@samsung.com, p...@chromium.org, f...@opera.com, blink-...@chromium.org, dsch...@chromium.org, ed+bli...@opera.com, fma...@chromium.org, f...@opera.com, gyuyou...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, rob....@samsung.com, sche...@chromium.org
Reply all
Reply to author
Forward
0 new messages