Title: [258584] branches/safari-609-branch
Revision
258584
Author
[email protected]
Date
2020-03-17 13:39:25 -0700 (Tue, 17 Mar 2020)

Log Message

Cherry-pick r258459. rdar://problem/60539192

    SVGMatrix should have the access right of its owner SVGTransform always
    https://bugs.webkit.org/show_bug.cgi?id=207462

    Reviewed by Simon Fraser.

    Source/WebCore:

    The SVGMatrix needs to be reattached to its owner SVGTransform when the
    access right of this owner changes. The access right of the owner changes
    when it gets attached to or detached from a higher level owner.

    Test: svg/dom/SVGTransformList-anim-read-only.html

    * svg/SVGTransform.h:
    * svg/properties/SVGProperty.h:
    (WebCore::SVGProperty::attach):
    (WebCore::SVGProperty::detach):
    (WebCore::SVGProperty::reattach):

    LayoutTests:

    * svg/dom/SVGTransformList-anim-read-only-expected.txt: Added.
    * svg/dom/SVGTransformList-anim-read-only.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (258583 => 258584)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-03-17 20:39:21 UTC (rev 258583)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-03-17 20:39:25 UTC (rev 258584)
@@ -1,5 +1,46 @@
 2020-03-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r258459. rdar://problem/60539192
+
+    SVGMatrix should have the access right of its owner SVGTransform always
+    https://bugs.webkit.org/show_bug.cgi?id=207462
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    The SVGMatrix needs to be reattached to its owner SVGTransform when the
+    access right of this owner changes. The access right of the owner changes
+    when it gets attached to or detached from a higher level owner.
+    
+    Test: svg/dom/SVGTransformList-anim-read-only.html
+    
+    * svg/SVGTransform.h:
+    * svg/properties/SVGProperty.h:
+    (WebCore::SVGProperty::attach):
+    (WebCore::SVGProperty::detach):
+    (WebCore::SVGProperty::reattach):
+    
+    LayoutTests:
+    
+    * svg/dom/SVGTransformList-anim-read-only-expected.txt: Added.
+    * svg/dom/SVGTransformList-anim-read-only.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-13  Said Abou-Hallawa  <[email protected]>
+
+            SVGMatrix should have the access right of its owner SVGTransform always
+            https://bugs.webkit.org/show_bug.cgi?id=207462
+
+            Reviewed by Simon Fraser.
+
+            * svg/dom/SVGTransformList-anim-read-only-expected.txt: Added.
+            * svg/dom/SVGTransformList-anim-read-only.html: Added.
+
+2020-03-17  Alan Coon  <[email protected]>
+
         Cherry-pick r258455. rdar://problem/60539179
 
     [Tree building] Block::attachIgnoringContinuation should allow inline tables as before child container

Added: branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only-expected.txt (0 => 258584)


--- branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only-expected.txt	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only-expected.txt	2020-03-17 20:39:25 UTC (rev 258584)
@@ -0,0 +1,28 @@
+This test checks the read-only property of SVGTransformList.animVal
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Check SVGAnimatedTransformList.animVal is a readonly SVGTransformList
+PASS transformAnim.appendItem(t) threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim.clear() threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim.initialize(t) threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim.insertItemBefore(t, 0) threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim.replaceItem(t, 0) threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim.removeItem(0) threw exception NoModificationAllowedError: The object can not be modified..
+PASS transformAnim(0) = t threw exception ReferenceError: Left side of assignment is not a reference..
+
+Check items of SVGAnimatedTransformList.animVal are readonly SVGTransform
+PASS t.setScale(2, 2) threw exception NoModificationAllowedError: The object can not be modified..
+PASS t.setMatrix(m) threw exception NoModificationAllowedError: The object can not be modified..
+PASS m.b = 2 threw exception NoModificationAllowedError: The object can not be modified..
+
+Check detached items from SVGAnimatedTransformList.animVal are not readonly SVGTransform
+PASS t.setScale(2, 2) did not throw exception.
+PASS t.setMatrix(m) did not throw exception.
+PASS m.b = 2 did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only.html (0 => 258584)


--- branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/dom/SVGTransformList-anim-read-only.html	2020-03-17 20:39:25 UTC (rev 258584)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This test checks the read-only property of SVGTransformList.animVal");
+
+var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
+var transformBase = rectElement.transform.baseVal;
+var transformAnim = rectElement.transform.animVal;
+var t = transformBase.createSVGTransformFromMatrix();
+var m = svgElement.createSVGMatrix();
+
+debug("");
+debug("Check SVGAnimatedTransformList.animVal is a readonly SVGTransformList");
+shouldThrow("transformAnim.appendItem(t)");
+shouldThrow("transformAnim.clear()");
+shouldThrow("transformAnim.initialize(t)");
+shouldThrow("transformAnim.insertItemBefore(t, 0)");
+shouldThrow("transformAnim.replaceItem(t, 0)");
+shouldThrow("transformAnim.removeItem(0)");
+shouldThrow("transformAnim(0) = t");
+
+debug("");
+debug("Check items of SVGAnimatedTransformList.animVal are readonly SVGTransform");
+transformBase.appendItem(t);
+t = transformAnim.getItem(0);
+m = svgElement.createSVGMatrix();
+shouldThrow("t.setScale(2, 2)");
+shouldThrow("t.setMatrix(m)");
+m = t.matrix;
+shouldThrow("m.b = 2");
+
+debug("");
+debug("Check detached items from SVGAnimatedTransformList.animVal are not readonly SVGTransform");
+t = transformAnim.getItem(0);
+transformBase.clear();
+m = svgElement.createSVGMatrix();
+shouldNotThrow("t.setScale(2, 2)");
+shouldNotThrow("t.setMatrix(m)");
+m = t.matrix;
+shouldNotThrow("m.b = 2");
+
+successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (258583 => 258584)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-03-17 20:39:21 UTC (rev 258583)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-03-17 20:39:25 UTC (rev 258584)
@@ -1,5 +1,55 @@
 2020-03-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r258459. rdar://problem/60539192
+
+    SVGMatrix should have the access right of its owner SVGTransform always
+    https://bugs.webkit.org/show_bug.cgi?id=207462
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    The SVGMatrix needs to be reattached to its owner SVGTransform when the
+    access right of this owner changes. The access right of the owner changes
+    when it gets attached to or detached from a higher level owner.
+    
+    Test: svg/dom/SVGTransformList-anim-read-only.html
+    
+    * svg/SVGTransform.h:
+    * svg/properties/SVGProperty.h:
+    (WebCore::SVGProperty::attach):
+    (WebCore::SVGProperty::detach):
+    (WebCore::SVGProperty::reattach):
+    
+    LayoutTests:
+    
+    * svg/dom/SVGTransformList-anim-read-only-expected.txt: Added.
+    * svg/dom/SVGTransformList-anim-read-only.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-13  Said Abou-Hallawa  <[email protected]>
+
+            SVGMatrix should have the access right of its owner SVGTransform always
+            https://bugs.webkit.org/show_bug.cgi?id=207462
+
+            Reviewed by Simon Fraser.
+
+            The SVGMatrix needs to be reattached to its owner SVGTransform when the
+            access right of this owner changes. The access right of the owner changes
+            when it gets attached to or detached from a higher level owner.
+
+            Test: svg/dom/SVGTransformList-anim-read-only.html
+
+            * svg/SVGTransform.h:
+            * svg/properties/SVGProperty.h:
+            (WebCore::SVGProperty::attach):
+            (WebCore::SVGProperty::detach):
+            (WebCore::SVGProperty::reattach):
+
+2020-03-17  Alan Coon  <[email protected]>
+
         Cherry-pick r258455. rdar://problem/60539179
 
     [Tree building] Block::attachIgnoringContinuation should allow inline tables as before child container

Modified: branches/safari-609-branch/Source/WebCore/svg/SVGTransform.h (258583 => 258584)


--- branches/safari-609-branch/Source/WebCore/svg/SVGTransform.h	2020-03-17 20:39:21 UTC (rev 258583)
+++ branches/safari-609-branch/Source/WebCore/svg/SVGTransform.h	2020-03-17 20:39:25 UTC (rev 258584)
@@ -144,6 +144,20 @@
         return { };
     }
 
+    void attach(SVGPropertyOwner* owner, SVGPropertyAccess access) override
+    {
+        Base::attach(owner, access);
+        // Reattach the SVGMatrix to the SVGTransformValue with the new SVGPropertyAccess.
+        m_value.matrix()->reattach(this, access);
+    }
+
+    void detach() override
+    {
+        Base::detach();
+        // Reattach the SVGMatrix to the SVGTransformValue with the SVGPropertyAccess::ReadWrite.
+        m_value.matrix()->reattach(this, access());
+    }
+
 private:
     using Base = SVGValueProperty<SVGTransformValue>;
 

Modified: branches/safari-609-branch/Source/WebCore/svg/properties/SVGProperty.h (258583 => 258584)


--- branches/safari-609-branch/Source/WebCore/svg/properties/SVGProperty.h	2020-03-17 20:39:21 UTC (rev 258583)
+++ branches/safari-609-branch/Source/WebCore/svg/properties/SVGProperty.h	2020-03-17 20:39:25 UTC (rev 258584)
@@ -36,7 +36,7 @@
 
     // Managing the relationship with the owner.
     bool isAttached() const { return m_owner; }
-    void attach(SVGPropertyOwner* owner, SVGPropertyAccess access)
+    virtual void attach(SVGPropertyOwner* owner, SVGPropertyAccess access)
     {
         ASSERT(!m_owner);
         ASSERT(m_state == SVGPropertyState::Clean);
@@ -44,7 +44,7 @@
         m_access = access;
     }
 
-    void detach()
+    virtual void detach()
     {
         m_owner = nullptr;
         m_access = SVGPropertyAccess::ReadWrite;
@@ -51,6 +51,13 @@
         m_state = SVGPropertyState::Clean;
     }
 
+    void reattach(SVGPropertyOwner* owner, SVGPropertyAccess access)
+    {
+        ASSERT_UNUSED(owner, owner == m_owner);
+        m_access = access;
+        m_state = SVGPropertyState::Clean;
+    }
+
     const SVGElement* contextElement() const
     {
         if (!m_owner)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to