Title: [207438] trunk
Revision
207438
Author
simon.fra...@apple.com
Date
2016-10-17 15:30:34 -0700 (Mon, 17 Oct 2016)

Log Message

Implement DOMRect/DOMRectReadOnly
https://bugs.webkit.org/show_bug.cgi?id=163464

Reviewed by Darin Adler.

Source/WebCore:

Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in
https://dev.w3.org/fxtf/geometry/

DOMRects allow negative height/width and require double storage, so we can't just
use FloatRect for storage. They also require handling of NaN and Infinity.

To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use
custom min/max functions that return NaN if either argument is NaN, so add
nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h.

Test: fast/dom/domrect.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMRect.h: Added.
(WebCore::DOMRect::create):
(WebCore::DOMRect::fromRect):
(WebCore::DOMRect::setX):
(WebCore::DOMRect::setY):
(WebCore::DOMRect::setWidth):
(WebCore::DOMRect::setHeight):
(WebCore::DOMRect::DOMRect):
* dom/DOMRect.idl: Added.
* dom/DOMRectInit.h: Added.
* dom/DOMRectInit.idl: Added.
* dom/DOMRectReadOnly.h: Added.
(WebCore::DOMRectReadOnly::create):
(WebCore::DOMRectReadOnly::fromRect):
(WebCore::DOMRectReadOnly::x):
(WebCore::DOMRectReadOnly::y):
(WebCore::DOMRectReadOnly::width):
(WebCore::DOMRectReadOnly::height):
(WebCore::DOMRectReadOnly::top):
(WebCore::DOMRectReadOnly::right):
(WebCore::DOMRectReadOnly::bottom):
(WebCore::DOMRectReadOnly::left):
(WebCore::DOMRectReadOnly::DOMRectReadOnly):
* dom/DOMRectReadOnly.idl: Added.

Source/WTF:

Implement min()/max() in a way that follows Math.min/Math.max, which return
NaN if either argument is NaN.

* wtf/MathExtras.h:
(WTF::nanPropagatingMin):
(WTF::nanPropagatingMax):

LayoutTests:

New test and new results for global constructor tests.

* geometry/DOMRect-001-expected.txt: Added.
* geometry/DOMRect-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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207437 => 207438)


--- trunk/LayoutTests/ChangeLog	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/ChangeLog	2016-10-17 22:30:34 UTC (rev 207438)
@@ -1,3 +1,23 @@
+2016-10-17  Simon Fraser  <simon.fra...@apple.com>
+
+        Implement DOMRect/DOMRectReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=163464
+
+        Reviewed by Darin Adler.
+        
+        New test and new results for global constructor tests.
+
+        * geometry/DOMRect-001-expected.txt: Added.
+        * geometry/DOMRect-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  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Basic MediaController

Added: trunk/LayoutTests/geometry/DOMRect-001-expected.txt (0 => 207438)


--- trunk/LayoutTests/geometry/DOMRect-001-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/geometry/DOMRect-001-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,27 @@
+Test DOMRect and DOMRectReadOnly interfaces
+
+
+PASS testDOMRectReadOnlyConstructor0 
+PASS testDOMRectReadOnlyConstructor4Args 
+PASS testDOMRectReadOnlyConstructor1Arg 
+PASS testDOMRectReadOnlyConstructor2Args 
+PASS testDOMRectReadOnlyConstructor3Args 
+PASS testDOMRectReadOnlyConstructorDoublePrecision 
+PASS testDOMRectReadOnlyConstructorNegativeWidth 
+PASS testDOMRectReadOnlyConstructorNegativeHeight 
+PASS testDOMRectReadOnlyConstructorNaN1 
+PASS testDOMRectReadOnlyConstructorNaN2 
+PASS testDOMRectReadOnlyConstructorInf1 
+PASS testDOMRectReadOnlyConstructorInf2 
+PASS testDOMRectReadOnlyIsReadOnly 
+PASS testDOMRectReadOnlyFromRect 
+PASS testFromRectReturnsDOMRectReadOnly 
+PASS testDOMRectReadOnlyFromRectPartial 
+PASS testDOMRectReadOnlySerialization 
+PASS testDOMRectConstructor0 
+PASS testDOMRectIsWritable 
+PASS testDOMRectIsWritableWithNaN 
+PASS testFromRectReturnsDOMRect 
+PASS testDOMRectFromRect 
+PASS testDOMRectSerialization 
+

Added: trunk/LayoutTests/geometry/DOMRect-001.html (0 => 207438)


--- trunk/LayoutTests/geometry/DOMRect-001.html	                        (rev 0)
+++ trunk/LayoutTests/geometry/DOMRect-001.html	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,186 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Geometry Interfaces: DOMRect and DOMRectReadOnly interface tests.</title>
+    <link rel="author" title="Dirk Schulze" href="" />
+    <link rel="help" href=""
+    <link rel="help" href=""
+    <script src=""
+    <script src=""
+</head>
+<body>
+    <p>Test DOMRect and DOMRectReadOnly interfaces</p>
+    <div id="log"></div>
+    <script>
+        test(function() {
+            checkDOMRect(new DOMRectReadOnly(), { x:0, y:0, width:0, height:0 });
+        },'testDOMRectReadOnlyConstructor0');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructor4Args');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(new DOMRectReadOnly(x), { x, y:0, width:0, height:0 });
+        },'testDOMRectReadOnlyConstructor1Arg');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(new DOMRectReadOnly(x, y), { x, y, width:0, height:0 });
+        },'testDOMRectReadOnlyConstructor2Args');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(new DOMRectReadOnly(x, y, width), { x, y, width, height:0 });
+        },'testDOMRectReadOnlyConstructor3Args');
+        test(function() {
+            x = Math.PI;
+            y = Math.SQRT2;
+            width = Math.E;
+            height = Math.LN10;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorDoublePrecision');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = -99;
+            var height = 102;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorNegativeWidth');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = -102;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorNegativeHeight');
+        test(function() {
+            var x = 1;
+            var y = NaN;
+            var width = NaN;
+            var height = -200;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorNaN1');
+        test(function() {
+            var x = NaN;
+            var y = 2;
+            var width = 99;
+            var height = NaN;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorNaN2');
+        test(function() {
+            var x = Infinity;
+            var y = -102;
+            var width = 304;
+            var height = -Infinity;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorInf1');
+        test(function() {
+            var x = 23;
+            var y = -Infinity;
+            var width = Infinity;
+            var height = -99;
+            checkDOMRect(new DOMRectReadOnly(x, y, width, height), { x, y, width, height });
+        },'testDOMRectReadOnlyConstructorInf2');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            var domRect = new DOMRectReadOnly(x, y, width, height);
+            domRect.x = 1200;
+            domRect.height = 300;
+            checkDOMRect(domRect, { x, y, width, height });
+        },'testDOMRectReadOnlyIsReadOnly');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(DOMRectReadOnly.fromRect({ x, y, width, height }), { x, y, width, height });
+        },'testDOMRectReadOnlyFromRect');
+        test(function() {
+            assert_true(DOMRectReadOnly.fromRect({ x:11, y:22, width:33, height:44 }) instanceof DOMRectReadOnly)
+        },'testFromRectReturnsDOMRectReadOnly');
+        test(function() {
+            var x = 10;
+            var width = 99;
+            checkDOMRect(DOMRectReadOnly.fromRect({ x, width }), { x, y:0, width, height:0 });
+        },'testDOMRectReadOnlyFromRectPartial');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = -102;
+            checkDOMRect(DOMRectReadOnly.fromRect({ x, y, width, height }).toJSON(), { x, y, width, height });
+        },'testDOMRectReadOnlySerialization');
+
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(new DOMRect(x, y, width, height), { x, y, width, height });
+        },'testDOMRectConstructor0');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            var domRect = new DOMRect(x, y, width, height);
+            domRect.x = 1200;
+            domRect.height = 300;
+            checkDOMRect(domRect, { x:1200, y, width, height:300 });
+        },'testDOMRectIsWritable');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            var domRect = new DOMRect(x, y, width, height);
+            domRect.x = NaN;
+            domRect.height = NaN;
+            checkDOMRect(domRect, { x:NaN, y:12, width:99, height:NaN });
+        },'testDOMRectIsWritableWithNaN');
+        test(function() {
+            assert_true(DOMRect.fromRect({ x:11, y:22, width:33, height:44 }) instanceof DOMRect)
+        },'testFromRectReturnsDOMRect');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = 102;
+            checkDOMRect(DOMRect.fromRect({ x, y, width, height }), { x, y, width, height });
+        },'testDOMRectFromRect');
+        test(function() {
+            var x = 10;
+            var y = 12;
+            var width = 99;
+            var height = -102;
+            checkDOMRect(DOMRect.fromRect({ x, y, width, height }).toJSON(), { x, y, width, height });
+        },'testDOMRectSerialization');
+
+        function checkDOMRect(r, exp) {
+            assert_equals(r.x, exp.x, "Expected value for x is " + exp.x);
+            assert_equals(r.y, exp.y, "Expected value for y is " + exp.y);
+            assert_equals(r.width, exp.width, "Expected value for width is " + exp.width);
+            assert_equals(r.height, exp.height, "Expected value for height is " + exp.height);
+
+            assert_equals(r.left, Math.min(exp.x, exp.x + exp.width), "Expected value for left is " + Math.min(exp.x, exp.x + exp.width));
+            assert_equals(r.right, Math.max(exp.x, exp.x + exp.width), "Expected value for right is " + Math.max(exp.x, exp.x + exp.width));
+            assert_equals(r.top, Math.min(exp.y, exp.y + exp.height), "Expected value for top is " + Math.min(exp.y, exp.y + exp.height));
+            assert_equals(r.bottom, Math.max(exp.y, exp.y + exp.height), "Expected value for bottom is " + Math.max(exp.y, exp.y + exp.height));
+        }
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt (207437 => 207438)


--- trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -59,6 +59,16 @@
 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, 'DOMRect').value is DOMRect
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -298,6 +298,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -298,6 +298,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -333,6 +333,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -343,6 +343,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -343,6 +343,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -343,6 +343,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt (207437 => 207438)


--- trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -238,6 +238,16 @@
 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, 'DOMRect').value is DOMRect
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRect').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').value is DOMRectReadOnly
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'DOMRectReadOnly').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

Modified: trunk/Source/WTF/ChangeLog (207437 => 207438)


--- trunk/Source/WTF/ChangeLog	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WTF/ChangeLog	2016-10-17 22:30:34 UTC (rev 207438)
@@ -1,3 +1,17 @@
+2016-10-17  Simon Fraser  <simon.fra...@apple.com>
+
+        Implement DOMRect/DOMRectReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=163464
+
+        Reviewed by Darin Adler.
+        
+        Implement min()/max() in a way that follows Math.min/Math.max, which return
+        NaN if either argument is NaN.
+
+        * wtf/MathExtras.h:
+        (WTF::nanPropagatingMin):
+        (WTF::nanPropagatingMax):
+
 2016-10-15  Sam Weinig  <s...@webkit.org>
 
         MessageEvent's source property should be a (DOMWindow or MessagePort)? rather than a EventTarget?

Modified: trunk/Source/WTF/wtf/MathExtras.h (207437 => 207438)


--- trunk/Source/WTF/wtf/MathExtras.h	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WTF/wtf/MathExtras.h	2016-10-17 22:30:34 UTC (rev 207438)
@@ -400,6 +400,20 @@
     return safeFPDivision(delta, std::abs(u)) <= epsilon && safeFPDivision(delta, std::abs(v)) <= epsilon;
 }
 
+// Match behavior of Math.min, where NaN is returned if either argument is NaN.
+template <typename T>
+inline typename std::enable_if<std::is_floating_point<T>::value, T>::type nanPropagatingMin(T a, T b)
+{
+    return std::isnan(a) || std::isnan(b) ? std::numeric_limits<T>::quiet_NaN() : std::min(a, b);
+}
+
+// Match behavior of Math.max, where NaN is returned if either argument is NaN.
+template <typename T>
+inline typename std::enable_if<std::is_floating_point<T>::value, T>::type nanPropagatingMax(T a, T b)
+{
+    return std::isnan(a) || std::isnan(b) ? std::numeric_limits<T>::quiet_NaN() : std::max(a, b);
+}
+
 inline bool isIntegral(float value)
 {
     return static_cast<int>(value) == value;

Modified: trunk/Source/WebCore/CMakeLists.txt (207437 => 207438)


--- trunk/Source/WebCore/CMakeLists.txt	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-10-17 22:30:34 UTC (rev 207438)
@@ -389,6 +389,9 @@
     dom/DOMPoint.idl
     dom/DOMPointInit.idl
     dom/DOMPointReadOnly.idl
+    dom/DOMRect.idl
+    dom/DOMRectInit.idl
+    dom/DOMRectReadOnly.idl
     dom/DOMStringList.idl
     dom/DOMStringMap.idl
     dom/DataTransfer.idl

Modified: trunk/Source/WebCore/ChangeLog (207437 => 207438)


--- trunk/Source/WebCore/ChangeLog	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WebCore/ChangeLog	2016-10-17 22:30:34 UTC (rev 207438)
@@ -1,3 +1,50 @@
+2016-10-17  Simon Fraser  <simon.fra...@apple.com>
+
+        Implement DOMRect/DOMRectReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=163464
+
+        Reviewed by Darin Adler.
+        
+        Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in
+        https://dev.w3.org/fxtf/geometry/
+        
+        DOMRects allow negative height/width and require double storage, so we can't just
+        use FloatRect for storage. They also require handling of NaN and Infinity.
+        
+        To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use
+        custom min/max functions that return NaN if either argument is NaN, so add 
+        nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h.
+
+        Test: fast/dom/domrect.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMRect.h: Added.
+        (WebCore::DOMRect::create):
+        (WebCore::DOMRect::fromRect):
+        (WebCore::DOMRect::setX):
+        (WebCore::DOMRect::setY):
+        (WebCore::DOMRect::setWidth):
+        (WebCore::DOMRect::setHeight):
+        (WebCore::DOMRect::DOMRect):
+        * dom/DOMRect.idl: Added.
+        * dom/DOMRectInit.h: Added.
+        * dom/DOMRectInit.idl: Added.
+        * dom/DOMRectReadOnly.h: Added.
+        (WebCore::DOMRectReadOnly::create):
+        (WebCore::DOMRectReadOnly::fromRect):
+        (WebCore::DOMRectReadOnly::x):
+        (WebCore::DOMRectReadOnly::y):
+        (WebCore::DOMRectReadOnly::width):
+        (WebCore::DOMRectReadOnly::height):
+        (WebCore::DOMRectReadOnly::top):
+        (WebCore::DOMRectReadOnly::right):
+        (WebCore::DOMRectReadOnly::bottom):
+        (WebCore::DOMRectReadOnly::left):
+        (WebCore::DOMRectReadOnly::DOMRectReadOnly):
+        * dom/DOMRectReadOnly.idl: Added.
+
 2016-10-17  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Basic MediaController

Modified: trunk/Source/WebCore/DerivedSources.make (207437 => 207438)


--- trunk/Source/WebCore/DerivedSources.make	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WebCore/DerivedSources.make	2016-10-17 22:30:34 UTC (rev 207438)
@@ -297,6 +297,9 @@
     $(WebCore)/dom/DOMPoint.idl \
     $(WebCore)/dom/DOMPointInit.idl \
     $(WebCore)/dom/DOMPointReadOnly.idl \
+    $(WebCore)/dom/DOMRect.idl \
+    $(WebCore)/dom/DOMRectInit.idl \
+    $(WebCore)/dom/DOMRectReadOnly.idl \
     $(WebCore)/dom/DOMStringList.idl \
     $(WebCore)/dom/DOMStringMap.idl \
     $(WebCore)/dom/DataTransfer.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207437 => 207438)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-17 22:09:29 UTC (rev 207437)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-17 22:30:34 UTC (rev 207438)
@@ -466,6 +466,15 @@
 		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 */; };
+		0F4710AF1DB56AFC002DCEC3 /* DOMRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710A91DB56AFC002DCEC3 /* DOMRect.h */; };
+		0F4710B11DB56AFC002DCEC3 /* DOMRectInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710AB1DB56AFC002DCEC3 /* DOMRectInit.h */; };
+		0F4710B31DB56AFC002DCEC3 /* DOMRectReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710AD1DB56AFC002DCEC3 /* DOMRectReadOnly.h */; };
+		0F4710BB1DB56BE8002DCEC3 /* JSDOMRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4710B51DB56BE8002DCEC3 /* JSDOMRect.cpp */; };
+		0F4710BC1DB56BE8002DCEC3 /* JSDOMRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */; };
+		0F4710BD1DB56BE8002DCEC3 /* JSDOMRectInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */; };
+		0F4710BE1DB56BE8002DCEC3 /* JSDOMRectInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */; };
+		0F4710BF1DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */; };
+		0F4710C01DB56BE8002DCEC3 /* JSDOMRectReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */; };
 		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 */; };
@@ -7309,6 +7318,18 @@
 		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>"; };
+		0F4710A91DB56AFC002DCEC3 /* DOMRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRect.h; sourceTree = "<group>"; };
+		0F4710AA1DB56AFC002DCEC3 /* DOMRect.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMRect.idl; sourceTree = "<group>"; };
+		0F4710AB1DB56AFC002DCEC3 /* DOMRectInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRectInit.h; sourceTree = "<group>"; };
+		0F4710AC1DB56AFC002DCEC3 /* DOMRectInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMRectInit.idl; sourceTree = "<group>"; };
+		0F4710AD1DB56AFC002DCEC3 /* DOMRectReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRectReadOnly.h; sourceTree = "<group>"; };
+		0F4710AE1DB56AFC002DCEC3 /* DOMRectReadOnly.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMRectReadOnly.idl; sourceTree = "<group>"; };
+		0F4710B51DB56BE8002DCEC3 /* JSDOMRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRect.cpp; path = JSDOMRect.cpp; sourceTree = "<group>"; };
+		0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRect.h; path = JSDOMRect.h; sourceTree = "<group>"; };
+		0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRectInit.cpp; path = JSDOMRectInit.cpp; sourceTree = "<group>"; };
+		0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRectInit.h; path = JSDOMRectInit.h; sourceTree = "<group>"; };
+		0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMRectReadOnly.cpp; path = JSDOMRectReadOnly.cpp; sourceTree = "<group>"; };
+		0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMRectReadOnly.h; path = JSDOMRectReadOnly.h; 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>"; };
@@ -19959,6 +19980,12 @@
 				0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */,
 				0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */,
 				0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */,
+				0F4710B51DB56BE8002DCEC3 /* JSDOMRect.cpp */,
+				0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */,
+				0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */,
+				0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */,
+				0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */,
+				0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */,
 				C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */,
 				C5137CF111A58378004ADB99 /* JSDOMStringList.h */,
 				BC64649511D82349006455B0 /* JSDOMStringMap.cpp */,
@@ -23425,6 +23452,12 @@
 				0F4966A11DB4090100A274BB /* DOMPointInit.idl */,
 				0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */,
 				0F49669C1DB408C100A274BB /* DOMPointReadOnly.idl */,
+				0F4710A91DB56AFC002DCEC3 /* DOMRect.h */,
+				0F4710AA1DB56AFC002DCEC3 /* DOMRect.idl */,
+				0F4710AB1DB56AFC002DCEC3 /* DOMRectInit.h */,
+				0F4710AC1DB56AFC002DCEC3 /* DOMRectInit.idl */,
+				0F4710AD1DB56AFC002DCEC3 /* DOMRectReadOnly.h */,
+				0F4710AE1DB56AFC002DCEC3 /* DOMRectReadOnly.idl */,
 				C55610F011A704EB00B82D27 /* DOMStringList.cpp */,
 				C544274911A57E7A0063A749 /* DOMStringList.h */,
 				C544274A11A57E7A0063A749 /* DOMStringList.idl */,
@@ -24780,6 +24813,9 @@
 				0F49669D1DB408C100A274BB /* DOMPoint.h in Headers */,
 				0F4966A31DB4091000A274BB /* DOMPointInit.h in Headers */,
 				0F49669F1DB408C100A274BB /* DOMPointReadOnly.h in Headers */,
+				0F4710AF1DB56AFC002DCEC3 /* DOMRect.h in Headers */,
+				0F4710B11DB56AFC002DCEC3 /* DOMRectInit.h in Headers */,
+				0F4710B31DB56AFC002DCEC3 /* DOMRectReadOnly.h in Headers */,
 				5185FCB71BB4C7670012898F /* DOMRequestState.h in Headers */,
 				BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
 				C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
@@ -25449,6 +25485,9 @@
 				0F4966AD1DB40C4300A274BB /* JSDOMPointInit.h in Headers */,
 				0F4966AF1DB40C4300A274BB /* JSDOMPointReadOnly.h in Headers */,
 				E172AF901811BC3700FBADB9 /* JSDOMPromise.h in Headers */,
+				0F4710BC1DB56BE8002DCEC3 /* JSDOMRect.h in Headers */,
+				0F4710BE1DB56BE8002DCEC3 /* JSDOMRectInit.h in Headers */,
+				0F4710C01DB56BE8002DCEC3 /* JSDOMRectReadOnly.h in Headers */,
 				BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
 				C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */,
 				BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */,
@@ -29128,6 +29167,9 @@
 				0F4966AC1DB40C4300A274BB /* JSDOMPointInit.cpp in Sources */,
 				0F4966AE1DB40C4300A274BB /* JSDOMPointReadOnly.cpp in Sources */,
 				E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
+				0F4710BB1DB56BE8002DCEC3 /* JSDOMRect.cpp in Sources */,
+				0F4710BD1DB56BE8002DCEC3 /* JSDOMRectInit.cpp in Sources */,
+				0F4710BF1DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp in Sources */,
 				BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
 				C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
 				BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */,

Added: trunk/Source/WebCore/dom/DOMRect.h (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRect.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRect.h	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,51 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "DOMRectReadOnly.h"
+
+namespace WebCore {
+
+class DOMRect : public DOMRectReadOnly {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static Ref<DOMRect> create(double x, double y, double width, double height) { return adoptRef(*new DOMRect(x, y, width, height)); }
+    static Ref<DOMRect> fromRect(const DOMRectInit& init) { return create(init.x, init.y, init.width, init.height); }
+
+    void setX(double x) { m_x = x; }
+    void setY(double y) { m_y = y; }
+
+    void setWidth(double width) { m_width = width; }
+    void setHeight(double height) { m_height = height; }
+
+private:
+    DOMRect(double x, double y, double width, double height)
+        : DOMRectReadOnly(x, y, width, height)
+    {
+    }
+};
+
+}

Added: trunk/Source/WebCore/dom/DOMRect.idl (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRect.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRect.idl	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,41 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+// https://drafts.fxtf.org/geometry-1/#DOMRect
+
+[
+    Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+        optional unrestricted double width = 0, optional unrestricted double height = 0),
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable
+]
+interface DOMRect : DOMRectReadOnly {
+    [NewObject] static DOMRect fromRect(optional DOMRectInit other);
+
+    inherit attribute unrestricted double x;
+    inherit attribute unrestricted double y;
+    inherit attribute unrestricted double width;
+    inherit attribute unrestricted double height;
+};

Added: trunk/Source/WebCore/dom/DOMRectInit.h (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRectInit.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRectInit.h	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,37 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 DOMRectInit {
+    double x { 0 };
+    double y { 0 };
+    double width { 0 };
+    double height { 0 };
+};
+
+}

Added: trunk/Source/WebCore/dom/DOMRectInit.idl (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRectInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRectInit.idl	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,33 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+// https://drafts.fxtf.org/geometry-1/#DOMRect
+
+dictionary DOMRectInit {
+    unrestricted double x = 0;
+    unrestricted double y = 0;
+    unrestricted double width = 0;
+    unrestricted double height = 0;
+};

Added: trunk/Source/WebCore/dom/DOMRectReadOnly.h (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRectReadOnly.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRectReadOnly.h	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,69 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "DOMRectInit.h"
+#include "ScriptWrappable.h"
+#include <wtf/MathExtras.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DOMRectReadOnly : public ScriptWrappable, public RefCounted<DOMRectReadOnly> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static Ref<DOMRectReadOnly> create(double x, double y, double width, double height) { return adoptRef(*new DOMRectReadOnly(x, y, width, height)); }
+    static Ref<DOMRectReadOnly> fromRect(const DOMRectInit& init) { return create(init.x, init.y, init.width, init.height); }
+
+    double x() const { return m_x; }
+    double y() const { return m_y; }
+    double width() const { return m_width; }
+    double height() const { return m_height; }
+
+    // Model NaN handling after Math.min, Math.max.
+    double top() const { return WTF::nanPropagatingMin(m_y, m_y + m_height); }
+    double right() const { return WTF::nanPropagatingMax(m_x, m_x + m_width); }
+    double bottom() const { return WTF::nanPropagatingMax(m_y, m_y + m_height); }
+    double left() const { return WTF::nanPropagatingMin(m_x, m_x + m_width); }
+
+protected:
+    DOMRectReadOnly(double x, double y, double width, double height)
+        : m_x(x)
+        , m_y(y)
+        , m_width(width)
+        , m_height(height)
+    {
+    }
+
+    // Any of these can be NaN or Inf.
+    double m_x;
+    double m_y;
+    double m_width; // Can be negative.
+    double m_height; // Can be negative.
+}; 
+
+}

Added: trunk/Source/WebCore/dom/DOMRectReadOnly.idl (0 => 207438)


--- trunk/Source/WebCore/dom/DOMRectReadOnly.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/DOMRectReadOnly.idl	2016-10-17 22:30:34 UTC (rev 207438)
@@ -0,0 +1,47 @@
+/*
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+// https://drafts.fxtf.org/geometry-1/#DOMRect
+
+[
+    Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+        optional unrestricted double width = 0, optional unrestricted double height = 0),
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable
+]
+interface DOMRectReadOnly {
+    [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other);
+
+    readonly attribute unrestricted double x;
+    readonly attribute unrestricted double y;
+    readonly attribute unrestricted double width;
+    readonly attribute unrestricted double height;
+    readonly attribute unrestricted double top;
+    readonly attribute unrestricted double right;
+    readonly attribute unrestricted double bottom;
+    readonly attribute unrestricted double left;
+
+    serializer = { attribute };
+};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to