Title: [213836] releases/WebKitGTK/webkit-2.16
Revision
213836
Author
[email protected]
Date
2017-03-13 05:26:01 -0700 (Mon, 13 Mar 2017)

Log Message

Merge r213646 - Align Document.elementFromPoint() with the CSSOM specification
https://bugs.webkit.org/show_bug.cgi?id=169403

Reviewed by Sam Weinig.

Source/WebCore:

Align Document.elementFromPoint() with the CSSOM specification:
- https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface

In particular, the parameters should be mandatory and of type double.

The parameters are mandatory in both Firefox and Chrome already. Parameters
are finite floating point in Firefox and integers in Chrome.

Test: fast/dom/elementFromPoint-parameters.html

* dom/DocumentOrShadowRoot.idl:
* dom/TreeScope.cpp:
(WebCore::TreeScope::elementFromPoint):
* dom/TreeScope.h:

LayoutTests:

Add layout test coverage.

* fast/dom/elementFromPoint-parameters-expected.txt: Added.
* fast/dom/elementFromPoint-parameters.html: Added.
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-03-13 12:26:01 UTC (rev 213836)
@@ -1,3 +1,17 @@
+2017-03-09  Chris Dumez  <[email protected]>
+
+        Align Document.elementFromPoint() with the CSSOM specification
+        https://bugs.webkit.org/show_bug.cgi?id=169403
+
+        Reviewed by Sam Weinig.
+
+        Add layout test coverage.
+
+        * fast/dom/elementFromPoint-parameters-expected.txt: Added.
+        * fast/dom/elementFromPoint-parameters.html: Added.
+        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+
 2017-03-08  Chris Dumez  <[email protected]>
 
         Parameter to input.setCustomValidity() should not be nullable

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters-expected.txt (0 => 213836)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters-expected.txt	2017-03-13 12:26:01 UTC (rev 213836)
@@ -0,0 +1,6 @@
+Tests that the parameters to document.elementFromPoint() are mandatory and of type double.
+
+
+PASS Parameters are mandatory. 
+PASS Parameter should be finite floating point values. 
+

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters.html (0 => 213836)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/elementFromPoint-parameters.html	2017-03-13 12:26:01 UTC (rev 213836)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Tests that the parameters to document.elementFromPoint() are mandatory and of type double.</p>
+<script src=""
+<script src=""
+<script>
+test(function() {
+    assert_throws(new TypeError(), function() { 
+        document.elementFromPoint();
+    }, "Called with no parameter");
+
+    assert_throws(new TypeError(), function() { 
+        document.elementFromPoint(0);
+    }, "Called with 1 parameter");
+}, "Parameters are mandatory.");
+
+test(function() {
+    assert_throws(new TypeError(), function() {
+        document.elementFromPoint(0, Infinity);
+    }, "Passing Infinity as second parameter throws");
+    assert_throws(new TypeError(), function() {
+        document.elementFromPoint(Infinity, 0);
+    }, "Passing Infinity as first parameter throws");
+    assert_throws(new TypeError(), function() {
+        document.elementFromPoint(0, NaN);
+    }, "Passing NaN as second parameter throws");
+    assert_throws(new TypeError(), function() {
+        document.elementFromPoint(NaN, 0);
+    }, "Passing NaN as first parameter throws");
+}, "Parameter should be finite floating point values.");
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2017-03-13 12:26:01 UTC (rev 213836)
@@ -20,8 +20,8 @@
 PASS nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)') is 'any type allowed'
 PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowed'
 PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed (but not omitted)'
-PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'any type allowed'
-PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'any type allowed'
+PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'mixed'
+PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'mixed'
 PASS nonNumericPolicy('document.body.scrollByLines(x)') is 'any type allowed'
 PASS nonNumericPolicy('document.body.scrollByPages(x)') is 'any type allowed'
 PASS nonNumericPolicy('document.body.scrollLeft = x') is 'any type allowed'

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2017-03-13 12:26:01 UTC (rev 213836)
@@ -219,8 +219,8 @@
 
 // Document
 
-shouldBe("nonNumericPolicy('document.elementFromPoint(x, 0)')", "'any type allowed'");
-shouldBe("nonNumericPolicy('document.elementFromPoint(0, x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('document.elementFromPoint(x, 0)')", "'mixed'");
+shouldBe("nonNumericPolicy('document.elementFromPoint(0, x)')", "'mixed'");
 
 // Element
 

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-03-13 12:26:01 UTC (rev 213836)
@@ -1,3 +1,25 @@
+2017-03-09  Chris Dumez  <[email protected]>
+
+        Align Document.elementFromPoint() with the CSSOM specification
+        https://bugs.webkit.org/show_bug.cgi?id=169403
+
+        Reviewed by Sam Weinig.
+
+        Align Document.elementFromPoint() with the CSSOM specification:
+        - https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
+
+        In particular, the parameters should be mandatory and of type double.
+
+        The parameters are mandatory in both Firefox and Chrome already. Parameters
+        are finite floating point in Firefox and integers in Chrome.
+
+        Test: fast/dom/elementFromPoint-parameters.html
+
+        * dom/DocumentOrShadowRoot.idl:
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::elementFromPoint):
+        * dom/TreeScope.h:
+
 2017-03-08  Chris Dumez  <[email protected]>
 
         Parameter to input.setCustomValidity() should not be nullable

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/DocumentOrShadowRoot.idl (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/DocumentOrShadowRoot.idl	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/DocumentOrShadowRoot.idl	2017-03-13 12:26:01 UTC (rev 213836)
@@ -29,7 +29,7 @@
 [
     NoInterfaceObject,
 ] interface DocumentOrShadowRoot {
-    Element?                    elementFromPoint(optional long x = 0, optional long y = 0); // FIXME: x and y should be double and not be optional.
+    Element? elementFromPoint(double x, double y);
     readonly attribute Element? activeElement;
     [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement;
 };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.cpp (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.cpp	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.cpp	2017-03-13 12:26:01 UTC (rev 213836)
@@ -313,7 +313,7 @@
     return result.innerNode();
 }
 
-Element* TreeScope::elementFromPoint(int x, int y)
+Element* TreeScope::elementFromPoint(double x, double y)
 {
     Document& document = documentScope();
     if (!document.hasLivingRenderTree())

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.h (213835 => 213836)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.h	2017-03-13 12:09:11 UTC (rev 213835)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/TreeScope.h	2017-03-13 12:26:01 UTC (rev 213836)
@@ -87,7 +87,7 @@
     void removeLabel(const AtomicStringImpl& forAttributeValue, HTMLLabelElement&);
     HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue);
 
-    WEBCORE_EXPORT Element* elementFromPoint(int x, int y);
+    WEBCORE_EXPORT Element* elementFromPoint(double x, double y);
 
     // Find first anchor with the given name.
     // First searches for an element with the given ID, but if that fails, then looks
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to