<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173987] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173987">173987</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-09-25 17:34:56 -0700 (Thu, 25 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for is&lt;SVGDocument&gt;() / downcast&lt;SVGDocument&gt;()
https://bugs.webkit.org/show_bug.cgi?id=137128

Reviewed by Ryosuke Niwa.

Add support for is&lt;SVGDocument&gt;() / downcast&lt;SVGDocument&gt;() by using
the SPECIALIZE_TYPE_TRAITS_*() macro, instead of the
DOCUMENT_TYPE_CASTS() one.

No new tests, no behavior change.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::remoteSVGRootElement):
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::getSVGDocument):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
* page/Frame.cpp:
(WebCore::Frame::setPageAndTextZoomFactors):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToAnchor):
* svg/SVGDocument.h:
(WebCore::isSVGDocument):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::hasSingleSecurityOrigin):
(WebCore::SVGImage::setContainerSize):
(WebCore::SVGImage::containerSize):
(WebCore::SVGImage::embeddedContentBox):
(WebCore::SVGImage::hasRelativeWidth):
(WebCore::SVGImage::hasRelativeHeight):
(WebCore::SVGImage::computeIntrinsicDimensions):
(WebCore::SVGImage::startAnimation):
(WebCore::SVGImage::stopAnimation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFrameOwnerElementcpp">trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGDocumenth">trunk/Source/WebCore/svg/SVGDocument.h</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImageh">trunk/Source/WebCore/svg/graphics/SVGImage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/ChangeLog        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-09-25  Christophe Dumez  &lt;cdumez@apple.com&gt;
+
+        Add support for is&lt;SVGDocument&gt;() / downcast&lt;SVGDocument&gt;()
+        https://bugs.webkit.org/show_bug.cgi?id=137128
+
+        Reviewed by Ryosuke Niwa.
+
+        Add support for is&lt;SVGDocument&gt;() / downcast&lt;SVGDocument&gt;() by using
+        the SPECIALIZE_TYPE_TRAITS_*() macro, instead of the
+        DOCUMENT_TYPE_CASTS() one.
+
+        No new tests, no behavior change.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::remoteSVGRootElement):
+        * html/HTMLFrameOwnerElement.cpp:
+        (WebCore::HTMLFrameOwnerElement::getSVGDocument):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEvent):
+        (WebCore::EventHandler::handleMouseMoveEvent):
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+        * page/Frame.cpp:
+        (WebCore::Frame::setPageAndTextZoomFactors):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToAnchor):
+        * svg/SVGDocument.h:
+        (WebCore::isSVGDocument):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::hasSingleSecurityOrigin):
+        (WebCore::SVGImage::setContainerSize):
+        (WebCore::SVGImage::containerSize):
+        (WebCore::SVGImage::embeddedContentBox):
+        (WebCore::SVGImage::hasRelativeWidth):
+        (WebCore::SVGImage::hasRelativeHeight):
+        (WebCore::SVGImage::computeIntrinsicDimensions):
+        (WebCore::SVGImage::startAnimation):
+        (WebCore::SVGImage::stopAnimation):
+
</ins><span class="cx"> 2014-09-25  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename CSSKeyframesRule insertRule to appendRule (57910)
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -2881,10 +2881,10 @@
</span><span class="cx">     Frame&amp; frame = frameView-&gt;frame();
</span><span class="cx">     
</span><span class="cx">     Document* document = frame.document();
</span><del>-    if (!document || !document-&gt;isSVGDocument())
</del><ins>+    if (!document || !is&lt;SVGDocument&gt;(document))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     
</span><del>-    SVGSVGElement* rootElement = toSVGDocument(*document).rootElement();
</del><ins>+    SVGSVGElement* rootElement = downcast&lt;SVGDocument&gt;(*document).rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return nullptr;
</span><span class="cx">     RenderObject* rendererRoot = rootElement-&gt;renderer();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFrameOwnerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -114,8 +114,8 @@
</span><span class="cx"> SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionCode&amp; ec) const
</span><span class="cx"> {
</span><span class="cx">     Document* document = contentDocument();
</span><del>-    if (document &amp;&amp; document-&gt;isSVGDocument())
-        return toSVGDocument(document);
</del><ins>+    if (document &amp;&amp; is&lt;SVGDocument&gt;(document))
+        return downcast&lt;SVGDocument&gt;(document);
</ins><span class="cx">     // Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument
</span><span class="cx">     ec = NOT_SUPPORTED_ERR;
</span><span class="cx">     return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -759,11 +759,10 @@
</span><span class="cx">     if (event.isOverWidget() &amp;&amp; passWidgetMouseDownEventToWidget(event))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (m_frame.document()-&gt;isSVGDocument()
-        &amp;&amp; toSVGDocument(*m_frame.document()).zoomAndPanEnabled()) {
</del><ins>+    if (is&lt;SVGDocument&gt;(m_frame.document()) &amp;&amp; downcast&lt;SVGDocument&gt;(*m_frame.document()).zoomAndPanEnabled()) {
</ins><span class="cx">         if (event.event().shiftKey() &amp;&amp; singleClick) {
</span><span class="cx">             m_svgPan = true;
</span><del>-            toSVGDocument(*m_frame.document()).startPan(m_frame.view()-&gt;windowToContents(event.event().position()));
</del><ins>+            downcast&lt;SVGDocument&gt;(*m_frame.document()).startPan(m_frame.view()-&gt;windowToContents(event.event().position()));
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1893,7 +1892,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (m_svgPan) {
</span><del>-        toSVGDocument(m_frame.document())-&gt;updatePan(m_frame.view()-&gt;windowToContents(m_lastKnownMousePosition));
</del><ins>+        downcast&lt;SVGDocument&gt;(*m_frame.document()).updatePan(m_frame.view()-&gt;windowToContents(m_lastKnownMousePosition));
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2037,7 +2036,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_svgPan) {
</span><span class="cx">         m_svgPan = false;
</span><del>-        toSVGDocument(m_frame.document())-&gt;updatePan(m_frame.view()-&gt;windowToContents(m_lastKnownMousePosition));
</del><ins>+        downcast&lt;SVGDocument&gt;(*m_frame.document()).updatePan(m_frame.view()-&gt;windowToContents(m_lastKnownMousePosition));
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/page/Frame.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -967,10 +967,8 @@
</span><span class="cx"> 
</span><span class="cx">     // Respect SVGs zoomAndPan=&quot;disabled&quot; property in standalone SVG documents.
</span><span class="cx">     // FIXME: How to handle compound documents + zoomAndPan=&quot;disabled&quot;? Needs SVG WG clarification.
</span><del>-    if (document-&gt;isSVGDocument()) {
-        if (!toSVGDocument(*document).zoomAndPanEnabled())
-            return;
-    }
</del><ins>+    if (is&lt;SVGDocument&gt;(document) &amp;&amp; !downcast&lt;SVGDocument&gt;(*document).zoomAndPanEnabled())
+        return;
</ins><span class="cx"> 
</span><span class="cx">     if (m_pageZoomFactor != pageZoomFactor) {
</span><span class="cx">         if (FrameView* view = this-&gt;view()) {
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -1960,8 +1960,8 @@
</span><span class="cx">     // Setting to null will clear the current target.
</span><span class="cx">     frame().document()-&gt;setCSSTarget(anchorElement);
</span><span class="cx"> 
</span><del>-    if (frame().document()-&gt;isSVGDocument()) {
-        if (SVGSVGElement* svg = toSVGDocument(*frame().document()).rootElement()) {
</del><ins>+    if (is&lt;SVGDocument&gt;(frame().document())) {
+        if (SVGSVGElement* svg = downcast&lt;SVGDocument&gt;(*frame().document()).rootElement()) {
</ins><span class="cx">             svg-&gt;setupInitialView(name, anchorElement);
</span><span class="cx">             if (!anchorElement)
</span><span class="cx">                 return true;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGDocument.h (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGDocument.h        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/svg/SVGDocument.h        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -52,11 +52,11 @@
</span><span class="cx">     FloatPoint m_translate;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool isSVGDocument(const Document&amp; document) { return document.isSVGDocument(); }
-void isSVGDocument(const SVGDocument&amp;); // Catch unnecessary runtime check of type known at compile time.
</del><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(SVGDocument)
+    static bool isSVGDocument(const Document&amp; document) { return document.isSVGDocument(); }
+    static bool isSVGDocument(const Node&amp; node) { return node.isDocumentNode() &amp;&amp; isSVGDocument(toDocument(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins><span class="cx"> 
</span><del>-DOCUMENT_TYPE_CASTS(SVGDocument)
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // SVGDocument_h
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -63,12 +63,16 @@
</span><span class="cx">     ASSERT(!m_chromeClient || !m_chromeClient-&gt;image());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGImage::hasSingleSecurityOrigin() const
</del><ins>+inline SVGSVGElement* SVGImage::rootElement() const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_page)
</span><del>-        return true;
</del><ins>+        return nullptr;
+    return downcast&lt;SVGDocument&gt;(*m_page-&gt;mainFrame().document()).rootElement();
+}
</ins><span class="cx"> 
</span><del>-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+bool SVGImage::hasSingleSecurityOrigin() const
+{
+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -83,10 +87,10 @@
</span><span class="cx"> 
</span><span class="cx"> void SVGImage::setContainerSize(const FloatSize&amp; size)
</span><span class="cx"> {
</span><del>-    if (!m_page || !usesContainerSize())
</del><ins>+    if (!usesContainerSize())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return;
</span><span class="cx">     RenderSVGRoot* renderer = toRenderSVGRoot(rootElement-&gt;renderer());
</span><span class="lines">@@ -101,9 +105,7 @@
</span><span class="cx"> 
</span><span class="cx"> IntSize SVGImage::containerSize() const
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return IntSize();
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return IntSize();
</span><span class="cx"> 
</span><span class="lines">@@ -262,26 +264,22 @@
</span><span class="cx"> 
</span><span class="cx"> RenderBox* SVGImage::embeddedContentBox() const
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return 0;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return toRenderBox(rootElement-&gt;renderer());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FrameView* SVGImage::frameView() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_page)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return m_page-&gt;mainFrame().view();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGImage::hasRelativeWidth() const
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return false;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return false;
</span><span class="cx">     return rootElement-&gt;intrinsicWidth().isPercent();
</span><span class="lines">@@ -289,9 +287,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool SVGImage::hasRelativeHeight() const
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return false;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return false;
</span><span class="cx">     return rootElement-&gt;intrinsicHeight().isPercent();
</span><span class="lines">@@ -299,9 +295,7 @@
</span><span class="cx"> 
</span><span class="cx"> void SVGImage::computeIntrinsicDimensions(Length&amp; intrinsicWidth, Length&amp; intrinsicHeight, FloatSize&amp; intrinsicRatio)
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -318,9 +312,7 @@
</span><span class="cx"> // FIXME: support catchUpIfNecessary.
</span><span class="cx"> void SVGImage::startAnimation(CatchUpAnimation)
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return;
</span><span class="cx">     rootElement-&gt;unpauseAnimations();
</span><span class="lines">@@ -329,9 +321,7 @@
</span><span class="cx"> 
</span><span class="cx"> void SVGImage::stopAnimation()
</span><span class="cx"> {
</span><del>-    if (!m_page)
-        return;
-    SVGSVGElement* rootElement = toSVGDocument(m_page-&gt;mainFrame().document())-&gt;rootElement();
</del><ins>+    SVGSVGElement* rootElement = this-&gt;rootElement();
</ins><span class="cx">     if (!rootElement)
</span><span class="cx">         return;
</span><span class="cx">     rootElement-&gt;pauseAnimations();
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (173986 => 173987)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.h        2014-09-26 00:34:40 UTC (rev 173986)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h        2014-09-26 00:34:56 UTC (rev 173987)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> class ImageBuffer;
</span><span class="cx"> class Page;
</span><span class="cx"> class RenderBox;
</span><ins>+class SVGSVGElement;
</ins><span class="cx"> class SVGImageChromeClient;
</span><span class="cx"> class SVGImageForContainer;
</span><span class="cx"> 
</span><span class="lines">@@ -95,6 +96,8 @@
</span><span class="cx">     void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&amp;, const AffineTransform&amp;, const FloatPoint&amp;, ColorSpace,
</span><span class="cx">         CompositeOperator, const FloatRect&amp;, BlendMode);
</span><span class="cx"> 
</span><ins>+    SVGSVGElement* rootElement() const;
+
</ins><span class="cx">     std::unique_ptr&lt;SVGImageChromeClient&gt; m_chromeClient;
</span><span class="cx">     std::unique_ptr&lt;Page&gt; m_page;
</span><span class="cx">     FloatSize m_intrinsicSize;
</span></span></pre>
</div>
</div>

</body>
</html>