Invalid cast in WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients()
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Mar 2014 20:57:40 +0000 (20:57 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Mar 2014 20:57:40 +0000 (20:57 +0000)
<https://bugs.webkit.org/show_bug.cgi?id=121887>
<rdar://problem/15073043>

Clang appears to be optimizing out a branch in RenderObject::node()
when compiling RenderLayer::FilterInfo::updateReferenceFilterClients().
We'll work around this by factoring out the code in question into a
separate member function marked NEVER_INLINE.

No test possible due to <https://bugs.webkit.org/show_bug.cgi?id=129757>.

Reviewed by David Kilzer.

* rendering/RenderLayerFilterInfo.cpp:
(WebCore::RenderLayer::FilterInfo::layerElement):
Code moved from updateReferenceFilterClients(). Returns the Element*
for m_layer.
(WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients):
Use layerElement().

* rendering/RenderLayerFilterInfo.h:
Declared layerElement().

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerFilterInfo.cpp
Source/WebCore/rendering/RenderLayerFilterInfo.h

index 55463b6..94cf6c4 100644 (file)
@@ -1,3 +1,29 @@
+2014-03-05  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Invalid cast in WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients()
+
+        <https://bugs.webkit.org/show_bug.cgi?id=121887>
+        <rdar://problem/15073043>
+
+        Clang appears to be optimizing out a branch in RenderObject::node()
+        when compiling RenderLayer::FilterInfo::updateReferenceFilterClients().
+        We'll work around this by factoring out the code in question into a
+        separate member function marked NEVER_INLINE.
+
+        No test possible due to <https://bugs.webkit.org/show_bug.cgi?id=129757>.
+
+        Reviewed by David Kilzer.
+
+        * rendering/RenderLayerFilterInfo.cpp:
+        (WebCore::RenderLayer::FilterInfo::layerElement):
+        Code moved from updateReferenceFilterClients(). Returns the Element*
+        for m_layer.
+        (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients):
+        Use layerElement().
+
+        * rendering/RenderLayerFilterInfo.h:
+        Declared layerElement().
+
 2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
index 4c39432..7414e5b 100644 (file)
@@ -97,6 +97,12 @@ void RenderLayer::FilterInfo::notifyFinished(CachedResource*)
     m_layer.renderer().repaint();
 }
 
+// FIXME: Remove this helper function when <rdar://problem/16230015> is fixed.
+NEVER_INLINE Element* RenderLayer::FilterInfo::layerElement() const
+{
+    return m_layer.renderer().element();
+}
+
 void RenderLayer::FilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
 {
     removeReferenceFilterClients();
@@ -115,7 +121,8 @@ void RenderLayer::FilterInfo::updateReferenceFilterClients(const FilterOperation
         } else {
             // Reference is internal; add layer as a client so we can trigger
             // filter repaint on SVG attribute change.
-            Element* filter = m_layer.renderer().element()->document().getElementById(referenceFilterOperation->fragment());
+            Element* filter = layerElement()->document().getElementById(referenceFilterOperation->fragment());
+
             if (!filter || !filter->renderer() || !filter->renderer()->isSVGResourceFilter())
                 continue;
             toRenderSVGResourceContainer(*filter->renderer()).addClientRenderLayer(&m_layer);
index d82d63b..229ab19 100644 (file)
@@ -62,6 +62,8 @@ private:
     explicit FilterInfo(RenderLayer&);
     ~FilterInfo();
 
+    Element* layerElement() const;
+
     friend void WTF::deleteOwnedPtr<FilterInfo>(FilterInfo*);
 
     virtual void notifyFinished(CachedResource*) override;