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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp

Issue 2714153002: Remove LayoutSVGResourceContainer::m_id (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
index 3ad812c3ff8e5e13780f9da5f99d344492b20c7d..f50247e0199b30ce70d3f2634876f15ba3c8931e 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
@@ -36,7 +36,6 @@ static inline SVGTreeScopeResources& svgTreeScopeResourcesFromElement(
LayoutSVGResourceContainer::LayoutSVGResourceContainer(SVGElement* node)
: LayoutSVGHiddenContainer(node),
m_isInLayout(false),
- m_id(node->getIdAttribute()),
m_invalidationMask(0),
m_registered(false),
m_isInvalidating(false) {}
@@ -74,8 +73,10 @@ void LayoutSVGResourceContainer::willBeDestroyed() {
detachAllClients();
LayoutSVGHiddenContainer::willBeDestroyed();
- if (m_registered)
- svgTreeScopeResourcesFromElement(element()).removeResource(m_id);
+ if (!m_registered)
+ return;
+ svgTreeScopeResourcesFromElement(element()).removeResource(
+ element()->getIdAttribute());
}
void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff,
@@ -85,10 +86,12 @@ void LayoutSVGResourceContainer::styleDidChange(StyleDifference diff,
if (m_registered)
return;
m_registered = true;
- svgTreeScopeResourcesFromElement(element()).updateResource(m_id, this);
+ svgTreeScopeResourcesFromElement(element()).updateResource(
+ element()->getIdAttribute(), this);
}
void LayoutSVGResourceContainer::detachAllClients() {
+ const AtomicString& id = element()->getIdAttribute();
for (auto* client : m_clients) {
// Unlink the resource from the client's SVGResources. (The actual
// removal will be signaled after processing all the clients.)
@@ -101,22 +104,22 @@ void LayoutSVGResourceContainer::detachAllClients() {
// Add a pending resolution based on the id of the old resource.
Element* clientElement = toElement(client->node());
svgTreeScopeResourcesFromElement(clientElement)
- .addPendingResource(m_id, *clientElement);
+ .addPendingResource(id, *clientElement);
}
removeAllClientsFromCache();
}
-void LayoutSVGResourceContainer::idChanged() {
+void LayoutSVGResourceContainer::idChanged(const AtomicString& oldId,
+ const AtomicString& newId) {
// Invalidate all our current clients.
removeAllClientsFromCache();
// Remove old id, that is guaranteed to be present in cache.
SVGTreeScopeResources& treeScopeResources =
svgTreeScopeResourcesFromElement(element());
- treeScopeResources.removeResource(m_id);
- m_id = element()->getIdAttribute();
- treeScopeResources.updateResource(m_id, this);
+ treeScopeResources.removeResource(oldId);
+ treeScopeResources.updateResource(newId, this);
}
void LayoutSVGResourceContainer::markAllClientsForInvalidation(

Powered by Google App Engine
This is Rietveld 408576698