<!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>[180129] trunk</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/180129">180129</a></dd>
<dt>Author</dt> <dd>said@apple.com</dd>
<dt>Date</dt> <dd>2015-02-15 18:08:39 -0800 (Sun, 15 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Crash when accessing an item in SVGTransformList and then removing a previous item from this list.
https://bugs.webkit.org/show_bug.cgi?id=141550.
Reviewed by Darin Adler.
Source/WebCore:
Tests: LayoutTests/svg/dom/SVGTransformList-basics.xhtml: This test is modified to
include a new test case.
* svg/properties/SVGMatrixTearOff.h: m_value of SVGMatrixTearOff will be a null
pointer. There is no point in having SVGMatrixTearOff points to the parent and
the property of the parent at the same time.
(WebCore::SVGMatrixTearOff::create): SVGMatrixTearOff will hold a pointer to
the parent SVGPropertyTearOff<SVGTransform>. But it should overrides setValue()
and propertyReference() so it can set and get the SVGMatrix from the SVGTransform
parent.
(WebCore::SVGMatrixTearOff::SVGMatrixTearOff): Pass a nullptr to the base class.
SVGMatrixTearOff will act as a proxy of the parent. It does not hold any data by
itself but it knows what property to set and get from the parent.
* svg/properties/SVGPropertyTearOff.h:
(WebCore::SVGPropertyTearOff::create): Add a create method which can take a pointer value.
(WebCore::SVGPropertyTearOff::propertyReference):
(WebCore::SVGPropertyTearOff::setValue): Make these functions virtual so concrete classes
like SVGMatrixTearOff can override them.
(WebCore::SVGPropertyTearOff::SVGPropertyTearOff): Add a new constructor.
LayoutTests:
* svg/dom/SVGTransformList-basics-expected.txt:
* svg/dom/SVGTransformList-basics.xhtml: Add a new test case to this test. Have a
reference to an SVGMatrix of the last SVGTransform of an SVGTransformList and then
remove the items of this list from the beginning till the end.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTransformListbasicsexpectedtxt">trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTransformListbasicsxhtml">trunk/LayoutTests/svg/dom/SVGTransformList-basics.xhtml</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGMatrixTearOffh">trunk/Source/WebCore/svg/properties/SVGMatrixTearOff.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGPropertyTearOffh">trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/LayoutTests/ChangeLog        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2015-02-15 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><ins>+ Crash when accessing an item in SVGTransformList and then removing a previous item from this list.
+ https://bugs.webkit.org/show_bug.cgi?id=141550.
+
+ Reviewed by Darin Adler.
+
+ * svg/dom/SVGTransformList-basics-expected.txt:
+ * svg/dom/SVGTransformList-basics.xhtml: Add a new test case to this test. Have a
+ reference to an SVGMatrix of the last SVGTransform of an SVGTransformList and then
+ remove the items of this list from the beginning till the end.
+
+2015-02-15 Said Abou-Hallawa <sabouhallawa@apple.com>
+
</ins><span class="cx"> Crash when accessing an item in SVGLengthList and then replacing it with a previous item in the list.
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=141552.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTransformListbasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -51,6 +51,13 @@
</span><span class="cx"> PASS circle1.transform.baseVal.insertItemBefore(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception Error: SVG_WRONG_TYPE_ERR: DOM SVG Exception 0.
</span><span class="cx">
</span><ins>+Test overlapping edge cases for removeItem()
+PASS circle1.setAttribute('transform', 'scale(2 2) translate(10 10)') is undefined.
+PASS dumpTransform(circle1.transform.baseVal.getItem(1)) is "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 20.0 20.0]"
+PASS dumpTransform(circle1.transform.baseVal.getItem(1)) is "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 20.0 20.0]"
+PASS dumpTransform(circle1.transform.baseVal.getItem(1)) is "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 40.0 40.0]"
+PASS circle1.transform.baseVal.numberOfItems is 0
+
</ins><span class="cx"> Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for circle1
</span><span class="cx"> PASS circle1.setAttribute('transform', 'rotate(90) scale(2 2) translate(10 10) skewX(45)') is undefined.
</span><span class="cx"> PASS circle1.transform.baseVal.numberOfItems is 4
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTransformListbasicsxhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGTransformList-basics.xhtml (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTransformList-basics.xhtml        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/LayoutTests/svg/dom/SVGTransformList-basics.xhtml        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -103,6 +103,21 @@
</span><span class="cx"> shouldThrow("circle1.transform.baseVal.insertItemBefore(null, 0)");
</span><span class="cx">
</span><span class="cx"> debug("");
</span><ins>+ debug("Test overlapping edge cases for removeItem()");
+ shouldBeUndefined("circle1.setAttribute('transform', 'scale(2 2) translate(10 10)')");
+ var matrix = circle1.transform.baseVal.getItem(1).matrix;
+ matrix.e *= 2;
+ matrix.f *= 2;
+ shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))", "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 20.0 20.0]");
+ matrix = matrix.translate(20, 20);
+ shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))", "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 20.0 20.0]");
+ circle1.transform.baseVal.getItem(1).setMatrix(matrix);
+ shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))", "type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 40.0 40.0]");
+ circle1.transform.baseVal.removeItem(0);
+ circle1.transform.baseVal.removeItem(0);
+ shouldBe("circle1.transform.baseVal.numberOfItems", "0");
+
+ debug("");
</ins><span class="cx"> debug("Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for circle1");
</span><span class="cx"> shouldBeUndefined("circle1.setAttribute('transform', 'rotate(90) scale(2 2) translate(10 10) skewX(45)')");
</span><span class="cx"> shouldBe("circle1.transform.baseVal.numberOfItems", "4");
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/Source/WebCore/ChangeLog        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2015-02-15 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><ins>+ Crash when accessing an item in SVGTransformList and then removing a previous item from this list.
+ https://bugs.webkit.org/show_bug.cgi?id=141550.
+
+ Reviewed by Darin Adler.
+
+ Tests: LayoutTests/svg/dom/SVGTransformList-basics.xhtml: This test is modified to
+ include a new test case.
+
+ * svg/properties/SVGMatrixTearOff.h: m_value of SVGMatrixTearOff will be a null
+ pointer. There is no point in having SVGMatrixTearOff points to the parent and
+ the property of the parent at the same time.
+
+ (WebCore::SVGMatrixTearOff::create): SVGMatrixTearOff will hold a pointer to
+ the parent SVGPropertyTearOff<SVGTransform>. But it should overrides setValue()
+ and propertyReference() so it can set and get the SVGMatrix from the SVGTransform
+ parent.
+
+ (WebCore::SVGMatrixTearOff::SVGMatrixTearOff): Pass a nullptr to the base class.
+ SVGMatrixTearOff will act as a proxy of the parent. It does not hold any data by
+ itself but it knows what property to set and get from the parent.
+
+ * svg/properties/SVGPropertyTearOff.h:
+ (WebCore::SVGPropertyTearOff::create): Add a create method which can take a pointer value.
+
+ (WebCore::SVGPropertyTearOff::propertyReference):
+ (WebCore::SVGPropertyTearOff::setValue): Make these functions virtual so concrete classes
+ like SVGMatrixTearOff can override them.
+
+ (WebCore::SVGPropertyTearOff::SVGPropertyTearOff): Add a new constructor.
+
+2015-02-15 Said Abou-Hallawa <sabouhallawa@apple.com>
+
</ins><span class="cx"> Crash when accessing an item in SVGLengthList and then replacing it with a previous item in the list.
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=141552.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGMatrixTearOffh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGMatrixTearOff.h (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGMatrixTearOff.h        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/Source/WebCore/svg/properties/SVGMatrixTearOff.h        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -30,13 +30,18 @@
</span><span class="cx"> // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
</span><span class="cx"> // and that contain a parent type that's exposed to the bindings via a SVGStaticPropertyTearOff object
</span><span class="cx"> // (for example: SVGTransform::matrix).
</span><del>- static PassRefPtr<SVGMatrixTearOff> create(SVGPropertyTearOff<SVGTransform>& parent, SVGMatrix& value)
</del><ins>+ static Ref<SVGMatrixTearOff> create(SVGPropertyTearOff<SVGTransform>& parent, SVGMatrix& value)
</ins><span class="cx"> {
</span><del>- RefPtr<SVGMatrixTearOff> result = adoptRef(new SVGMatrixTearOff(&parent, value));
</del><ins>+ ASSERT(&parent.propertyReference().svgMatrix() == &value);
+ Ref<SVGMatrixTearOff> result = adoptRef(*new SVGMatrixTearOff(&parent));
</ins><span class="cx"> parent.addChild(result->m_weakFactory.createWeakPtr());
</span><del>- return result.release();
</del><ins>+ return result;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ virtual SVGMatrix& propertyReference() override { return m_parent->propertyReference().svgMatrix(); }
+
+ virtual void setValue(SVGMatrix& value) override { m_parent->propertyReference().setMatrix(value); }
+
</ins><span class="cx"> virtual void commitChange()
</span><span class="cx"> {
</span><span class="cx"> m_parent->propertyReference().updateSVGMatrix();
</span><span class="lines">@@ -44,8 +49,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- SVGMatrixTearOff(SVGPropertyTearOff<SVGTransform>* parent, SVGMatrix& value)
- : SVGPropertyTearOff<SVGMatrix>(0, UndefinedRole, value)
</del><ins>+ SVGMatrixTearOff(SVGPropertyTearOff<SVGTransform>* parent)
+ : SVGPropertyTearOff<SVGMatrix>(nullptr)
</ins><span class="cx"> , m_parent(parent)
</span><span class="cx"> , m_weakFactory(this)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h (180128 => 180129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h        2015-02-16 00:13:16 UTC (rev 180128)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h        2015-02-16 02:08:39 UTC (rev 180129)
</span><span class="lines">@@ -39,22 +39,27 @@
</span><span class="cx">
</span><span class="cx"> // Used for child types (baseVal/animVal) of a SVGAnimated* property (for example: SVGAnimatedLength::baseVal()).
</span><span class="cx"> // Also used for list tear offs (for example: text.x.baseVal.getItem(0)).
</span><del>- static PassRefPtr<Self> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& value)
</del><ins>+ static Ref<Self> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& value)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(animatedProperty);
</span><del>- return adoptRef(new Self(animatedProperty, role, value));
</del><ins>+ return adoptRef(*new Self(animatedProperty, role, value));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Used for non-animated POD types (for example: SVGSVGElement::createSVGLength()).
</span><del>- static PassRefPtr<Self> create(const PropertyType& initialValue)
</del><ins>+ static Ref<Self> create(const PropertyType& initialValue)
</ins><span class="cx"> {
</span><del>- return adoptRef(new Self(initialValue));
</del><ins>+ return adoptRef(*new Self(initialValue));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- PropertyType& propertyReference() { return *m_value; }
</del><ins>+ static Ref<Self> create(const PropertyType* initialValue)
+ {
+ return adoptRef(*new Self(initialValue));
+ }
+
+ virtual PropertyType& propertyReference() { return *m_value; }
</ins><span class="cx"> SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty; }
</span><span class="cx">
</span><del>- void setValue(PropertyType& value)
</del><ins>+ virtual void setValue(PropertyType& value)
</ins><span class="cx"> {
</span><span class="cx"> if (m_valueIsCopy) {
</span><span class="cx"> detachChildren();
</span><span class="lines">@@ -134,9 +139,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> SVGPropertyTearOff(const PropertyType& initialValue)
</span><ins>+ : SVGPropertyTearOff(&initialValue)
+ {
+ }
+
+ SVGPropertyTearOff(const PropertyType* initialValue)
</ins><span class="cx"> : m_animatedProperty(0)
</span><span class="cx"> , m_role(UndefinedRole)
</span><del>- , m_value(new PropertyType(initialValue))
</del><ins>+ , m_value(initialValue ? new PropertyType(*initialValue) : nullptr)
</ins><span class="cx"> , m_valueIsCopy(true)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>