RenderSVGResourceContainer clients are always RenderElement.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Feb 2014 02:15:13 +0000 (02:15 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Feb 2014 02:15:13 +0000 (02:15 +0000)
<https://webkit.org/b/128088>

All clients of RenderSVGResourceContainer are going to be RenderElement,
so make the interface take RenderElement& instead of RenderObject*.

Also modernized the code a bit with C++11 range for loops.

Reviewed by Sam Weinig.

* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::addClient):
(WebCore::RenderSVGResourceContainer::removeClient):
* rendering/svg/RenderSVGResourceContainer.h:
* rendering/svg/SVGResourcesCache.cpp:
(WebCore::SVGResourcesCache::addResourcesFromRenderer):
(WebCore::SVGResourcesCache::removeResourcesFromRenderer):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
Source/WebCore/rendering/svg/SVGResourcesCache.cpp

index 3680346738c4f2b044d14ab232dde51f7b69e3a8..faed3c6c66c079cd115a70191d1a3a42adb53070 100644 (file)
@@ -1,3 +1,23 @@
+2014-02-02  Andreas Kling  <akling@apple.com>
+
+        RenderSVGResourceContainer clients are always RenderElement.
+        <https://webkit.org/b/128088>
+
+        All clients of RenderSVGResourceContainer are going to be RenderElement,
+        so make the interface take RenderElement& instead of RenderObject*.
+
+        Also modernized the code a bit with C++11 range for loops.
+
+        Reviewed by Sam Weinig.
+
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        (WebCore::RenderSVGResourceContainer::addClient):
+        (WebCore::RenderSVGResourceContainer::removeClient):
+        * rendering/svg/RenderSVGResourceContainer.h:
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::addResourcesFromRenderer):
+        (WebCore::SVGResourcesCache::removeResourcesFromRenderer):
+
 2014-02-02  Zalan Bujtas  <zalan@apple.com>
 
         Subpixel rendering: Use floorf/roundf/fabs in device snapping helpers.
index 199f2896364295e422810ce562a296030bf92b7a..be01b5a5d060865a7a1dda0fa254a6452d56cef0 100644 (file)
@@ -141,17 +141,15 @@ void RenderSVGResourceContainer::markClientForInvalidation(RenderObject& client,
     }
 }
 
-void RenderSVGResourceContainer::addClient(RenderObject* client)
+void RenderSVGResourceContainer::addClient(RenderElement& client)
 {
-    ASSERT(client);
-    m_clients.add(client);
+    m_clients.add(&client);
 }
 
-void RenderSVGResourceContainer::removeClient(RenderObject* client)
+void RenderSVGResourceContainer::removeClient(RenderElement& client)
 {
-    ASSERT(client);
-    removeClientFromCache(*client, false);
-    m_clients.remove(client);
+    removeClientFromCache(client, false);
+    m_clients.remove(&client);
 }
 
 void RenderSVGResourceContainer::addClientRenderLayer(RenderLayer* client)
index b4045cabe75e8039a48f3e477dfb2954848d81e0..d0da46a6105bc871f20899aa4556744aff385a0f 100644 (file)
@@ -63,8 +63,8 @@ protected:
 
 private:
     friend class SVGResourcesCache;
-    void addClient(RenderObject*);
-    void removeClient(RenderObject*);
+    void addClient(RenderElement&);
+    void removeClient(RenderElement&);
 
 private:
     virtual void willBeDestroyed() override final;
@@ -73,7 +73,7 @@ private:
     AtomicString m_id;
     bool m_registered : 1;
     bool m_isInvalidating : 1;
-    HashSet<RenderObject*> m_clients;
+    HashSet<RenderElement*> m_clients;
     HashSet<RenderLayer*> m_clientLayers;
 };
 
index fa40eec27a0a05bd65ebed5f30c960452becf29f..f8b7d2321ac2e4473a359460f43d115364835317 100644 (file)
@@ -58,8 +58,8 @@ void SVGResourcesCache::addResourcesFromRenderer(RenderElement& renderer, const
     HashSet<RenderSVGResourceContainer*> resourceSet;
     resources.buildSetOfResources(resourceSet);
 
-    for (auto it = resourceSet.begin(), end = resourceSet.end(); it != end; ++it)
-        (*it)->addClient(&renderer);
+    for (auto* resourceContainer : resourceSet)
+        resourceContainer->addClient(renderer);
 }
 
 void SVGResourcesCache::removeResourcesFromRenderer(RenderElement& renderer)
@@ -72,8 +72,8 @@ void SVGResourcesCache::removeResourcesFromRenderer(RenderElement& renderer)
     HashSet<RenderSVGResourceContainer*> resourceSet;
     resources->buildSetOfResources(resourceSet);
 
-    for (auto it = resourceSet.begin(), end = resourceSet.end(); it != end; ++it)
-        (*it)->removeClient(&renderer);
+    for (auto* resourceContainer : resourceSet)
+        resourceContainer->removeClient(renderer);
 }
 
 static inline SVGResourcesCache& resourcesCacheFromRenderer(const RenderObject& renderer)