<!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>[179982] 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/179982">179982</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2015-02-11 21:09:25 -0800 (Wed, 11 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Streamline and simplify SVGSVGElement and related classes
https://bugs.webkit.org/show_bug.cgi?id=141463

Reviewed by Antti Koivisto.

* dom/Document.cpp: Removed unneeded include of SVGSVGElement.h.
* loader/FrameLoader.cpp: Ditto.
* rendering/RenderBoxModelObject.cpp: Ditto.
* rendering/svg/RenderSVGForeignObject.cpp: Ditto.
* svg/SVGImageElement.cpp: Ditto.
* svg/SVGMarkerElement.cpp: Ditto.
* svg/SVGPathElement.cpp: Ditto.
* svg/SVGPatternElement.cpp: Ditto.
* svg/SVGTransform.cpp: Ditto.

* page/FrameView.cpp:
(WebCore::FrameView::scrollToAnchor): Updated to call the SVGSVGElement function
named scrollToAnchor (was setupInitialView). Also refactored to avoid repeating
the expression frame().document() so often.

* platform/graphics/FloatSize.h: Added operator/.

* svg/SVGDocument.cpp:
(WebCore::SVGDocument::rootElement): Rearranged to use early return.
(WebCore::SVGDocument::zoomAndPanEnabled): Ditto.
(WebCore::SVGDocument::startPan): Ditto. Also used FloatPoint math instead
of breaking things apart into x and y.
(WebCore::SVGDocument::updatePan): Ditto.

* svg/SVGDocument.h: Removed some unneeded includes and forward declarations.
Moved function bodies out of the class to make it more readable. Renamed
m_translate to m_panningOffset and made it a FloatSize instead of FloatPoint.

* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::startAnimations): Use a modern for loop
and update since timeContainer() now returns a reference.

* svg/SVGSVGElement.cpp: Removed many unneeded includes.
(WebCore::SVGSVGElement::SVGSVGElement): Moved initialization of scalars to
the class definition. Updated since m_timerContainer is a Ref (later should
change it to be a std::unique_ptr or just directly contained in SVGSVGElement).
(WebCore::SVGSVGElement::~SVGSVGElement): Removed comment that doesn't say much,
but is worded in a confusing way.
(WebCore::SVGSVGElement::contentScriptType): Use NeverDestroyed instead of
DEPRECATED_DEFINE_STATIC_LOCAL.
(WebCore::SVGSVGElement::contentStyleType): Ditto.
(WebCore::SVGSVGElement::viewport): Streamlined a bit.
(WebCore::SVGSVGElement::pixelUnitToMillimeterX): Ditto.
(WebCore::SVGSVGElement::pixelUnitToMillimeterY): Ditto.
(WebCore::SVGSVGElement::currentView): Changed to return a reference.
(WebCore::SVGSVGElement::frameForCurrentScale): Added. Helper for the two
functions below.
(WebCore::SVGSVGElement::currentScale): Updated to use frameForCurrentScale.
(WebCore::SVGSVGElement::setCurrentScale): Ditto.
(WebCore::SVGSVGElement::setCurrentTranslate): Optimized the case where there
is no change to the translation. Also changed the data member's name to
m_currentTranslate to more directly match the DOM API naming.
(WebCore::SVGSVGElement::parseAttribute): Simplified the parsing a bit, and
changed to pass a reference to SVGZoomAndPan::parseAttribute.
(WebCore::SVGSVGElement::svgAttributeChanged): Tweaked formatting and removed
code that converts the renderer pointer to a RenderObject* unnecessarily.
(WebCore::SVGSVGElement::suspendRedraw): Removed FIXME about implementing this,
since we don't really plan to do that.
(WebCore::SVGSVGElement::unsuspendRedraw): Ditto.
(WebCore::SVGSVGElement::unsuspendRedrawAll): Ditto.
(WebCore::SVGSVGElement::forceRedraw): Ditto.
(WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): Changed return
type to Ref, and pass in a function instead of an enumeration value.
(WebCore::SVGSVGElement::getIntersectionList): Updated for above.
(WebCore::SVGSVGElement::getEnclosureList): Ditto.
(WebCore::SVGSVGElement::checkIntersection): Use &amp;&amp; instead of early return
for the null check.
(WebCore::SVGSVGElement::checkEnclosure): Ditto.
(WebCore::SVGSVGElement::createSVGLength): Use initialization list syntax
for greater brevity.
(WebCore::SVGSVGElement::createSVGAngle): Ditto.
(WebCore::SVGSVGElement::createSVGPoint): Ditto.
(WebCore::SVGSVGElement::createSVGMatrix): Ditto.
(WebCore::SVGSVGElement::createSVGRect): Ditto.
(WebCore::SVGSVGElement::createSVGTransform): Removed unneeded explicit
constructor invocation.
(WebCore::SVGSVGElement::createSVGTransformFromMatrix): Removed unneeded cast.
(WebCore::SVGSVGElement::insertedInto): Updated since timeContainer() now
returns a reference.
(WebCore::SVGSVGElement::setCurrentTime): Use isfinite instead of isnan, so
we won't store infinity as the current time.
(WebCore::SVGSVGElement::currentViewBoxRect): Renamed locals and changed
to use initializer lists for brevity.
(WebCore::SVGSVGElement::currentViewportSize): Streamlined code by using
initializer lists, using local variables only for things used more than once,
and using the / operator defined above.
(WebCore::SVGSVGElement::viewBoxToViewTransform): Use the concatenate function
in a way that is more straightforward, rather than doing it with a temporary.
(WebCore::SVGSVGElement::scrollToAnchor): Renamed this from
setupInitialView.
(WebCore::SVGSVGElement::inheritViewAttributes): Changed this to work with
references rather than pointers.
(WebCore::SVGSVGElement::getElementById): Use getAllElementsById as the
FIXME comment suggested for better efficiency when there are a lot of descendants
of the &lt;svg&gt; element at the cost of making it less efficient if there are
a lot of elements all with the desired ID, but not inside the &lt;svg&gt; element.
(WebCore::SVGSVGElement::isValid): Moved here from the header.

* svg/SVGSVGElement.h: Removed unneeded forward declarations. Moved the
animated properties to the top of the file, then other DOM, the other
public members. Changed return types to references and Ref. Moved
function bodies out of the class definition. Made createSVGNumber inline.

* svg/SVGViewElement.cpp: Removed unneeded includes.
(WebCore::SVGViewElement::isSupportedAttribute): Deleted.
(WebCore::SVGViewElement::parseAttribute): Changed to not rely on
isSupportedAttribute. Eventually I will do this in all the SVG classes.

* svg/SVGViewSpec.cpp: Removed unneeded include of SVGSVGElement.h.
(WebCore::SVGViewSpec::parseViewSpec): Updated for change in the name
of the parse function in the SVGZoomAndPan class.

* svg/SVGZoomAndPan.cpp:
(WebCore::SVGZoomAndPan::isKnownAttribute): Deleted.
(WebCore::SVGZoomAndPan::addSupportedAttributes): Deleted.
(WebCore::SVGZoomAndPan::parse): Renamed from parseZoomAndPan since
this is a member of the SVGZoomAndPan class and also has an argument
of SVGZoomAndPanType.
(WebCore::SVGZoomAndPan::parseAttributeValue): Added. Helper so the
template function is not so big. Also write it in a simpler way.
(WebCore::SVGZoomAndPan::ref): Deleted.
(WebCore::SVGZoomAndPan::deref): Deleted.
(WebCore::SVGZoomAndPan::setZoomAndPan): Deleted.

* svg/SVGZoomAndPan.h: Removed unneeded includes. Reformatted the enum.
Moved function bodies out of the class definition. Removed many unneeded
functions.

* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::insertedInto): Updated since timeContainer
now returns a reference rather than a pointer.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFloatSizeh">trunk/Source/WebCore/platform/graphics/FloatSize.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGForeignObjectcpp">trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGDocumentcpp">trunk/Source/WebCore/svg/SVGDocument.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGDocumenth">trunk/Source/WebCore/svg/SVGDocument.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGDocumentExtensionscpp">trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGImageElementcpp">trunk/Source/WebCore/svg/SVGImageElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGMarkerElementcpp">trunk/Source/WebCore/svg/SVGMarkerElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathElementcpp">trunk/Source/WebCore/svg/SVGPathElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPatternElementcpp">trunk/Source/WebCore/svg/SVGPatternElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSVGElementcpp">trunk/Source/WebCore/svg/SVGSVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSVGElementh">trunk/Source/WebCore/svg/SVGSVGElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTransformcpp">trunk/Source/WebCore/svg/SVGTransform.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGViewElementcpp">trunk/Source/WebCore/svg/SVGViewElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGViewSpeccpp">trunk/Source/WebCore/svg/SVGViewSpec.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGZoomAndPancpp">trunk/Source/WebCore/svg/SVGZoomAndPan.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGZoomAndPanh">trunk/Source/WebCore/svg/SVGZoomAndPan.h</a></li>
<li><a href="#trunkSourceWebCoresvganimationSVGSMILElementcpp">trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/ChangeLog        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1,5 +1,144 @@
</span><span class="cx"> 2015-02-11  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Streamline and simplify SVGSVGElement and related classes
+        https://bugs.webkit.org/show_bug.cgi?id=141463
+
+        Reviewed by Antti Koivisto.
+
+        * dom/Document.cpp: Removed unneeded include of SVGSVGElement.h.
+        * loader/FrameLoader.cpp: Ditto.
+        * rendering/RenderBoxModelObject.cpp: Ditto.
+        * rendering/svg/RenderSVGForeignObject.cpp: Ditto.
+        * svg/SVGImageElement.cpp: Ditto.
+        * svg/SVGMarkerElement.cpp: Ditto.
+        * svg/SVGPathElement.cpp: Ditto.
+        * svg/SVGPatternElement.cpp: Ditto.
+        * svg/SVGTransform.cpp: Ditto.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToAnchor): Updated to call the SVGSVGElement function
+        named scrollToAnchor (was setupInitialView). Also refactored to avoid repeating
+        the expression frame().document() so often.
+
+        * platform/graphics/FloatSize.h: Added operator/.
+
+        * svg/SVGDocument.cpp:
+        (WebCore::SVGDocument::rootElement): Rearranged to use early return.
+        (WebCore::SVGDocument::zoomAndPanEnabled): Ditto.
+        (WebCore::SVGDocument::startPan): Ditto. Also used FloatPoint math instead
+        of breaking things apart into x and y.
+        (WebCore::SVGDocument::updatePan): Ditto.
+
+        * svg/SVGDocument.h: Removed some unneeded includes and forward declarations.
+        Moved function bodies out of the class to make it more readable. Renamed
+        m_translate to m_panningOffset and made it a FloatSize instead of FloatPoint.
+
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::startAnimations): Use a modern for loop
+        and update since timeContainer() now returns a reference.
+
+        * svg/SVGSVGElement.cpp: Removed many unneeded includes.
+        (WebCore::SVGSVGElement::SVGSVGElement): Moved initialization of scalars to
+        the class definition. Updated since m_timerContainer is a Ref (later should
+        change it to be a std::unique_ptr or just directly contained in SVGSVGElement).
+        (WebCore::SVGSVGElement::~SVGSVGElement): Removed comment that doesn't say much,
+        but is worded in a confusing way.
+        (WebCore::SVGSVGElement::contentScriptType): Use NeverDestroyed instead of
+        DEPRECATED_DEFINE_STATIC_LOCAL.
+        (WebCore::SVGSVGElement::contentStyleType): Ditto.
+        (WebCore::SVGSVGElement::viewport): Streamlined a bit.
+        (WebCore::SVGSVGElement::pixelUnitToMillimeterX): Ditto.
+        (WebCore::SVGSVGElement::pixelUnitToMillimeterY): Ditto.
+        (WebCore::SVGSVGElement::currentView): Changed to return a reference.
+        (WebCore::SVGSVGElement::frameForCurrentScale): Added. Helper for the two
+        functions below.
+        (WebCore::SVGSVGElement::currentScale): Updated to use frameForCurrentScale.
+        (WebCore::SVGSVGElement::setCurrentScale): Ditto.
+        (WebCore::SVGSVGElement::setCurrentTranslate): Optimized the case where there
+        is no change to the translation. Also changed the data member's name to
+        m_currentTranslate to more directly match the DOM API naming.
+        (WebCore::SVGSVGElement::parseAttribute): Simplified the parsing a bit, and
+        changed to pass a reference to SVGZoomAndPan::parseAttribute.
+        (WebCore::SVGSVGElement::svgAttributeChanged): Tweaked formatting and removed
+        code that converts the renderer pointer to a RenderObject* unnecessarily.
+        (WebCore::SVGSVGElement::suspendRedraw): Removed FIXME about implementing this,
+        since we don't really plan to do that.
+        (WebCore::SVGSVGElement::unsuspendRedraw): Ditto.
+        (WebCore::SVGSVGElement::unsuspendRedrawAll): Ditto.
+        (WebCore::SVGSVGElement::forceRedraw): Ditto.
+        (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): Changed return
+        type to Ref, and pass in a function instead of an enumeration value.
+        (WebCore::SVGSVGElement::getIntersectionList): Updated for above.
+        (WebCore::SVGSVGElement::getEnclosureList): Ditto.
+        (WebCore::SVGSVGElement::checkIntersection): Use &amp;&amp; instead of early return
+        for the null check.
+        (WebCore::SVGSVGElement::checkEnclosure): Ditto.
+        (WebCore::SVGSVGElement::createSVGLength): Use initialization list syntax
+        for greater brevity.
+        (WebCore::SVGSVGElement::createSVGAngle): Ditto.
+        (WebCore::SVGSVGElement::createSVGPoint): Ditto.
+        (WebCore::SVGSVGElement::createSVGMatrix): Ditto.
+        (WebCore::SVGSVGElement::createSVGRect): Ditto.
+        (WebCore::SVGSVGElement::createSVGTransform): Removed unneeded explicit
+        constructor invocation.
+        (WebCore::SVGSVGElement::createSVGTransformFromMatrix): Removed unneeded cast.
+        (WebCore::SVGSVGElement::insertedInto): Updated since timeContainer() now
+        returns a reference.
+        (WebCore::SVGSVGElement::setCurrentTime): Use isfinite instead of isnan, so
+        we won't store infinity as the current time.
+        (WebCore::SVGSVGElement::currentViewBoxRect): Renamed locals and changed
+        to use initializer lists for brevity.
+        (WebCore::SVGSVGElement::currentViewportSize): Streamlined code by using
+        initializer lists, using local variables only for things used more than once,
+        and using the / operator defined above.
+        (WebCore::SVGSVGElement::viewBoxToViewTransform): Use the concatenate function
+        in a way that is more straightforward, rather than doing it with a temporary.
+        (WebCore::SVGSVGElement::scrollToAnchor): Renamed this from
+        setupInitialView.
+        (WebCore::SVGSVGElement::inheritViewAttributes): Changed this to work with
+        references rather than pointers.
+        (WebCore::SVGSVGElement::getElementById): Use getAllElementsById as the
+        FIXME comment suggested for better efficiency when there are a lot of descendants
+        of the &lt;svg&gt; element at the cost of making it less efficient if there are
+        a lot of elements all with the desired ID, but not inside the &lt;svg&gt; element.
+        (WebCore::SVGSVGElement::isValid): Moved here from the header.
+
+        * svg/SVGSVGElement.h: Removed unneeded forward declarations. Moved the
+        animated properties to the top of the file, then other DOM, the other
+        public members. Changed return types to references and Ref. Moved
+        function bodies out of the class definition. Made createSVGNumber inline.
+
+        * svg/SVGViewElement.cpp: Removed unneeded includes.
+        (WebCore::SVGViewElement::isSupportedAttribute): Deleted.
+        (WebCore::SVGViewElement::parseAttribute): Changed to not rely on
+        isSupportedAttribute. Eventually I will do this in all the SVG classes.
+
+        * svg/SVGViewSpec.cpp: Removed unneeded include of SVGSVGElement.h.
+        (WebCore::SVGViewSpec::parseViewSpec): Updated for change in the name
+        of the parse function in the SVGZoomAndPan class.
+
+        * svg/SVGZoomAndPan.cpp:
+        (WebCore::SVGZoomAndPan::isKnownAttribute): Deleted.
+        (WebCore::SVGZoomAndPan::addSupportedAttributes): Deleted.
+        (WebCore::SVGZoomAndPan::parse): Renamed from parseZoomAndPan since
+        this is a member of the SVGZoomAndPan class and also has an argument
+        of SVGZoomAndPanType.
+        (WebCore::SVGZoomAndPan::parseAttributeValue): Added. Helper so the
+        template function is not so big. Also write it in a simpler way.
+        (WebCore::SVGZoomAndPan::ref): Deleted.
+        (WebCore::SVGZoomAndPan::deref): Deleted.
+        (WebCore::SVGZoomAndPan::setZoomAndPan): Deleted.
+
+        * svg/SVGZoomAndPan.h: Removed unneeded includes. Reformatted the enum.
+        Moved function bodies out of the class definition. Removed many unneeded
+        functions.
+
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::insertedInto): Updated since timeContainer
+        now returns a reference rather than a pointer.
+
+2015-02-11  Darin Adler  &lt;darin@apple.com&gt;
+
</ins><span class="cx">         SVGUseElement follow-up improvements
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=141382
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -125,9 +125,9 @@
</span><span class="cx"> #include &quot;ResourceLoader.h&quot;
</span><span class="cx"> #include &quot;RuntimeEnabledFeatures.h&quot;
</span><span class="cx"> #include &quot;SVGDocumentExtensions.h&quot;
</span><ins>+#include &quot;SVGElement.h&quot;
</ins><span class="cx"> #include &quot;SVGElementFactory.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;SchemeRegistry.h&quot;
</span><span class="cx"> #include &quot;ScopedEventQueue.h&quot;
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -99,7 +99,6 @@
</span><span class="cx"> #include &quot;SVGLocatable.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> #include &quot;SVGPreserveAspectRatio.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;SVGViewElement.h&quot;
</span><span class="cx"> #include &quot;SVGViewSpec.h&quot;
</span><span class="cx"> #include &quot;SchemeRegistry.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1981,22 +1981,23 @@
</span><span class="cx"> bool FrameView::scrollToAnchor(const String&amp; name)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(frame().document());
</span><ins>+    auto&amp; document = *frame().document();
</ins><span class="cx"> 
</span><del>-    if (!frame().document()-&gt;haveStylesheetsLoaded()) {
-        frame().document()-&gt;setGotoAnchorNeededAfterStylesheetsLoad(true);
</del><ins>+    if (!document.haveStylesheetsLoaded()) {
+        document.setGotoAnchorNeededAfterStylesheetsLoad(true);
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    frame().document()-&gt;setGotoAnchorNeededAfterStylesheetsLoad(false);
</del><ins>+    document.setGotoAnchorNeededAfterStylesheetsLoad(false);
</ins><span class="cx"> 
</span><del>-    Element* anchorElement = frame().document()-&gt;findAnchor(name);
</del><ins>+    Element* anchorElement = document.findAnchor(name);
</ins><span class="cx"> 
</span><span class="cx">     // Setting to null will clear the current target.
</span><del>-    frame().document()-&gt;setCSSTarget(anchorElement);
</del><ins>+    document.setCSSTarget(anchorElement);
</ins><span class="cx"> 
</span><del>-    if (is&lt;SVGDocument&gt;(*frame().document())) {
-        if (SVGSVGElement* svg = downcast&lt;SVGDocument&gt;(*frame().document()).rootElement()) {
-            svg-&gt;setupInitialView(name, anchorElement);
</del><ins>+    if (is&lt;SVGDocument&gt;(document)) {
+        if (auto* rootElement = downcast&lt;SVGDocument&gt;(document).rootElement()) {
+            rootElement-&gt;scrollToAnchor(name, anchorElement);
</ins><span class="cx">             if (!anchorElement)
</span><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="lines">@@ -2013,7 +2014,7 @@
</span><span class="cx">     
</span><span class="cx">     // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
</span><span class="cx">     if (anchorElement &amp;&amp; anchorElement-&gt;isFocusable())
</span><del>-        frame().document()-&gt;setFocusedElement(anchorElement);
</del><ins>+        document.setFocusedElement(anchorElement);
</ins><span class="cx">     
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFloatSizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FloatSize.h (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FloatSize.h        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/platform/graphics/FloatSize.h        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -153,16 +153,26 @@
</span><span class="cx">     return FloatSize(-size.width(), -size.height());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline FloatSize operator*(const FloatSize&amp; a, const float b)
</del><ins>+inline FloatSize operator*(const FloatSize&amp; a, float b)
</ins><span class="cx"> {
</span><span class="cx">     return FloatSize(a.width() * b, a.height() * b);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline FloatSize operator*(const float a, const FloatSize&amp; b)
</del><ins>+inline FloatSize operator*(float a, const FloatSize&amp; b)
</ins><span class="cx"> {
</span><span class="cx">     return FloatSize(a * b.width(), a * b.height());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline FloatSize operator/(const FloatSize&amp; a, float b)
+{
+    return FloatSize(a.width() / b, a.height() / b);
+}
+
+inline FloatSize operator/(float a, const FloatSize&amp; b)
+{
+    return FloatSize(a / b.width(), a / b.height());
+}
+
</ins><span class="cx"> inline bool operator==(const FloatSize&amp; a, const FloatSize&amp; b)
</span><span class="cx"> {
</span><span class="cx">     return a.width() == b.width() &amp;&amp; a.height() == b.height();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx"> #include &quot;RenderTextFragment.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;SVGImageForContainer.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;ScrollingConstraints.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StyleCachedImage.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGForeignObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include &quot;SVGForeignObjectElement.h&quot;
</span><span class="cx"> #include &quot;SVGRenderingContext.h&quot;
</span><span class="cx"> #include &quot;SVGResourcesCache.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;TransformState.h&quot;
</span><span class="cx"> #include &lt;wtf/StackStats.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGDocument.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGDocument.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGDocument.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis &lt;buis@kde.org&gt;
</span><ins>+ * Copyright (C) 2015 Apple Inc. All right reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -21,16 +22,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;SVGDocument.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;EventNames.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;FrameView.h&quot;
-#include &quot;RenderView.h&quot;
-#include &quot;SVGElement.h&quot;
-#include &quot;SVGNames.h&quot;
</del><span class="cx"> #include &quot;SVGSVGElement.h&quot;
</span><span class="cx"> #include &quot;SVGViewSpec.h&quot;
</span><del>-#include &quot;SVGZoomAndPan.h&quot;
-#include &quot;SVGZoomEvent.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -42,38 +35,33 @@
</span><span class="cx"> SVGSVGElement* SVGDocument::rootElement() const
</span><span class="cx"> {
</span><span class="cx">     Element* element = documentElement();
</span><del>-    if (is&lt;SVGSVGElement&gt;(element))
-        return downcast&lt;SVGSVGElement&gt;(element);
-
-    return nullptr;
</del><ins>+    if (!is&lt;SVGSVGElement&gt;(element))
+        return nullptr;
+    return downcast&lt;SVGSVGElement&gt;(element);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGDocument::zoomAndPanEnabled() const
</span><span class="cx"> {
</span><del>-    if (rootElement()) {
-        if (rootElement()-&gt;useCurrentView()) {
-            if (rootElement()-&gt;currentView())
-                return rootElement()-&gt;currentView()-&gt;zoomAndPan() == SVGZoomAndPanMagnify;
-        } else
-            return rootElement()-&gt;zoomAndPan() == SVGZoomAndPanMagnify;
-    }
-
-    return false;
</del><ins>+    auto* element = rootElement();
+    if (!element)
+        return false;
+    return (element-&gt;useCurrentView() ? element-&gt;currentView().zoomAndPan() : element-&gt;zoomAndPan()) == SVGZoomAndPanMagnify;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGDocument::startPan(const FloatPoint&amp; start)
</span><span class="cx"> {
</span><del>-    if (rootElement())
-        m_translate = FloatPoint(start.x() - rootElement()-&gt;currentTranslate().x(), start.y() - rootElement()-&gt;currentTranslate().y());
</del><ins>+    auto* element = rootElement();
+    if (!element)
+        return;
+    m_panningOffset = start - element-&gt;currentTranslate();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGDocument::updatePan(const FloatPoint&amp; pos) const
</del><ins>+void SVGDocument::updatePan(const FloatPoint&amp; position) const
</ins><span class="cx"> {
</span><del>-    if (rootElement()) {
-        rootElement()-&gt;setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
-        if (renderView())
-            renderView()-&gt;repaint();
-    }
</del><ins>+    auto* element = rootElement();
+    if (!element)
+        return;
+    element-&gt;setCurrentTranslate(position - m_panningOffset);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Document&gt; SVGDocument::cloneDocumentWithoutChildren() const
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGDocument.h (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGDocument.h        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGDocument.h        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis &lt;buis@kde.org&gt;
</span><ins>+ * Copyright (C) 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -22,36 +23,34 @@
</span><span class="cx"> #define SVGDocument_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;FloatPoint.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class DOMImplementation;
-class SVGElement;
</del><span class="cx"> class SVGSVGElement;
</span><span class="cx"> 
</span><span class="cx"> class SVGDocument final : public Document {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;SVGDocument&gt; create(Frame* frame, const URL&amp; url)
-    {
-        return adoptRef(*new SVGDocument(frame, url));
-    }
</del><ins>+    static Ref&lt;SVGDocument&gt; create(Frame*, const URL&amp;);
</ins><span class="cx"> 
</span><span class="cx">     SVGSVGElement* rootElement() const;
</span><span class="cx"> 
</span><span class="cx">     bool zoomAndPanEnabled() const;
</span><del>-
</del><span class="cx">     void startPan(const FloatPoint&amp; start);
</span><del>-    void updatePan(const FloatPoint&amp; pos) const;
</del><ins>+    void updatePan(const FloatPoint&amp; position) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     SVGDocument(Frame*, const URL&amp;);
</span><span class="cx"> 
</span><span class="cx">     virtual Ref&lt;Document&gt; cloneDocumentWithoutChildren() const override;
</span><span class="cx"> 
</span><del>-    FloatPoint m_translate;
</del><ins>+    FloatSize m_panningOffset;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+inline Ref&lt;SVGDocument&gt; SVGDocument::create(Frame* frame, const URL&amp; url)
+{
+    return adoptRef(*new SVGDocument(frame, url));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SVGDocument)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGDocumentExtensionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -95,9 +95,8 @@
</span><span class="cx">     // In the future we should refactor the use-element to avoid this. See https://webkit.org/b/53704
</span><span class="cx">     Vector&lt;RefPtr&lt;SVGSVGElement&gt;&gt; timeContainers;
</span><span class="cx">     timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end());
</span><del>-    auto end = timeContainers.end();
-    for (auto it = timeContainers.begin(); it != end; ++it)
-        (*it)-&gt;timeContainer()-&gt;begin();
</del><ins>+    for (auto&amp; element : timeContainers)
+        element-&gt;timeContainer().begin();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGDocumentExtensions::pauseAnimations()
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGImageElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGImageElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGImageElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGImageElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #include &quot;RenderSVGImage.h&quot;
</span><span class="cx"> #include &quot;RenderSVGResource.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;XLinkNames.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGMarkerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGMarkerElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGMarkerElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #include &quot;RenderSVGResourceMarker.h&quot;
</span><span class="cx"> #include &quot;SVGFitToViewBox.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGPathElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -49,7 +49,6 @@
</span><span class="cx"> #include &quot;SVGPathSegMovetoAbs.h&quot;
</span><span class="cx"> #include &quot;SVGPathSegMovetoRel.h&quot;
</span><span class="cx"> #include &quot;SVGPathUtilities.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPatternElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPatternElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPatternElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGPatternElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #include &quot;SVGGraphicsElement.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> #include &quot;SVGRenderSupport.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;SVGTransformable.h&quot;
</span><span class="cx"> #include &quot;XLinkNames.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSVGElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis &lt;buis@kde.org&gt;
</span><del>- * Copyright (C) 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -23,39 +23,18 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;SVGSVGElement.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;AffineTransform.h&quot;
-#include &quot;Attribute.h&quot;
</del><span class="cx"> #include &quot;CSSHelper.h&quot;
</span><del>-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><del>-#include &quot;EventListener.h&quot;
-#include &quot;EventNames.h&quot;
-#include &quot;FloatConversion.h&quot;
-#include &quot;FloatRect.h&quot;
-#include &quot;Frame.h&quot;
</del><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><del>-#include &quot;FrameTree.h&quot;
-#include &quot;FrameView.h&quot;
-#include &quot;HTMLNames.h&quot;
-#include &quot;RenderObject.h&quot;
</del><ins>+#include &quot;MainFrame.h&quot;
</ins><span class="cx"> #include &quot;RenderSVGResource.h&quot;
</span><del>-#include &quot;RenderSVGModelObject.h&quot;
</del><span class="cx"> #include &quot;RenderSVGRoot.h&quot;
</span><span class="cx"> #include &quot;RenderSVGViewportContainer.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><del>-#include &quot;RenderWidget.h&quot;
</del><span class="cx"> #include &quot;SMILTimeContainer.h&quot;
</span><del>-#include &quot;SVGAngle.h&quot;
-#include &quot;SVGFitToViewBox.h&quot;
-#include &quot;SVGNames.h&quot;
-#include &quot;SVGPreserveAspectRatio.h&quot;
-#include &quot;SVGTransform.h&quot;
-#include &quot;SVGTransformList.h&quot;
</del><span class="cx"> #include &quot;SVGViewElement.h&quot;
</span><span class="cx"> #include &quot;SVGViewSpec.h&quot;
</span><del>-#include &quot;SVGZoomEvent.h&quot;
</del><span class="cx"> #include &quot;StaticNodeList.h&quot;
</span><del>-#include &lt;wtf/StdLibExtras.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -85,9 +64,7 @@
</span><span class="cx">     , m_y(LengthModeHeight)
</span><span class="cx">     , m_width(LengthModeWidth, ASCIILiteral(&quot;100%&quot;))
</span><span class="cx">     , m_height(LengthModeHeight, ASCIILiteral(&quot;100%&quot;))
</span><del>-    , m_useCurrentView(false)
-    , m_zoomAndPan(SVGZoomAndPanMagnify)
-    , m_timeContainer(SMILTimeContainer::create(this))
</del><ins>+    , m_timeContainer(RefPtr&lt;SMILTimeContainer&gt;(SMILTimeContainer::create(this)).releaseNonNull())
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(hasTagName(SVGNames::svgTag));
</span><span class="cx">     registerAnimatedPropertiesForSVGSVGElement();
</span><span class="lines">@@ -109,8 +86,6 @@
</span><span class="cx">     if (m_viewSpec)
</span><span class="cx">         m_viewSpec-&gt;resetContextElement();
</span><span class="cx">     document().unregisterForPageCacheSuspensionCallbacks(this);
</span><del>-    // There are cases where removedFromDocument() is not called.
-    // see ContainerNode::removeAllChildren, called by its destructor.
</del><span class="cx">     document().accessSVGExtensions().removeTimeContainer(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -124,9 +99,9 @@
</span><span class="cx"> 
</span><span class="cx"> const AtomicString&amp; SVGSVGElement::contentScriptType() const
</span><span class="cx"> {
</span><del>-    DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, (&quot;text/ecmascript&quot;, AtomicString::ConstructFromLiteral));
-    const AtomicString&amp; n = fastGetAttribute(SVGNames::contentScriptTypeAttr);
-    return n.isNull() ? defaultValue : n;
</del><ins>+    static NeverDestroyed&lt;AtomicString&gt; defaultScriptType { &quot;text/ecmascript&quot; };
+    const AtomicString&amp; type = fastGetAttribute(SVGNames::contentScriptTypeAttr);
+    return type.isNull() ? defaultScriptType.get() : type;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::setContentScriptType(const AtomicString&amp; type)
</span><span class="lines">@@ -136,9 +111,9 @@
</span><span class="cx"> 
</span><span class="cx"> const AtomicString&amp; SVGSVGElement::contentStyleType() const
</span><span class="cx"> {
</span><del>-    DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, (&quot;text/css&quot;, AtomicString::ConstructFromLiteral));
-    const AtomicString&amp; n = fastGetAttribute(SVGNames::contentStyleTypeAttr);
-    return n.isNull() ? defaultValue : n;
</del><ins>+    static NeverDestroyed&lt;AtomicString&gt; defaultStyleType { &quot;text/css&quot; };
+    const AtomicString&amp; type = fastGetAttribute(SVGNames::contentStyleTypeAttr);
+    return type.isNull() ? defaultStyleType.get() : type;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::setContentStyleType(const AtomicString&amp; type)
</span><span class="lines">@@ -148,21 +123,20 @@
</span><span class="cx"> 
</span><span class="cx"> FloatRect SVGSVGElement::viewport() const
</span><span class="cx"> {
</span><del>-    // FIXME: This method doesn't follow the spec and is basically untested. Parent documents are not considered here.
-    // As we have no test coverage for this, we're going to disable it completly for now.
-    return FloatRect();
</del><ins>+    // FIXME: Not implemented.
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float SVGSVGElement::pixelUnitToMillimeterX() const
</span><span class="cx"> {
</span><del>-    // 2.54 / cssPixelsPerInch gives CM.
-    return (2.54f / cssPixelsPerInch) * 10.0f;
</del><ins>+    // There are 25.4 millimeters in an inch.
+    return 25.4f / cssPixelsPerInch;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float SVGSVGElement::pixelUnitToMillimeterY() const
</span><span class="cx"> {
</span><del>-    // 2.54 / cssPixelsPerInch gives CM.
-    return (2.54f / cssPixelsPerInch) * 10.0f;
</del><ins>+    // There are 25.4 millimeters in an inch.
+    return 25.4f / cssPixelsPerInch;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float SVGSVGElement::screenPixelToMillimeterX() const
</span><span class="lines">@@ -175,49 +149,42 @@
</span><span class="cx">     return pixelUnitToMillimeterY();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGViewSpec* SVGSVGElement::currentView()
</del><ins>+SVGViewSpec&amp; SVGSVGElement::currentView()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_viewSpec)
</span><span class="cx">         m_viewSpec = SVGViewSpec::create(this);
</span><del>-    return m_viewSpec.get();
</del><ins>+    return *m_viewSpec;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-float SVGSVGElement::currentScale() const
</del><ins>+Frame* SVGSVGElement::frameForCurrentScale() const
</ins><span class="cx"> {
</span><ins>+    // The behavior of currentScale() is undefined when we're dealing with non-standalone SVG documents.
+    // If the document is embedded, the scaling is handled by the host renderer.
</ins><span class="cx">     if (!inDocument() || !isOutermostSVGSVGElement())
</span><del>-        return 1;
-
</del><ins>+        return nullptr;
</ins><span class="cx">     Frame* frame = document().frame();
</span><del>-    if (!frame)
-        return 1;
</del><ins>+    return frame &amp;&amp; frame-&gt;isMainFrame() ? frame : nullptr;
+}
</ins><span class="cx"> 
</span><del>-    // The behaviour of currentScale() is undefined, when we're dealing with non-standalone SVG documents.
-    // If the svg is embedded, the scaling is handled by the host renderer, so when asking from inside
-    // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale.
-    return frame-&gt;tree().parent() ? 1 : frame-&gt;pageZoomFactor();
</del><ins>+float SVGSVGElement::currentScale() const
+{
+    // When asking from inside an embedded SVG document, a scale value of 1 seems reasonable, as it doesn't
+    // know anything about the parent scale.
+    Frame* frame = frameForCurrentScale();
+    return frame ? frame-&gt;pageZoomFactor() : 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::setCurrentScale(float scale)
</span><span class="cx"> {
</span><del>-    if (!inDocument() || !isOutermostSVGSVGElement())
-        return;
-
-    Frame* frame = document().frame();
-    if (!frame)
-        return;
-
-    // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents.
-    // We choose the ignore this call, it's pretty useless to support calling setCurrentScale() from within
-    // an embedded SVG document, for the same reasons as in currentScale() - needs resolution by SVG WG.
-    if (frame-&gt;tree().parent())
-        return;
-
-    frame-&gt;setPageZoomFactor(scale);
</del><ins>+    if (Frame* frame = frameForCurrentScale())
+        frame-&gt;setPageZoomFactor(scale);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::setCurrentTranslate(const FloatPoint&amp; translation)
</span><span class="cx"> {
</span><del>-    m_translation = translation;
</del><ins>+    if (m_currentTranslate == translation)
+        return;
+    m_currentTranslate = translation;
</ins><span class="cx">     updateCurrentTranslate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -225,34 +192,37 @@
</span><span class="cx"> {
</span><span class="cx">     if (RenderObject* object = renderer())
</span><span class="cx">         object-&gt;setNeedsLayout();
</span><del>-
</del><span class="cx">     if (parentNode() == &amp;document() &amp;&amp; document().renderView())
</span><span class="cx">         document().renderView()-&gt;repaint();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><del>-    SVGParsingError parseError = NoError;
-
</del><span class="cx">     if (!nearestViewportElement()) {
</span><del>-        bool setListener = true;
-
-        // Only handle events if we're the outermost &lt;svg&gt; element
-        if (name == HTMLNames::onunloadAttr)
</del><ins>+        // Since we only handle events if we're the outermost &lt;svg&gt; element, set listeners only
+        // if we are. Set the listeners directly on the window attribute.
+        // FIXME: This strategy is wrong. It won't work if we an existing &lt;svg&gt; element becomes
+        // the outermost or if an existing &lt;svg&gt; element later becomes no longer outmost.
+        if (name == HTMLNames::onunloadAttr) {
</ins><span class="cx">             document().setWindowAttributeEventListener(eventNames().unloadEvent, name, value);
</span><del>-        else if (name == HTMLNames::onresizeAttr)
</del><ins>+            return;
+        }
+        if (name == HTMLNames::onresizeAttr) {
</ins><span class="cx">             document().setWindowAttributeEventListener(eventNames().resizeEvent, name, value);
</span><del>-        else if (name == HTMLNames::onscrollAttr)
</del><ins>+            return;
+        }
+        if (name == HTMLNames::onscrollAttr) {
</ins><span class="cx">             document().setWindowAttributeEventListener(eventNames().scrollEvent, name, value);
</span><del>-        else if (name == SVGNames::onzoomAttr)
</del><ins>+            return;
+        }
+        if (name == SVGNames::onzoomAttr) {
</ins><span class="cx">             document().setWindowAttributeEventListener(eventNames().zoomEvent, name, value);
</span><del>-        else
-            setListener = false;

-        if (setListener)
</del><span class="cx">             return;
</span><ins>+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    SVGParsingError parseError = NoError;
+
</ins><span class="cx">     if (name == HTMLNames::onabortAttr)
</span><span class="cx">         document().setWindowAttributeEventListener(eventNames().abortEvent, name, value);
</span><span class="cx">     else if (name == HTMLNames::onerrorAttr)
</span><span class="lines">@@ -277,31 +247,29 @@
</span><span class="cx">             length = SVGLength(LengthModeHeight, ASCIILiteral(&quot;100%&quot;));
</span><span class="cx">         }
</span><span class="cx">         setHeightBaseValue(length);
</span><del>-    } else if (SVGLangSpace::parseAttribute(name, value)
-               || SVGExternalResourcesRequired::parseAttribute(name, value)
-               || SVGFitToViewBox::parseAttribute(this, name, value)
-               || SVGZoomAndPan::parseAttribute(this, name, value)) {
-    } else
-        SVGGraphicsElement::parseAttribute(name, value);
</del><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     reportAttributeParsingError(parseError, name, value);
</span><ins>+
+    SVGLangSpace::parseAttribute(name, value);
+    SVGExternalResourcesRequired::parseAttribute(name, value);
+    SVGFitToViewBox::parseAttribute(this, name, value);
+    SVGZoomAndPan::parseAttribute(*this, name, value);
+    SVGGraphicsElement::parseAttribute(name, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::svgAttributeChanged(const QualifiedName&amp; attrName)
</span><span class="cx"> {
</span><span class="cx">     bool updateRelativeLengthsOrViewBox = false;
</span><del>-    if (attrName == SVGNames::widthAttr
-        || attrName == SVGNames::heightAttr
-        || attrName == SVGNames::xAttr
-        || attrName == SVGNames::yAttr) {
</del><ins>+    if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
</ins><span class="cx">         invalidateSVGPresentationAttributeStyle();
</span><span class="cx">         updateRelativeLengthsOrViewBox = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (SVGFitToViewBox::isKnownAttribute(attrName)) {
</span><span class="cx">         updateRelativeLengthsOrViewBox = true; 
</span><del>-        if (RenderObject* object = renderer())
-            object-&gt;setNeedsTransformUpdate();
</del><ins>+        if (auto* renderer = this-&gt;renderer())
+            renderer-&gt;setNeedsTransformUpdate();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     InstanceInvalidationGuard guard(*this);
</span><span class="lines">@@ -318,66 +286,51 @@
</span><span class="cx">     SVGGraphicsElement::svgAttributeChanged(attrName);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned SVGSVGElement::suspendRedraw(unsigned /* maxWaitMilliseconds */)
</del><ins>+unsigned SVGSVGElement::suspendRedraw(unsigned)
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement me (see bug 11275)
</del><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGSVGElement::unsuspendRedraw(unsigned /* suspendHandleId */)
</del><ins>+void SVGSVGElement::unsuspendRedraw(unsigned)
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement me (see bug 11275)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::unsuspendRedrawAll()
</span><span class="cx"> {
</span><del>-    // FIXME: Implement me (see bug 11275)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::forceRedraw()
</span><span class="cx"> {
</span><del>-    // FIXME: Implement me (see bug 11275)
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;NodeList&gt; SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect&amp; rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect) const
</del><ins>+Ref&lt;NodeList&gt; SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect&amp; rect, SVGElement* referenceElement, bool (*checkFunction)(const SVGElement*, const FloatRect&amp;))
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;Ref&lt;Element&gt;&gt; elements;
</span><del>-
-    for (auto&amp; svgElement : descendantsOfType&lt;SVGElement&gt;(*(referenceElement ? referenceElement : this))) {
-        if (collect == CollectIntersectionList) {
-            if (RenderSVGModelObject::checkIntersection(svgElement.renderer(), rect))
-                elements.append(const_cast&lt;SVGElement&amp;&gt;(svgElement));
-        } else {
-            if (RenderSVGModelObject::checkEnclosure(svgElement.renderer(), rect))
-                elements.append(const_cast&lt;SVGElement&amp;&gt;(svgElement));
-        }
</del><ins>+    for (auto&amp; element : descendantsOfType&lt;SVGElement&gt;(referenceElement ? *referenceElement : *this)) {
+        if (checkFunction(&amp;element, rect))
+            elements.append(element);
</ins><span class="cx">     }
</span><del>-
-    return StaticElementList::adopt(elements);
</del><ins>+    return RefPtr&lt;NodeList&gt;(StaticElementList::adopt(elements)).releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;NodeList&gt; SVGSVGElement::getIntersectionList(const FloatRect&amp; rect, SVGElement* referenceElement) const
</del><ins>+Ref&lt;NodeList&gt; SVGSVGElement::getIntersectionList(const FloatRect&amp; rect, SVGElement* referenceElement)
</ins><span class="cx"> {
</span><del>-    return collectIntersectionOrEnclosureList(rect, referenceElement, CollectIntersectionList);
</del><ins>+    return collectIntersectionOrEnclosureList(rect, referenceElement, checkIntersection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;NodeList&gt; SVGSVGElement::getEnclosureList(const FloatRect&amp; rect, SVGElement* referenceElement) const
</del><ins>+Ref&lt;NodeList&gt; SVGSVGElement::getEnclosureList(const FloatRect&amp; rect, SVGElement* referenceElement)
</ins><span class="cx"> {
</span><del>-    return collectIntersectionOrEnclosureList(rect, referenceElement, CollectEnclosureList);
</del><ins>+    return collectIntersectionOrEnclosureList(rect, referenceElement, checkEnclosure);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGSVGElement::checkIntersection(const SVGElement* element, const FloatRect&amp; rect) const
</del><ins>+bool SVGSVGElement::checkIntersection(const SVGElement* element, const FloatRect&amp; rect)
</ins><span class="cx"> {
</span><del>-    if (!element)
-        return false;
-    return RenderSVGModelObject::checkIntersection(element-&gt;renderer(), rect);
</del><ins>+    return element &amp;&amp; RenderSVGModelObject::checkIntersection(element-&gt;renderer(), rect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGSVGElement::checkEnclosure(const SVGElement* element, const FloatRect&amp; rect) const
</del><ins>+bool SVGSVGElement::checkEnclosure(const SVGElement* element, const FloatRect&amp; rect)
</ins><span class="cx"> {
</span><del>-    if (!element)
-        return false;
-    return RenderSVGModelObject::checkEnclosure(element-&gt;renderer(), rect);
</del><ins>+    return element &amp;&amp; RenderSVGModelObject::checkEnclosure(element-&gt;renderer(), rect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::deselectAll()
</span><span class="lines">@@ -386,44 +339,39 @@
</span><span class="cx">         frame-&gt;selection().clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float SVGSVGElement::createSVGNumber()
-{
-    return 0.0f;
-}
-
</del><span class="cx"> SVGLength SVGSVGElement::createSVGLength()
</span><span class="cx"> {
</span><del>-    return SVGLength();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SVGAngle SVGSVGElement::createSVGAngle()
</span><span class="cx"> {
</span><del>-    return SVGAngle();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SVGPoint SVGSVGElement::createSVGPoint()
</span><span class="cx"> {
</span><del>-    return SVGPoint();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SVGMatrix SVGSVGElement::createSVGMatrix()
</span><span class="cx"> {
</span><del>-    return SVGMatrix();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatRect SVGSVGElement::createSVGRect()
</span><span class="cx"> {
</span><del>-    return FloatRect();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SVGTransform SVGSVGElement::createSVGTransform()
</span><span class="cx"> {
</span><del>-    return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX);
</del><ins>+    return SVGTransform::SVG_TRANSFORM_MATRIX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix&amp; matrix)
</span><span class="cx"> {
</span><del>-    return SVGTransform(static_cast&lt;const AffineTransform&amp;&gt;(matrix));
</del><ins>+    return SVGTransform { matrix };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const
</span><span class="lines">@@ -439,7 +387,7 @@
</span><span class="cx">         SVGLengthContext lengthContext(this);
</span><span class="cx">         transform.translate(x().value(lengthContext), y().value(lengthContext));
</span><span class="cx">     } else if (mode == SVGLocatable::ScreenScope) {
</span><del>-        if (RenderElement* renderer = this-&gt;renderer()) {
</del><ins>+        if (auto* renderer = this-&gt;renderer()) {
</ins><span class="cx">             FloatPoint location;
</span><span class="cx">             float zoomFactor = 1;
</span><span class="cx"> 
</span><span class="lines">@@ -490,7 +438,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (isOutermostSVGSVGElement())
</span><span class="cx">         return createRenderer&lt;RenderSVGRoot&gt;(*this, WTF::move(style));
</span><del>-
</del><span class="cx">     return createRenderer&lt;RenderSVGViewportContainer&gt;(*this, WTF::move(style));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -502,8 +449,8 @@
</span><span class="cx">         // Animations are started at the end of document parsing and after firing the load event,
</span><span class="cx">         // but if we miss that train (deferred programmatic element insertion for example) we need
</span><span class="cx">         // to initialize the time container here.
</span><del>-        if (!document().parsing() &amp;&amp; !document().processingLoadEvent() &amp;&amp; document().loadEventFinished() &amp;&amp; !timeContainer()-&gt;isStarted())
-            timeContainer()-&gt;begin();
</del><ins>+        if (!document().parsing() &amp;&amp; !document().processingLoadEvent() &amp;&amp; document().loadEventFinished() &amp;&amp; !m_timeContainer-&gt;isStarted())
+            m_timeContainer-&gt;begin();
</ins><span class="cx">     }
</span><span class="cx">     return SVGGraphicsElement::insertedInto(rootParent);
</span><span class="cx"> }
</span><span class="lines">@@ -539,10 +486,9 @@
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::setCurrentTime(float seconds)
</span><span class="cx"> {
</span><del>-    if (std::isnan(seconds))
</del><ins>+    if (!std::isfinite(seconds))
</ins><span class="cx">         return;
</span><del>-    seconds = std::max(seconds, 0.0f);
-    m_timeContainer-&gt;setElapsed(seconds);
</del><ins>+    m_timeContainer-&gt;setElapsed(std::max(seconds, 0.0f));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGSVGElement::selfHasRelativeLengths() const
</span><span class="lines">@@ -559,42 +505,39 @@
</span><span class="cx">     if (m_useCurrentView)
</span><span class="cx">         return m_viewSpec ? m_viewSpec-&gt;viewBox() : FloatRect();
</span><span class="cx"> 
</span><del>-    FloatRect useViewBox = viewBox();
-    if (!useViewBox.isEmpty())
-        return useViewBox;
</del><ins>+    FloatRect viewBox = this-&gt;viewBox();
+    if (!viewBox.isEmpty())
+        return viewBox;
+
</ins><span class="cx">     if (!is&lt;RenderSVGRoot&gt;(renderer()))
</span><del>-        return FloatRect();
</del><ins>+        return { };
</ins><span class="cx">     if (!downcast&lt;RenderSVGRoot&gt;(*renderer()).isEmbeddedThroughSVGImage())
</span><del>-        return FloatRect();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     Length intrinsicWidth = this-&gt;intrinsicWidth();
</span><span class="cx">     Length intrinsicHeight = this-&gt;intrinsicHeight();
</span><span class="cx">     if (!intrinsicWidth.isFixed() || !intrinsicHeight.isFixed())
</span><del>-        return FloatRect();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     // If no viewBox is specified but non-relative width/height values, then we
</span><span class="cx">     // should always synthesize a viewBox if we're embedded through a SVGImage.    
</span><del>-    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
</del><ins>+    return { 0, 0, floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0) };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatSize SVGSVGElement::currentViewportSize() const
</span><span class="cx"> {
</span><del>-    if (hasIntrinsicWidth() &amp;&amp; hasIntrinsicHeight()) {
-        Length intrinsicWidth = this-&gt;intrinsicWidth();
-        Length intrinsicHeight = this-&gt;intrinsicHeight();
-        return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
-    }
</del><ins>+    if (hasIntrinsicWidth() &amp;&amp; hasIntrinsicHeight())
+        return { floatValueForLength(intrinsicWidth(), 0), floatValueForLength(intrinsicHeight(), 0) };
</ins><span class="cx"> 
</span><span class="cx">     if (!renderer())
</span><del>-        return FloatSize();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     if (is&lt;RenderSVGRoot&gt;(*renderer())) {
</span><del>-        LayoutRect contentBoxRect = downcast&lt;RenderSVGRoot&gt;(*renderer()).contentBoxRect();
-        return FloatSize(contentBoxRect.width() / renderer()-&gt;style().effectiveZoom(), contentBoxRect.height() / renderer()-&gt;style().effectiveZoom());
</del><ins>+        auto&amp; root = downcast&lt;RenderSVGRoot&gt;(*renderer());
+        return root.contentBoxRect().size() / root.style().effectiveZoom();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FloatRect viewportRect = downcast&lt;RenderSVGViewportContainer&gt;(*renderer()).viewport();
-    return FloatSize(viewportRect.width(), viewportRect.height());
</del><ins>+    return downcast&lt;RenderSVGViewportContainer&gt;(*renderer()).viewport().size();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGSVGElement::hasIntrinsicWidth() const
</span><span class="lines">@@ -630,19 +573,12 @@
</span><span class="cx">     if (!m_useCurrentView || !m_viewSpec)
</span><span class="cx">         return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight);
</span><span class="cx"> 
</span><del>-    AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec-&gt;preserveAspectRatio(), viewWidth, viewHeight);
-    const SVGTransformList&amp; transformList = m_viewSpec-&gt;transformBaseValue();
-    if (transformList.isEmpty())
-        return ctm;
-
-    AffineTransform transform;
-    if (transformList.concatenate(transform))
-        ctm *= transform;
-
-    return ctm;
</del><ins>+    AffineTransform transform = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec-&gt;preserveAspectRatio(), viewWidth, viewHeight);
+    m_viewSpec-&gt;transformBaseValue().concatenate(transform);
+    return transform;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGSVGElement::setupInitialView(const String&amp; fragmentIdentifier, Element* anchorNode)
</del><ins>+void SVGSVGElement::scrollToAnchor(const String&amp; fragmentIdentifier, Element* anchorNode)
</ins><span class="cx"> {
</span><span class="cx">     auto renderer = this-&gt;renderer();
</span><span class="cx">     SVGViewSpec* view = m_viewSpec.get();
</span><span class="lines">@@ -661,30 +597,27 @@
</span><span class="cx"> 
</span><span class="cx">     if (fragmentIdentifier.startsWith(&quot;svgView(&quot;)) {
</span><span class="cx">         if (!view)
</span><del>-            view = currentView(); // Create the SVGViewSpec.
-
</del><ins>+            view = &amp;currentView(); // Create the SVGViewSpec.
</ins><span class="cx">         if (view-&gt;parseViewSpec(fragmentIdentifier))
</span><span class="cx">             m_useCurrentView = true;
</span><span class="cx">         else
</span><span class="cx">             view-&gt;reset();
</span><del>-
</del><span class="cx">         if (renderer &amp;&amp; (hadUseCurrentView || m_useCurrentView))
</span><span class="cx">             RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Spec: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView
-    // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport.
-    // Any view specification attributes included on the given ‘view’ element override the corresponding view specification
-    // attributes on the closest ancestor ‘svg’ element.
</del><ins>+    // Spec: If the SVG fragment identifier addresses a &quot;view&quot; element within an SVG document (e.g., MyDrawing.svg#MyView
+    // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor &quot;svg&quot; element is displayed in the viewport.
+    // Any view specification attributes included on the given &quot;view&quot; element override the corresponding view specification
+    // attributes on the closest ancestor &quot;svg&quot; element.
</ins><span class="cx">     if (is&lt;SVGViewElement&gt;(anchorNode)) {
</span><del>-        SVGViewElement&amp; viewElement = downcast&lt;SVGViewElement&gt;(*anchorNode);
-        SVGElement* element = SVGLocatable::nearestViewportElement(&amp;viewElement);
-        if (is&lt;SVGSVGElement&gt;(*element)) {
-            SVGSVGElement&amp; svg = downcast&lt;SVGSVGElement&gt;(*element);
-            svg.inheritViewAttributes(&amp;viewElement);
-
-            if (RenderElement* renderer = svg.renderer())
</del><ins>+        auto&amp; viewElement = downcast&lt;SVGViewElement&gt;(*anchorNode);
+        auto* viewportElement = SVGLocatable::nearestViewportElement(&amp;viewElement);
+        if (is&lt;SVGSVGElement&gt;(viewportElement)) {
+            auto&amp; element = downcast&lt;SVGSVGElement&gt;(*viewportElement);
+            element.inheritViewAttributes(viewElement);
+            if (auto* renderer = element.renderer())
</ins><span class="cx">                 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
</span><span class="cx">         }
</span><span class="cx">         return;
</span><span class="lines">@@ -694,25 +627,25 @@
</span><span class="cx">     // FIXME: We need to actually &quot;highlight&quot; the viewTarget(s).
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement)
</del><ins>+void SVGSVGElement::inheritViewAttributes(const SVGViewElement&amp; viewElement)
</ins><span class="cx"> {
</span><del>-    SVGViewSpec* view = currentView();
</del><ins>+    SVGViewSpec&amp; view = currentView();
</ins><span class="cx">     m_useCurrentView = true;
</span><span class="cx"> 
</span><del>-    if (viewElement-&gt;hasAttribute(SVGNames::viewBoxAttr))
-        view-&gt;setViewBoxBaseValue(viewElement-&gt;viewBox());
</del><ins>+    if (viewElement.hasAttribute(SVGNames::viewBoxAttr))
+        view.setViewBoxBaseValue(viewElement.viewBox());
</ins><span class="cx">     else
</span><del>-        view-&gt;setViewBoxBaseValue(viewBox());
</del><ins>+        view.setViewBoxBaseValue(viewBox());
</ins><span class="cx"> 
</span><del>-    if (viewElement-&gt;hasAttribute(SVGNames::preserveAspectRatioAttr))
-        view-&gt;setPreserveAspectRatioBaseValue(viewElement-&gt;preserveAspectRatioBaseValue());
</del><ins>+    if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr))
+        view.setPreserveAspectRatioBaseValue(viewElement.preserveAspectRatioBaseValue());
</ins><span class="cx">     else
</span><del>-        view-&gt;setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue());
</del><ins>+        view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue());
</ins><span class="cx"> 
</span><del>-    if (viewElement-&gt;hasAttribute(SVGNames::zoomAndPanAttr))
-        view-&gt;setZoomAndPanBaseValue(viewElement-&gt;zoomAndPan());
</del><ins>+    if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr))
+        view.setZoomAndPanBaseValue(viewElement.zoomAndPan());
</ins><span class="cx">     else
</span><del>-        view-&gt;setZoomAndPanBaseValue(zoomAndPan());
</del><ins>+        view.setZoomAndPanBaseValue(zoomAndPan());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGSVGElement::documentWillSuspendForPageCache()
</span><span class="lines">@@ -732,15 +665,18 @@
</span><span class="cx">     Element* element = treeScope().getElementById(id);
</span><span class="cx">     if (element &amp;&amp; element-&gt;isDescendantOf(this))
</span><span class="cx">         return element;
</span><del>-
-    // FIXME: This should use treeScope().getAllElementsById.
-    // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will
-    // be returned.
-    for (auto&amp; element : descendantsOfType&lt;Element&gt;(*this)) {
-        if (element.getIdAttribute() == id)
-            return &amp;element;
</del><ins>+    if (treeScope().containsMultipleElementsWithId(id)) {
+        for (auto element : *treeScope().getAllElementsById(id)) {
+            if (element-&gt;isDescendantOf(this))
+                return element;
+        }
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool SVGSVGElement::isValid() const
+{
+    return SVGTests::isValid();
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSVGElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSVGElement.h        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis &lt;buis@kde.org&gt;
</span><ins>+ * Copyright (C) 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -32,32 +33,27 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class SVGAngle;
-class SVGMatrix;
-class SVGTransform;
</del><span class="cx"> class SVGViewSpec;
</span><del>-class SVGViewElement;
</del><span class="cx"> class SMILTimeContainer;
</span><span class="cx"> 
</span><del>-class SVGSVGElement final : public SVGGraphicsElement,
-                            public SVGExternalResourcesRequired,
-                            public SVGFitToViewBox,
-                            public SVGZoomAndPan {
-public:
-    static Ref&lt;SVGSVGElement&gt; create(const QualifiedName&amp;, Document&amp;);
-    static Ref&lt;SVGSVGElement&gt; create(Document&amp;);
</del><ins>+class SVGSVGElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan {
</ins><span class="cx"> 
</span><del>-    using SVGGraphicsElement::ref;
-    using SVGGraphicsElement::deref;
</del><ins>+    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
+        DECLARE_ANIMATED_LENGTH(X, x)
+        DECLARE_ANIMATED_LENGTH(Y, y)
+        DECLARE_ANIMATED_LENGTH(Width, width)
+        DECLARE_ANIMATED_LENGTH(Height, height)
+        DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
+        DECLARE_ANIMATED_RECT(ViewBox, viewBox)
+        DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
+    END_DECLARE_ANIMATED_PROPERTIES
</ins><span class="cx"> 
</span><del>-    virtual bool isValid() const override { return SVGTests::isValid(); }
-
-    // 'SVGSVGElement' functions
</del><ins>+public: // DOM
</ins><span class="cx">     const AtomicString&amp; contentScriptType() const;
</span><del>-    void setContentScriptType(const AtomicString&amp; type);
</del><ins>+    void setContentScriptType(const AtomicString&amp;);
</ins><span class="cx"> 
</span><span class="cx">     const AtomicString&amp; contentStyleType() const;
</span><del>-    void setContentStyleType(const AtomicString&amp; type);
</del><ins>+    void setContentStyleType(const AtomicString&amp;);
</ins><span class="cx"> 
</span><span class="cx">     FloatRect viewport() const;
</span><span class="cx"> 
</span><span class="lines">@@ -66,42 +62,30 @@
</span><span class="cx">     float screenPixelToMillimeterX() const;
</span><span class="cx">     float screenPixelToMillimeterY() const;
</span><span class="cx"> 
</span><del>-    bool useCurrentView() const { return m_useCurrentView; }
-    SVGViewSpec* currentView();
</del><ins>+    bool useCurrentView() const;
+    SVGViewSpec&amp; currentView();
</ins><span class="cx"> 
</span><del>-    // RenderSVGRoot wants to query the intrinsic size, by only examining the width/height attributes.
-    Length intrinsicWidth() const;
-    Length intrinsicHeight() const;
-    FloatSize currentViewportSize() const;
-    FloatRect currentViewBoxRect() const;
-
</del><span class="cx">     float currentScale() const;
</span><del>-    void setCurrentScale(float scale);
</del><ins>+    void setCurrentScale(float);
</ins><span class="cx"> 
</span><del>-    SVGPoint&amp; currentTranslate() { return m_translation; }
-    void setCurrentTranslate(const FloatPoint&amp;);
</del><ins>+    SVGPoint&amp; currentTranslate();
</ins><span class="cx"> 
</span><del>-    // Only used from the bindings.
-    void updateCurrentTranslate();
</del><ins>+    unsigned suspendRedraw(unsigned maxWaitMilliseconds);
+    void unsuspendRedraw(unsigned suspendHandleId);
+    void unsuspendRedrawAll();
+    void forceRedraw();
</ins><span class="cx"> 
</span><del>-    SMILTimeContainer* timeContainer() { return m_timeContainer.get(); }
-    
</del><span class="cx">     void pauseAnimations();
</span><span class="cx">     void unpauseAnimations();
</span><span class="cx">     bool animationsPaused() const;
</span><span class="cx"> 
</span><span class="cx">     float getCurrentTime() const;
</span><del>-    void setCurrentTime(float seconds);
</del><ins>+    void setCurrentTime(float);
</ins><span class="cx"> 
</span><del>-    unsigned suspendRedraw(unsigned maxWaitMilliseconds);
-    void unsuspendRedraw(unsigned suspendHandleId);
-    void unsuspendRedrawAll();
-    void forceRedraw();
-
-    PassRefPtr&lt;NodeList&gt; getIntersectionList(const FloatRect&amp;, SVGElement* referenceElement) const;
-    PassRefPtr&lt;NodeList&gt; getEnclosureList(const FloatRect&amp;, SVGElement* referenceElement) const;
-    bool checkIntersection(const SVGElement*, const FloatRect&amp;) const;
-    bool checkEnclosure(const SVGElement*, const FloatRect&amp;) const;
</del><ins>+    Ref&lt;NodeList&gt; getIntersectionList(const FloatRect&amp;, SVGElement* referenceElement);
+    Ref&lt;NodeList&gt; getEnclosureList(const FloatRect&amp;, SVGElement* referenceElement);
+    static bool checkIntersection(const SVGElement*, const FloatRect&amp;);
+    static bool checkEnclosure(const SVGElement*, const FloatRect&amp;);
</ins><span class="cx">     void deselectAll();
</span><span class="cx"> 
</span><span class="cx">     static float createSVGNumber();
</span><span class="lines">@@ -113,69 +97,98 @@
</span><span class="cx">     static SVGTransform createSVGTransform();
</span><span class="cx">     static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&amp;);
</span><span class="cx"> 
</span><del>-    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
</del><ins>+    Element* getElementById(const String&amp;);
</ins><span class="cx"> 
</span><del>-    void setupInitialView(const String&amp; fragmentIdentifier, Element* anchorNode);
</del><ins>+    SVGZoomAndPanType zoomAndPan() const;
+    void setZoomAndPan(unsigned short);
</ins><span class="cx"> 
</span><ins>+public:
+    static Ref&lt;SVGSVGElement&gt; create(const QualifiedName&amp;, Document&amp;);
+    static Ref&lt;SVGSVGElement&gt; create(Document&amp;);
+    void scrollToAnchor(const String&amp; fragmentIdentifier, Element* anchor);
+
+    using SVGGraphicsElement::ref;
+    using SVGGraphicsElement::deref;
+
+    SMILTimeContainer&amp; timeContainer();
+
+    void setCurrentTranslate(const FloatPoint&amp;); // Used to pan.
+    void updateCurrentTranslate(); // Used from DOM bindings to create an SVGStaticPropertyTearOff for currentTranslate.
+
</ins><span class="cx">     bool hasIntrinsicWidth() const;
</span><span class="cx">     bool hasIntrinsicHeight() const;
</span><ins>+    Length intrinsicWidth() const;
+    Length intrinsicHeight() const;
</ins><span class="cx"> 
</span><del>-    Element* getElementById(const String&amp;);
</del><ins>+    FloatSize currentViewportSize() const;
+    FloatRect currentViewBoxRect() const;
</ins><span class="cx"> 
</span><del>-    SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
-    void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
</del><ins>+    bool hasEmptyViewBox() const;
+    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
</ins><span class="cx"> 
</span><del>-    bool hasEmptyViewBox() const { return viewBoxIsValid() &amp;&amp; viewBox().isEmpty(); }
-
</del><span class="cx"> private:
</span><span class="cx">     SVGSVGElement(const QualifiedName&amp;, Document&amp;);
</span><span class="cx">     virtual ~SVGSVGElement();
</span><span class="cx"> 
</span><ins>+    virtual bool isValid() const override;
</ins><span class="cx">     virtual void didMoveToNewDocument(Document* oldDocument) override;
</span><del>-
</del><span class="cx">     virtual void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) override;
</span><del>-
</del><span class="cx">     virtual bool rendererIsNeeded(const RenderStyle&amp;) override;
</span><span class="cx">     virtual RenderPtr&lt;RenderElement&gt; createElementRenderer(Ref&lt;RenderStyle&gt;&amp;&amp;) override;
</span><del>-
</del><span class="cx">     virtual InsertionNotificationRequest insertedInto(ContainerNode&amp;) override;
</span><span class="cx">     virtual void removedFrom(ContainerNode&amp;) override;
</span><del>-
</del><span class="cx">     virtual void svgAttributeChanged(const QualifiedName&amp;) override;
</span><del>-
</del><span class="cx">     virtual bool selfHasRelativeLengths() const override;
</span><ins>+    virtual void documentWillSuspendForPageCache() override;
+    virtual void documentDidResumeFromPageCache() override;
+    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
</ins><span class="cx"> 
</span><del>-    void inheritViewAttributes(SVGViewElement*);
</del><ins>+    Frame* frameForCurrentScale() const;
+    void inheritViewAttributes(const SVGViewElement&amp;);
+    Ref&lt;NodeList&gt; collectIntersectionOrEnclosureList(const FloatRect&amp;, SVGElement*, bool (*checkFunction)(const SVGElement*, const FloatRect&amp;));
</ins><span class="cx"> 
</span><del>-    enum CollectIntersectionOrEnclosure {
-        CollectIntersectionList,
-        CollectEnclosureList
-    };
</del><ins>+    bool m_useCurrentView { false };
+    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
+    Ref&lt;SMILTimeContainer&gt; m_timeContainer;
+    SVGPoint m_currentTranslate;
+    RefPtr&lt;SVGViewSpec&gt; m_viewSpec;
+};
</ins><span class="cx"> 
</span><del>-    PassRefPtr&lt;NodeList&gt; collectIntersectionOrEnclosureList(const FloatRect&amp;, SVGElement*, CollectIntersectionOrEnclosure) const;
</del><ins>+inline bool SVGSVGElement::useCurrentView() const
+{
+    return m_useCurrentView;
+}
</ins><span class="cx"> 
</span><del>-    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
-        DECLARE_ANIMATED_LENGTH(X, x)
-        DECLARE_ANIMATED_LENGTH(Y, y)
-        DECLARE_ANIMATED_LENGTH(Width, width)
-        DECLARE_ANIMATED_LENGTH(Height, height)
-        DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
-        DECLARE_ANIMATED_RECT(ViewBox, viewBox)
-        DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
-    END_DECLARE_ANIMATED_PROPERTIES
</del><ins>+inline SVGPoint&amp; SVGSVGElement::currentTranslate()
+{
+    return m_currentTranslate;
+}
</ins><span class="cx"> 
</span><del>-    virtual void documentWillSuspendForPageCache() override;
-    virtual void documentDidResumeFromPageCache() override;
</del><ins>+inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const
+{
+    return m_zoomAndPan;
+}
</ins><span class="cx"> 
</span><del>-    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
</del><ins>+inline void SVGSVGElement::setZoomAndPan(unsigned short zoomAndPan)
+{
+    m_zoomAndPan = parseFromNumber(zoomAndPan);
+}
</ins><span class="cx"> 
</span><del>-    bool m_useCurrentView;
-    SVGZoomAndPanType m_zoomAndPan;
-    RefPtr&lt;SMILTimeContainer&gt; m_timeContainer;
-    SVGPoint m_translation;
-    RefPtr&lt;SVGViewSpec&gt; m_viewSpec;
-};
</del><ins>+inline SMILTimeContainer&amp; SVGSVGElement::timeContainer()
+{
+    return m_timeContainer.get();
+}
</ins><span class="cx"> 
</span><ins>+inline bool SVGSVGElement::hasEmptyViewBox() const
+{
+    return viewBoxIsValid() &amp;&amp; viewBox().isEmpty();
+}
+
+inline float SVGSVGElement::createSVGNumber()
+{
+    return 0;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTransformcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTransform.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTransform.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGTransform.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx"> #include &quot;FloatPoint.h&quot;
</span><span class="cx"> #include &quot;FloatSize.h&quot;
</span><span class="cx"> #include &quot;SVGAngle.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGViewElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGViewElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGViewElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGViewElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -21,12 +21,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;SVGViewElement.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Attribute.h&quot;
-#include &quot;SVGFitToViewBox.h&quot;
</del><span class="cx"> #include &quot;SVGNames.h&quot;
</span><del>-#include &quot;SVGStringList.h&quot;
-#include &quot;SVGZoomAndPan.h&quot;
-#include &lt;wtf/NeverDestroyed.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -56,38 +51,15 @@
</span><span class="cx">     return adoptRef(*new SVGViewElement(tagName, document));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGViewElement::isSupportedAttribute(const QualifiedName&amp; attrName)
-{
-    static NeverDestroyed&lt;HashSet&lt;QualifiedName&gt;&gt; supportedAttributes;
-    if (supportedAttributes.get().isEmpty()) {
-        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
-        SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
-        SVGZoomAndPan::addSupportedAttributes(supportedAttributes);
-        supportedAttributes.get().add(SVGNames::viewTargetAttr);
-    }
-    return supportedAttributes.get().contains&lt;SVGAttributeHashTranslator&gt;(attrName);
-}
-
</del><span class="cx"> void SVGViewElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><del>-    if (!isSupportedAttribute(name)) {
-        SVGElement::parseAttribute(name, value);
-        return;
-    }
-
-    if (name == SVGNames::viewTargetAttr) {
</del><ins>+    if (name == SVGNames::viewTargetAttr)
</ins><span class="cx">         viewTarget().reset(value);
</span><del>-        return;
-    }
</del><span class="cx"> 
</span><del>-    if (SVGExternalResourcesRequired::parseAttribute(name, value))
-        return;
-    if (SVGFitToViewBox::parseAttribute(this, name, value))
-        return;
-    if (SVGZoomAndPan::parseAttribute(this, name, value))
-        return;
-
-    ASSERT_NOT_REACHED();
</del><ins>+    SVGExternalResourcesRequired::parseAttribute(name, value);
+    SVGFitToViewBox::parseAttribute(this, name, value);
+    SVGZoomAndPan::parseAttribute(*this, name, value);
+    SVGElement::parseAttribute(name, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGViewSpeccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGViewSpec.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGViewSpec.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGViewSpec.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx"> #include &quot;SVGFitToViewBox.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> #include &quot;SVGParserUtilities.h&quot;
</span><del>-#include &quot;SVGSVGElement.h&quot;
</del><span class="cx"> #include &quot;SVGTransformable.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -252,7 +251,7 @@
</span><span class="cx">             if (currViewSpec &gt;= end || *currViewSpec != '(')
</span><span class="cx">                 return false;
</span><span class="cx">             currViewSpec++;
</span><del>-            if (!parseZoomAndPan(currViewSpec, end, m_zoomAndPan))
</del><ins>+            if (!parse(currViewSpec, end, m_zoomAndPan))
</ins><span class="cx">                 return false;
</span><span class="cx">             if (currViewSpec &gt;= end || *currViewSpec != ')')
</span><span class="cx">                 return false;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGZoomAndPancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGZoomAndPan.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGZoomAndPan.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGZoomAndPan.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -25,25 +25,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-bool SVGZoomAndPan::isKnownAttribute(const QualifiedName&amp; attrName)
</del><ins>+bool SVGZoomAndPan::parse(const UChar*&amp; start, const UChar* end, SVGZoomAndPanType&amp; zoomAndPan)
</ins><span class="cx"> {
</span><del>-    return attrName == SVGNames::zoomAndPanAttr;
-}
-
-void SVGZoomAndPan::addSupportedAttributes(HashSet&lt;QualifiedName&gt;&amp; supportedAttributes)
-{
-    supportedAttributes.add(SVGNames::zoomAndPanAttr);
-}
-
-static const UChar disable[] =  {'d', 'i', 's', 'a', 'b', 'l', 'e'};
-static const UChar magnify[] =  {'m', 'a', 'g', 'n', 'i', 'f', 'y'};
-
-bool SVGZoomAndPan::parseZoomAndPan(const UChar*&amp; start, const UChar* end, SVGZoomAndPanType&amp; zoomAndPan)
-{
</del><ins>+    static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' };
</ins><span class="cx">     if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) {
</span><span class="cx">         zoomAndPan = SVGZoomAndPanDisable;
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><ins>+    static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' };
</ins><span class="cx">     if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) {
</span><span class="cx">         zoomAndPan = SVGZoomAndPanMagnify;
</span><span class="cx">         return true;
</span><span class="lines">@@ -51,19 +40,13 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NO_RETURN_DUE_TO_ASSERT void SVGZoomAndPan::ref()
</del><ins>+SVGZoomAndPanType SVGZoomAndPan::parseAttributeValue(const AtomicString&amp; value)
</ins><span class="cx"> {
</span><del>-    ASSERT_NOT_REACHED();
</del><ins>+    if (value == &quot;disable&quot;)
+        return SVGZoomAndPanDisable;
+    if (value == &quot;magnify&quot;)
+        return SVGZoomAndPanMagnify;
+    return SVGZoomAndPanUnknown;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-NO_RETURN_DUE_TO_ASSERT void SVGZoomAndPan::deref()
-{
-    ASSERT_NOT_REACHED();
</del><span class="cx"> }
</span><del>-
-NO_RETURN_DUE_TO_ASSERT void SVGZoomAndPan::setZoomAndPan(unsigned short)
-{
-    ASSERT_NOT_REACHED();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGZoomAndPanh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGZoomAndPan.h (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGZoomAndPan.h        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/SVGZoomAndPan.h        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -23,16 +23,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;QualifiedName.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><del>-#include &lt;wtf/HashSet.h&gt;
-#include &lt;wtf/text/StringView.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-enum SVGZoomAndPanType {
-    SVGZoomAndPanUnknown = 0,
-    SVGZoomAndPanDisable,
-    SVGZoomAndPanMagnify
-};
</del><ins>+enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify };
</ins><span class="cx"> 
</span><span class="cx"> class SVGZoomAndPan {
</span><span class="cx"> public:
</span><span class="lines">@@ -44,42 +38,33 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static bool isKnownAttribute(const QualifiedName&amp;);
</span><del>-    static void addSupportedAttributes(HashSet&lt;QualifiedName&gt;&amp;);
</del><span class="cx"> 
</span><del>-    static SVGZoomAndPanType parseFromNumber(unsigned short number)
-    {
-        if (!number || number &gt; SVGZoomAndPanMagnify)
-            return SVGZoomAndPanUnknown;
-        return static_cast&lt;SVGZoomAndPanType&gt;(number);
-    }
</del><ins>+    static SVGZoomAndPanType parseFromNumber(unsigned short);
</ins><span class="cx"> 
</span><del>-    static bool parseZoomAndPan(const UChar*&amp; start, const UChar* end, SVGZoomAndPanType&amp;);
</del><ins>+    static bool parse(const UChar*&amp; start, const UChar* end, SVGZoomAndPanType&amp;);
+    template&lt;class DerivedClass&gt; static void parseAttribute(DerivedClass&amp;, const QualifiedName&amp;, const AtomicString&amp; value);
</ins><span class="cx"> 
</span><del>-    template&lt;class SVGElementTarget&gt;
-    static bool parseAttribute(SVGElementTarget* target, const QualifiedName&amp; name, const AtomicString&amp; value)
-    {
-        ASSERT(target);
-        if (name == SVGNames::zoomAndPanAttr) {
-            auto upconvertedCharacters = StringView(value.string()).upconvertedCharacters();
-            const UChar* start = upconvertedCharacters;
-            const UChar* end = start + value.length();
-            SVGZoomAndPanType zoomAndPan = SVGZoomAndPanUnknown;
-            parseZoomAndPan(start, end, zoomAndPan);
-            target-&gt;setZoomAndPan(zoomAndPan);
-            return true;
-        }
</del><ins>+private:
+    static SVGZoomAndPanType parseAttributeValue(const AtomicString&amp;);
+};
</ins><span class="cx"> 
</span><del>-        return false;
-    }
</del><ins>+inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName&amp; name)
+{
+    return name == SVGNames::zoomAndPanAttr;
+}
</ins><span class="cx"> 
</span><del>-    SVGZoomAndPanType zoomAndPan() const { return SVGZoomAndPanUnknown; }
</del><ins>+inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number)
+{
+    if (number &gt; SVGZoomAndPanMagnify)
+        return SVGZoomAndPanUnknown;
+    return static_cast&lt;SVGZoomAndPanType&gt;(number);
+}
</ins><span class="cx"> 
</span><del>-    // These methods only exist to allow us to compile JSSVGZoomAndPan.*.
-    // These are never called, and thus ASSERT_NOT_REACHED.
-    NO_RETURN_DUE_TO_ASSERT void ref();
-    NO_RETURN_DUE_TO_ASSERT void deref();
-    NO_RETURN_DUE_TO_ASSERT void setZoomAndPan(unsigned short);
-};
</del><ins>+template&lt;class DerivedClass&gt; void SVGZoomAndPan::parseAttribute(DerivedClass&amp; element, const QualifiedName&amp; name, const AtomicString&amp; value)
+{
+    if (name == SVGNames::zoomAndPanAttr)
+        element.setZoomAndPan(parseAttributeValue(value));
+}
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvganimationSVGSMILElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (179981 => 179982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp        2015-02-12 04:37:17 UTC (rev 179981)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp        2015-02-12 05:09:25 UTC (rev 179982)
</span><span class="lines">@@ -248,8 +248,7 @@
</span><span class="cx">     if (!owner)
</span><span class="cx">         return InsertionDone;
</span><span class="cx"> 
</span><del>-    m_timeContainer = owner-&gt;timeContainer();
-    ASSERT(m_timeContainer);
</del><ins>+    m_timeContainer = &amp;owner-&gt;timeContainer();
</ins><span class="cx">     m_timeContainer-&gt;setDocumentOrderIndexesDirty();
</span><span class="cx"> 
</span><span class="cx">     // &quot;If no attribute is present, the default begin value (an offset-value of 0) must be evaluated.&quot;
</span></span></pre>
</div>
</div>

</body>
</html>