Implement DOMPoint/DOMPointReadOnly
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2016 19:06:25 +0000 (19:06 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2016 19:06:25 +0000 (19:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133916

Reviewed by Darin Adler.
Source/WebCore:

Patch mostly by Dirk Schultz <krit@webkit.org>.

Implement DOMPoint/DOMPointReadOnly following https://drafts.fxtf.org/geometry/
(although we may need to match https://www.w3.org/TR/geometry-1/ to be compatible
with Chrome).

Test: geometry/DOMPoint-001.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMPoint.h: Added.
* dom/DOMPoint.idl: Added.
* dom/DOMPointInit.h: Added.
* dom/DOMPointInit.idl: Added.
* dom/DOMPointReadOnly.h: Added.
(WebCore::DOMPointReadOnly::create):
(WebCore::DOMPointReadOnly::fromPoint):
(WebCore::DOMPointReadOnly::x):
(WebCore::DOMPointReadOnly::y):
(WebCore::DOMPointReadOnly::z):
(WebCore::DOMPointReadOnly::w):
(WebCore::DOMPointReadOnly::DOMPointReadOnly):
* dom/DOMPointReadOnly.idl: Added.

LayoutTests:

New Web Platform-style test, and rebaselines.

* geometry/DOMPoint-001-expected.txt: Added.
* geometry/DOMPoint-001.html: Added.
* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
* js/dom/global-constructors-attributes-expected.txt:
* platform/efl/js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/geometry/DOMPoint-001-expected.txt [new file with mode: 0644]
LayoutTests/geometry/DOMPoint-001.html [new file with mode: 0644]
LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMPoint.h [new file with mode: 0644]
Source/WebCore/dom/DOMPoint.idl [new file with mode: 0644]
Source/WebCore/dom/DOMPointInit.h [new file with mode: 0644]
Source/WebCore/dom/DOMPointInit.idl [new file with mode: 0644]
Source/WebCore/dom/DOMPointReadOnly.h [new file with mode: 0644]
Source/WebCore/dom/DOMPointReadOnly.idl [new file with mode: 0644]

index 5bd050c..ac9da52 100644 (file)
@@ -1,3 +1,23 @@
+2016-10-17  Simon Fraser  <simon.fraser@apple.com>
+
+        Implement DOMPoint/DOMPointReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=133916
+
+        Reviewed by Darin Adler.
+        
+        New Web Platform-style test, and rebaselines.
+
+        * geometry/DOMPoint-001-expected.txt: Added.
+        * geometry/DOMPoint-001.html: Added.
+        * js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
+        * js/dom/global-constructors-attributes-expected.txt:
+        * platform/efl/js/dom/global-constructors-attributes-expected.txt:
+        * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac/js/dom/global-constructors-attributes-expected.txt:
+        * platform/win/js/dom/global-constructors-attributes-expected.txt:
+
 2016-10-17  Ryan Haddad  <ryanhaddad@apple.com>
 
         Rebaseline mathml/mathml-in-dashboard.html for mac.
diff --git a/LayoutTests/geometry/DOMPoint-001-expected.txt b/LayoutTests/geometry/DOMPoint-001-expected.txt
new file mode 100644 (file)
index 0000000..b7ffb94
--- /dev/null
@@ -0,0 +1,29 @@
+Test DOMPoint and DOMPointReadOnly interfaces
+
+
+PASS testConstructor0 
+PASS testConstructor1 
+PASS testConstructor2 
+PASS testConstructor3 
+PASS testConstructor4 
+PASS testConstructor5 
+PASS testConstructorDOMPointInit0 
+PASS testConstructorDOMPointInit1 
+PASS testConstructorDOMPointInit2 
+PASS testConstructorDOMPointInit3 
+PASS testConstructorDOMPointInit4 
+PASS testConstructorDOMPointInit5 
+PASS testConstructorDOMPointInit2irregular 
+PASS testConstructorDOMPointInit2undefined 
+PASS testReadonlyConstructor1 
+PASS testConstructor2NaN 
+PASS testConstructor2Infinity 
+PASS testFromPointReturnType 
+PASS testFromPointReadOnlyReturnType 
+PASS testReadonlyAttributes 
+PASS testAttributes 
+PASS testAttributesUndefined 
+PASS testAttributesNaNInfinity 
+PASS testSerializer 
+PASS testReadonlySerializer 
+
diff --git a/LayoutTests/geometry/DOMPoint-001.html b/LayoutTests/geometry/DOMPoint-001.html
new file mode 100644 (file)
index 0000000..ca1a979
--- /dev/null
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests.</title>
+    <link rel="author" title="Dirk Schulze" href="mailto:dschulze@adobe.com" />
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#DOMPoint">
+    <link rel="help" href="http://dev.w3.org/fxtf/geometry/#dictdef-dompointinit">
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dompoint-dompoint">
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-x">
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-y">
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-z">
+    <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-w">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+</head>
+<body>
+    <p>Test DOMPoint and DOMPointReadOnly interfaces</p>
+    <div id="log"></div>
+    <script>
+        test(function() {
+            checkDOMPoint(new DOMPoint(), {x:0, y:0, z:0, w:1});
+        },'testConstructor0');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1), {x:1, y:0, z:0, w:1})
+        },'testConstructor1');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, 2), {x:1, y:2, z:0, w:1});
+        },'testConstructor2');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, 2, 3), {x:1, y:2, z:3, w:1});
+        },'testConstructor3');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
+        },'testConstructor4');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
+        },'testConstructor5');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({}), {x:0, y:0, z:0, w:1});
+        },'testConstructorDOMPointInit0');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1}), {x:1, y:0, z:0, w:1});
+        },'testConstructorDOMPointInit1');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, y:2}), {x:1, y:2, z:0, w:1});
+        },'testConstructorDOMPointInit2');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3}), {x:1, y:2, z:3, w:1});
+        },'testConstructorDOMPointInit3');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
+        },'testConstructorDOMPointInit4');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4, v:5}), {x:1, y:2, z:3, w:4});
+        },'testConstructorDOMPointInit5');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, z:3}), {x:1, y:0, z:3, w:1});
+        },'testConstructorDOMPointInit2irregular');
+        test(function() {
+            checkDOMPoint(DOMPoint.fromPoint({x:1, y: undefined, z:3}), {x:1, y:0, z:3, w:1});
+        },'testConstructorDOMPointInit2undefined');
+        test(function() {
+            checkDOMPoint(new DOMPointReadOnly(), {x:0, y:0, z:0, w:1});
+        },'testReadonlyConstructor1');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, NaN), {x:1, y:NaN, z:0, w:1});
+        },'testConstructor2NaN');
+        test(function() {
+            checkDOMPoint(new DOMPoint(1, Number.POSITIVE_INFINITY), {x:1, y:Infinity, z:0, w:1});
+        },'testConstructor2Infinity');
+        test(function() {
+            var p = DOMPoint.fromPoint({});
+            assert_true(p instanceof DOMPoint);
+        },'testFromPointReturnType');
+        test(function() {
+            var p = DOMPointReadOnly.fromPoint({});
+            assert_true(p instanceof DOMPointReadOnly);
+        },'testFromPointReadOnlyReturnType');
+        test(function() {
+            var p = new DOMPointReadOnly();
+            p.x = 1;
+            p.y = Math.PI;
+            p.z = 3.2;
+            p.w = 4;
+            checkDOMPoint(p, {x:0, y:0, z:0, w:1});
+        },'testReadonlyAttributes');
+        test(function() {
+            var p = new DOMPoint();
+            p.x = 1;
+            p.y = Math.PI;
+            p.z = 3.2;
+            p.w = 4;
+            checkDOMPoint(p, {x:1, y:Math.PI, z:3.2, w:4});
+        },'testAttributes');
+        test(function() {
+            var p = new DOMPoint(0, 0, 0, 1);
+            p.x = undefined;
+            p.y = undefined;
+            p.z = undefined;
+            p.w = undefined;
+            checkDOMPoint(p, {x:NaN, y:NaN, z:NaN, w:NaN});
+        },'testAttributesUndefined');
+        test(function() {
+            var p = new DOMPoint(0, 0, 0, 1);
+            p.x = NaN;
+            p.y = Number.POSITIVE_INFINITY;
+            p.z = Number.NEGATIVE_INFINITY;
+            p.w = Infinity;
+            checkDOMPoint(p, {x:NaN, y:Infinity, z:-Infinity, w:Infinity});
+        },'testAttributesNaNInfinity');
+        test(function() {
+            var p = DOMPoint.fromPoint({x:1, y:3.1415927, z:3.2, w:4});
+            assert_equals(JSON.stringify(p.toJSON()), "{\"x\":1,\"y\":3.1415927,\"z\":3.2,\"w\":4}");
+        },'testSerializer');
+        test(function() {
+            var p = DOMPointReadOnly.fromPoint({x:1, y:3.1415927, z:3.2, w:4});
+            assert_equals(JSON.stringify(p.toJSON()), "{\"x\":1,\"y\":3.1415927,\"z\":3.2,\"w\":4}");
+        },'testReadonlySerializer');
+
+        function checkDOMPoint(p, exp) {
+            assert_equals(p.x, exp.x, "Expected value for x is " + exp.x);
+            assert_equals(p.y, exp.y, "Expected value for y is " + exp.y);
+            assert_equals(p.z, exp.z, "Expected value for z is " + exp.z);
+            assert_equals(p.w, exp.w, "Expected value for w is " + exp.w);
+        }
+    </script>
+</body>
+</html>
index 70ae473..2f40db7 100644 (file)
@@ -49,6 +49,16 @@ PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMException').hasOwnProp
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMException').hasOwnProperty('set') is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMException').enumerable is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMException').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DataView').value is DataView
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('get') is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DataView').hasOwnProperty('set') is false
index d897884..c134a02 100644 (file)
@@ -288,6 +288,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index 47918c7..badf7da 100644 (file)
@@ -288,6 +288,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index df22bc0..ccceb02 100644 (file)
@@ -323,6 +323,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index d19b5a4..8f03265 100644 (file)
@@ -333,6 +333,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index 415ef41..31d372a 100644 (file)
@@ -333,6 +333,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index 0a5ccff..14f707b 100644 (file)
@@ -333,6 +333,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index 32e71b5..04c0bcd 100644 (file)
@@ -228,6 +228,16 @@ PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('get')
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMParser').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').value is DOMPoint
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPoint').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').value is DOMPointReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMPointReadOnly').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').value is DOMStringList
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'DOMStringList').hasOwnProperty('set') is false
index 83aaf56..fa97f54 100644 (file)
@@ -386,6 +386,9 @@ set(WebCore_NON_SVG_IDL_FILES
     dom/DOMError.idl
     dom/DOMImplementation.idl
     dom/DOMNamedFlowCollection.idl
+    dom/DOMPoint.idl
+    dom/DOMPointInit.idl
+    dom/DOMPointReadOnly.idl
     dom/DOMStringList.idl
     dom/DOMStringMap.idl
     dom/DataTransfer.idl
index b1bf264..1839dd4 100644 (file)
@@ -1,3 +1,35 @@
+2016-10-17  Simon Fraser  <simon.fraser@apple.com>
+
+        Implement DOMPoint/DOMPointReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=133916
+
+        Reviewed by Darin Adler.
+
+        Patch mostly by Dirk Schultz <krit@webkit.org>.
+
+        Implement DOMPoint/DOMPointReadOnly following https://drafts.fxtf.org/geometry/
+        (although we may need to match https://www.w3.org/TR/geometry-1/ to be compatible
+        with Chrome).
+        
+        Test: geometry/DOMPoint-001.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMPoint.h: Added.
+        * dom/DOMPoint.idl: Added.
+        * dom/DOMPointInit.h: Added.
+        * dom/DOMPointInit.idl: Added.
+        * dom/DOMPointReadOnly.h: Added.
+        (WebCore::DOMPointReadOnly::create):
+        (WebCore::DOMPointReadOnly::fromPoint):
+        (WebCore::DOMPointReadOnly::x):
+        (WebCore::DOMPointReadOnly::y):
+        (WebCore::DOMPointReadOnly::z):
+        (WebCore::DOMPointReadOnly::w):
+        (WebCore::DOMPointReadOnly::DOMPointReadOnly):
+        * dom/DOMPointReadOnly.idl: Added.
+
 2016-10-17  Antoine Quint  <graouts@apple.com>
 
         [Modern Media Controls] Use modern-media-controls module sources for media controls stylesheet and script injection
index 0ffa728..86be295 100644 (file)
@@ -294,6 +294,9 @@ JS_BINDING_IDLS = \
     $(WebCore)/dom/DOMError.idl \
     $(WebCore)/dom/DOMImplementation.idl \
     $(WebCore)/dom/DOMNamedFlowCollection.idl \
+    $(WebCore)/dom/DOMPoint.idl \
+    $(WebCore)/dom/DOMPointInit.idl \
+    $(WebCore)/dom/DOMPointReadOnly.idl \
     $(WebCore)/dom/DOMStringList.idl \
     $(WebCore)/dom/DOMStringMap.idl \
     $(WebCore)/dom/DataTransfer.idl \
index 4a4ea7d..8c81b50 100644 (file)
                0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */; };
                0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F43C85C189E10CF00019AE2 /* PerformanceTiming.cpp */; };
                0F43C85F189E15A600019AE2 /* JSPerformanceTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F43C85E189E15A600019AE2 /* JSPerformanceTiming.cpp */; };
+               0F49669D1DB408C100A274BB /* DOMPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966991DB408C100A274BB /* DOMPoint.h */; };
+               0F49669F1DB408C100A274BB /* DOMPointReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */; };
+               0F4966A31DB4091000A274BB /* DOMPointInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A21DB4091000A274BB /* DOMPointInit.h */; };
+               0F4966AA1DB40C4300A274BB /* JSDOMPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4966A41DB40C4300A274BB /* JSDOMPoint.cpp */; };
+               0F4966AB1DB40C4300A274BB /* JSDOMPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A51DB40C4300A274BB /* JSDOMPoint.h */; };
+               0F4966AC1DB40C4300A274BB /* JSDOMPointInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4966A61DB40C4300A274BB /* JSDOMPointInit.cpp */; };
+               0F4966AD1DB40C4300A274BB /* JSDOMPointInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */; };
+               0F4966AE1DB40C4300A274BB /* JSDOMPointReadOnly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */; };
+               0F4966AF1DB40C4300A274BB /* JSDOMPointReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */; };
                0F4E57171313276200CF85AF /* RenderSVGAllInOne.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4E57161313276200CF85AF /* RenderSVGAllInOne.cpp */; };
                0F54DCE51881051D003EEDBB /* TextAutoSizing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F54DCE31881051D003EEDBB /* TextAutoSizing.cpp */; };
                0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCE41881051D003EEDBB /* TextAutoSizing.h */; };
                0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderGeometryMap.h; sourceTree = "<group>"; };
                0F43C85C189E10CF00019AE2 /* PerformanceTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceTiming.cpp; sourceTree = "<group>"; };
                0F43C85E189E15A600019AE2 /* JSPerformanceTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceTiming.cpp; sourceTree = "<group>"; };
+               0F4966991DB408C100A274BB /* DOMPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPoint.h; sourceTree = "<group>"; };
+               0F49669A1DB408C100A274BB /* DOMPoint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMPoint.idl; sourceTree = "<group>"; };
+               0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPointReadOnly.h; sourceTree = "<group>"; };
+               0F49669C1DB408C100A274BB /* DOMPointReadOnly.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMPointReadOnly.idl; sourceTree = "<group>"; };
+               0F4966A11DB4090100A274BB /* DOMPointInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMPointInit.idl; sourceTree = "<group>"; };
+               0F4966A21DB4091000A274BB /* DOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPointInit.h; sourceTree = "<group>"; };
+               0F4966A41DB40C4300A274BB /* JSDOMPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPoint.cpp; path = JSDOMPoint.cpp; sourceTree = "<group>"; };
+               0F4966A51DB40C4300A274BB /* JSDOMPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPoint.h; path = JSDOMPoint.h; sourceTree = "<group>"; };
+               0F4966A61DB40C4300A274BB /* JSDOMPointInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPointInit.cpp; path = JSDOMPointInit.cpp; sourceTree = "<group>"; };
+               0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPointInit.h; path = JSDOMPointInit.h; sourceTree = "<group>"; };
+               0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMPointReadOnly.cpp; path = JSDOMPointReadOnly.cpp; sourceTree = "<group>"; };
+               0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMPointReadOnly.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; };
                0F4E57161313276200CF85AF /* RenderSVGAllInOne.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGAllInOne.cpp; sourceTree = "<group>"; };
                0F54DCCC1880C6AB003EEDBB /* ios-encodings.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ios-encodings.txt"; sourceTree = "<group>"; };
                0F54DCE31881051D003EEDBB /* TextAutoSizing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextAutoSizing.cpp; sourceTree = "<group>"; };
                                65DF31E409D1CC60000BE325 /* JSDOMImplementation.h */,
                                52CCA9E015E3F62C0053C77F /* JSDOMNamedFlowCollection.cpp */,
                                52CCA9E115E3F62C0053C77F /* JSDOMNamedFlowCollection.h */,
+                               0F4966A41DB40C4300A274BB /* JSDOMPoint.cpp */,
+                               0F4966A51DB40C4300A274BB /* JSDOMPoint.h */,
+                               0F4966A61DB40C4300A274BB /* JSDOMPointInit.cpp */,
+                               0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */,
+                               0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */,
+                               0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */,
                                C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */,
                                C5137CF111A58378004ADB99 /* JSDOMStringList.h */,
                                BC64649511D82349006455B0 /* JSDOMStringMap.cpp */,
                                52B6C9BD15E3F4DF00690B05 /* DOMNamedFlowCollection.cpp */,
                                52B6C9BE15E3F4DF00690B05 /* DOMNamedFlowCollection.h */,
                                52B6C9BF15E3F4DF00690B05 /* DOMNamedFlowCollection.idl */,
+                               0F4966991DB408C100A274BB /* DOMPoint.h */,
+                               0F49669A1DB408C100A274BB /* DOMPoint.idl */,
+                               0F4966A21DB4091000A274BB /* DOMPointInit.h */,
+                               0F4966A11DB4090100A274BB /* DOMPointInit.idl */,
+                               0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */,
+                               0F49669C1DB408C100A274BB /* DOMPointReadOnly.idl */,
                                C55610F011A704EB00B82D27 /* DOMStringList.cpp */,
                                C544274911A57E7A0063A749 /* DOMStringList.h */,
                                C544274A11A57E7A0063A749 /* DOMStringList.idl */,
                                FB91392416AE4C17001FE682 /* DOMPath.h in Headers */,
                                A9C6E4EC0D745E2B006442E9 /* DOMPlugin.h in Headers */,
                                A9C6E4F00D745E38006442E9 /* DOMPluginArray.h in Headers */,
+                               0F49669D1DB408C100A274BB /* DOMPoint.h in Headers */,
+                               0F4966A31DB4091000A274BB /* DOMPointInit.h in Headers */,
+                               0F49669F1DB408C100A274BB /* DOMPointReadOnly.h in Headers */,
                                5185FCB71BB4C7670012898F /* DOMRequestState.h in Headers */,
                                BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
                                C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
                                FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */,
                                A9D247FF0D757E6900FDF959 /* JSDOMPlugin.h in Headers */,
                                A9D248010D757E6900FDF959 /* JSDOMPluginArray.h in Headers */,
+                               0F4966AB1DB40C4300A274BB /* JSDOMPoint.h in Headers */,
+                               0F4966AD1DB40C4300A274BB /* JSDOMPointInit.h in Headers */,
+                               0F4966AF1DB40C4300A274BB /* JSDOMPointReadOnly.h in Headers */,
                                E172AF901811BC3700FBADB9 /* JSDOMPromise.h in Headers */,
                                BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
                                C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */,
                                A9D248000D757E6900FDF959 /* JSDOMPluginArray.cpp in Sources */,
                                A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
                                A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
+                               0F4966AA1DB40C4300A274BB /* JSDOMPoint.cpp in Sources */,
+                               0F4966AC1DB40C4300A274BB /* JSDOMPointInit.cpp in Sources */,
+                               0F4966AE1DB40C4300A274BB /* JSDOMPointReadOnly.cpp in Sources */,
                                E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
                                BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
                                C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
diff --git a/Source/WebCore/dom/DOMPoint.h b/Source/WebCore/dom/DOMPoint.h
new file mode 100644 (file)
index 0000000..5b4a7f9
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DOMPointReadOnly.h"
+
+namespace WebCore {
+
+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> fromPoint(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
+
+    void setX(double x) { m_x = x; }
+    void setY(double y) { m_y = y; }
+    void setZ(double z) { m_z = z; }
+    void setW(double w) { m_w = w; }
+
+private:
+    DOMPoint(double x, double y, double z, double w)
+        : DOMPointReadOnly(x, y, z, w)
+    {
+    }
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/dom/DOMPoint.idl b/Source/WebCore/dom/DOMPoint.idl
new file mode 100644 (file)
index 0000000..7ecd37e
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+        optional unrestricted double z = 0, optional unrestricted double w = 1),
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable
+]
+interface DOMPoint : DOMPointReadOnly {
+    [NewObject] static DOMPoint fromPoint(optional DOMPointInit other);
+
+    inherit attribute unrestricted double x;
+    inherit attribute unrestricted double y;
+    inherit attribute unrestricted double z;
+    inherit attribute unrestricted double w;
+};
diff --git a/Source/WebCore/dom/DOMPointInit.h b/Source/WebCore/dom/DOMPointInit.h
new file mode 100644 (file)
index 0000000..119e42d
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct DOMPointInit {
+    double x { 0 };
+    double y { 0 };
+    double z { 0 };
+    double w { 1 };
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/dom/DOMPointInit.idl b/Source/WebCore/dom/DOMPointInit.idl
new file mode 100644 (file)
index 0000000..5f47f07
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+dictionary DOMPointInit {
+    unrestricted double x = 0;
+    unrestricted double y = 0;
+    unrestricted double z = 0;
+    unrestricted double w = 1;
+};
diff --git a/Source/WebCore/dom/DOMPointReadOnly.h b/Source/WebCore/dom/DOMPointReadOnly.h
new file mode 100644 (file)
index 0000000..e52c74d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DOMPointInit.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DOMPointReadOnly : public ScriptWrappable, public RefCounted<DOMPointReadOnly> {
+    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> fromPoint(const DOMPointInit& init) { return create(init.x, init.y, init.z, init.w); }
+
+    double x() const { return m_x; }
+    double y() const { return m_y; }
+    double z() const { return m_z; }
+    double w() const { return m_w; }
+
+protected:
+    DOMPointReadOnly(double x, double y, double z, double w)
+        : m_x(x)
+        , m_y(y)
+        , m_z(z)
+        , m_w(w)
+    {
+    }
+
+    // Any of these can be NaN or Inf.
+    double m_x;
+    double m_y;
+    double m_z;
+    double m_w;
+};
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/dom/DOMPointReadOnly.idl b/Source/WebCore/dom/DOMPointReadOnly.idl
new file mode 100644 (file)
index 0000000..910829f
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+        optional unrestricted double z = 0, optional unrestricted double w = 1),
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable
+]
+interface DOMPointReadOnly {
+    [NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other);
+
+    readonly attribute unrestricted double x;
+    readonly attribute unrestricted double y;
+    readonly attribute unrestricted double z;
+    readonly attribute unrestricted double w;
+
+    // FIXME: No support for DOMMatrix yet (webkit.org/b/110001)
+    // DOMPoint matrixTransform(optional DOMMatrixInit matrix);
+
+    serializer = { attribute };
+};