Support the deprecated dictionary constructor for DOMPointReadOnly and DOMPoint
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Dec 2016 00:04:30 +0000 (00:04 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Dec 2016 00:04:30 +0000 (00:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165732

Reviewed by Sam Weinig.
Source/WebCore:

For compatibility with other browsers, support the DOMPointInit constructor to
DOMPoint and DOMPointReadOnly per <https://www.w3.org/TR/geometry-1/#DOMPoint>

Extended geometry/DOMPoint-001.html to test.

* dom/DOMPoint.h:
* dom/DOMPoint.idl:
* dom/DOMPointReadOnly.h:
(WebCore::DOMPointReadOnly::create):
* dom/DOMPointReadOnly.idl:

LayoutTests:

* geometry/DOMPoint-001-expected.txt:
* geometry/DOMPoint-001.html:

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

LayoutTests/ChangeLog
LayoutTests/geometry/DOMPoint-001-expected.txt
LayoutTests/geometry/DOMPoint-001.html
Source/WebCore/ChangeLog
Source/WebCore/dom/DOMPoint.h
Source/WebCore/dom/DOMPoint.idl
Source/WebCore/dom/DOMPointReadOnly.h
Source/WebCore/dom/DOMPointReadOnly.idl

index 5cba46c..d9eb919 100644 (file)
@@ -1,5 +1,15 @@
 2016-12-10  Simon Fraser  <simon.fraser@apple.com>
 
+        Support the deprecated dictionary constructor for DOMPointReadOnly and DOMPoint
+        https://bugs.webkit.org/show_bug.cgi?id=165732
+
+        Reviewed by Sam Weinig.
+
+        * geometry/DOMPoint-001-expected.txt:
+        * geometry/DOMPoint-001.html:
+
+2016-12-10  Simon Fraser  <simon.fraser@apple.com>
+
         Animation followed by transition doesn't always fire transitionend event
         https://bugs.webkit.org/show_bug.cgi?id=165731
         rdar://problem/28471240
index b7ffb94..d0797ab 100644 (file)
@@ -7,6 +7,10 @@ PASS testConstructor2
 PASS testConstructor3 
 PASS testConstructor4 
 PASS testConstructor5 
+PASS testDictionaryConstructor1 
+PASS testDictionaryConstructor2 
+PASS testDictionaryConstructor3 
+PASS testDictionaryConstructor4 
 PASS testConstructorDOMPointInit0 
 PASS testConstructorDOMPointInit1 
 PASS testConstructorDOMPointInit2 
index ca1a979..6f830ae 100644 (file)
         test(function() {
             checkDOMPoint(new DOMPoint(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
         },'testConstructor5');
+
+        // Dictionary constructors are in http://www.w3.org/TR/geometry-1 but not http://dev.w3.org/fxtf/geometry.
+        test(function() {
+            checkDOMPoint(new DOMPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
+        },'testDictionaryConstructor1');
+        test(function() {
+            checkDOMPoint(new DOMPoint({}), {x:0, y:0, z:0, w:1});
+        },'testDictionaryConstructor2');
+        test(function() {
+            checkDOMPoint(new DOMPoint({x:1}), {x:1, y:0, z:0, w:1});
+        },'testDictionaryConstructor3');
+        test(function() {
+            checkDOMPoint(new DOMPoint({y:3, w:0.5}), {x:0, y:3, z:0, w:0.5});
+        },'testDictionaryConstructor4');
+
         test(function() {
             checkDOMPoint(DOMPoint.fromPoint({}), {x:0, y:0, z:0, w:1});
         },'testConstructorDOMPointInit0');
index da8ad6e..6a92eeb 100644 (file)
@@ -1,3 +1,21 @@
+2016-12-10  Simon Fraser  <simon.fraser@apple.com>
+
+        Support the deprecated dictionary constructor for DOMPointReadOnly and DOMPoint
+        https://bugs.webkit.org/show_bug.cgi?id=165732
+
+        Reviewed by Sam Weinig.
+        
+        For compatibility with other browsers, support the DOMPointInit constructor to
+        DOMPoint and DOMPointReadOnly per <https://www.w3.org/TR/geometry-1/#DOMPoint>
+
+        Extended geometry/DOMPoint-001.html to test.
+
+        * dom/DOMPoint.h:
+        * dom/DOMPoint.idl:
+        * dom/DOMPointReadOnly.h:
+        (WebCore::DOMPointReadOnly::create):
+        * dom/DOMPointReadOnly.idl:
+
 2016-12-10  Dave Hyatt  <hyatt@apple.com>
 
         [CSS Parser] Make sure content extensions initialize AtomicString
index 5b4a7f9..b7cadb9 100644 (file)
@@ -38,6 +38,7 @@ class DOMPoint final : public DOMPointReadOnly {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     static Ref<DOMPoint> create(double x, double y, double z, double w) { return adoptRef(*new DOMPoint(x, y, z, w)); }
+    static Ref<DOMPoint> create(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
     static Ref<DOMPoint> fromPoint(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
 
     void setX(double x) { m_x = x; }
index 7ecd37e..7ae41ac 100644 (file)
@@ -28,7 +28,9 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// The DOMPointInit constructor exists in https://www.w3.org/TR/geometry-1/ but is removed in https://drafts.fxtf.org/geometry/
 [
+    Constructor(DOMPointInit point),
     Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
         optional unrestricted double z = 0, optional unrestricted double w = 1),
     Exposed=(Window,Worker),
index e52c74d..1b98302 100644 (file)
@@ -40,6 +40,7 @@ class DOMPointReadOnly : public ScriptWrappable, public RefCounted<DOMPointReadO
     WTF_MAKE_FAST_ALLOCATED;
 public:
     static Ref<DOMPointReadOnly> create(double x, double y, double z, double w) { return adoptRef(*new DOMPointReadOnly(x, y, z, w)); }
+    static Ref<DOMPointReadOnly> create(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
     static Ref<DOMPointReadOnly> fromPoint(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
 
     double x() const { return m_x; }
index 910829f..9a00b9f 100644 (file)
@@ -28,7 +28,9 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// The DOMPointInit constructor exists in https://www.w3.org/TR/geometry-1/ but is removed in https://drafts.fxtf.org/geometry/
 [
+    Constructor(DOMPointInit point),
     Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
         optional unrestricted double z = 0, optional unrestricted double w = 1),
     Exposed=(Window,Worker),