Title: [203707] trunk
Revision
203707
Author
cdu...@apple.com
Date
2016-07-25 19:24:20 -0700 (Mon, 25 Jul 2016)

Log Message

Touch properties should be on the prototype
https://bugs.webkit.org/show_bug.cgi?id=160174

Reviewed by Ryosuke Niwa.

Source/WebCore:

Touch properties should be on the prototype:
- https://w3c.github.io/touch-events/#idl-def-touch

Chrome agrees with the specification.

Test: platform/ios-simulator/ios/touch/Touch-attributes-prototype.html

* bindings/scripts/CodeGeneratorJS.pm:
(InterfaceRequiresAttributesOnInstanceForCompatibility): Deleted.

LayoutTests:

Add layout test coverage.

* platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt: Added.
* platform/ios-simulator/ios/touch/Touch-attributes-prototype.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203706 => 203707)


--- trunk/LayoutTests/ChangeLog	2016-07-26 02:18:30 UTC (rev 203706)
+++ trunk/LayoutTests/ChangeLog	2016-07-26 02:24:20 UTC (rev 203707)
@@ -1,5 +1,17 @@
 2016-07-25  Chris Dumez  <cdu...@apple.com>
 
+        Touch properties should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=160174
+
+        Reviewed by Ryosuke Niwa.
+
+        Add layout test coverage.
+
+        * platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt: Added.
+        * platform/ios-simulator/ios/touch/Touch-attributes-prototype.html: Added.
+
+2016-07-25  Chris Dumez  <cdu...@apple.com>
+
         ClientRect properties should be on the prototype
         https://bugs.webkit.org/show_bug.cgi?id=160165
 

Added: trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt (0 => 203707)


--- trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt	2016-07-26 02:24:20 UTC (rev 203707)
@@ -0,0 +1,101 @@
+Checks that Touch attributes are on the prototype.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS touch.__proto__ is Touch.prototype
+PASS Object.getOwnPropertyNames(touch).length is 0
+
+* touch.__proto__.identifier
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.identifier
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.target
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.target
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.screenX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.screenX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.screenY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.screenY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.clientX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.clientX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.clientY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.clientY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.pageX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.pageX
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.pageY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.pageY
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* touch.__proto__.force
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* Touch.prototype.force
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html (0 => 203707)


--- trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html	2016-07-26 02:24:20 UTC (rev 203707)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Checks that Touch attributes are on the prototype.");
+
+var touch = new Touch({ identifier: 1, target: document.body });
+shouldBe("touch.__proto__", "Touch.prototype");
+shouldBe("Object.getOwnPropertyNames(touch).length", "0");
+
+function checkAttributeGetter(prototype, propertyName)
+{
+    descriptor = Object.getOwnPropertyDescriptor(prototype, propertyName);
+    shouldBeType("descriptor.get", "Function");
+    shouldBeTrue("descriptor.enumerable");
+    shouldBeTrue("descriptor.configurable");
+}
+
+for (var propertyName of ["identifier", "target", "screenX", "screenY", "clientX", "clientY", "pageX", "pageY", "force"]) {
+    debug("");
+    debug("* touch.__proto__." + propertyName);
+    checkAttributeGetter(touch.__proto__, propertyName);
+
+    debug("");
+    debug("* Touch.prototype." + propertyName);
+    checkAttributeGetter(Touch.prototype, propertyName);
+}
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203706 => 203707)


--- trunk/Source/WebCore/ChangeLog	2016-07-26 02:18:30 UTC (rev 203706)
+++ trunk/Source/WebCore/ChangeLog	2016-07-26 02:24:20 UTC (rev 203707)
@@ -1,3 +1,20 @@
+2016-07-25  Chris Dumez  <cdu...@apple.com>
+
+        Touch properties should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=160174
+
+        Reviewed by Ryosuke Niwa.
+
+        Touch properties should be on the prototype:
+        - https://w3c.github.io/touch-events/#idl-def-touch
+
+        Chrome agrees with the specification.
+
+        Test: platform/ios-simulator/ios/touch/Touch-attributes-prototype.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (InterfaceRequiresAttributesOnInstanceForCompatibility): Deleted.
+
 2016-07-25  Jeremy Jones  <jere...@apple.com>
 
         Set MediaRemote playback state based on MediaSession playback state.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (203706 => 203707)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-26 02:18:30 UTC (rev 203706)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-26 02:24:20 UTC (rev 203707)
@@ -533,18 +533,6 @@
     return 0;
 }
 
-
-sub InterfaceRequiresAttributesOnInstanceForCompatibility
-{
-    my $interface = shift;
-    my $interfaceName = $interface->name;
-
-    # Needed for compatibility with existing content
-    return 1 if $interfaceName =~ "Touch";
-
-    return 0;
-}
-
 sub InterfaceRequiresAttributesOnInstance
 {
     my $interface = shift;
@@ -560,8 +548,6 @@
     # FIXME: Add support for [PrimaryGlobal] / [Global].
     return 1 if IsDOMGlobalObject($interface) && $interface->name ne "WorkerGlobalScope";
 
-    return 1 if InterfaceRequiresAttributesOnInstanceForCompatibility($interface);
-
     return 0;
 }
 
@@ -2573,16 +2559,6 @@
                 push(@implContent, "    if (UNLIKELY(!castedThis)) {\n");
                 if ($attribute->signature->extendedAttributes->{"LenientThis"}) {
                     push(@implContent, "        return JSValue::encode(jsUndefined());\n");
-                } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
-                    # Fallback to trying to searching the prototype chain for compatibility reasons.
-                    push(@implContent, "        JSObject* thisObject = JSValue::decode(thisValue).getObject();\n");
-                    push(@implContent, "        for (thisObject = thisObject ? thisObject->getPrototypeDirect().getObject() : nullptr; thisObject; thisObject = thisObject->getPrototypeDirect().getObject()) {\n");
-                    push(@implContent, "            if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n");
-                    push(@implContent, "                break;\n");
-                    push(@implContent, "        }\n");
-                    push(@implContent, "        if (!castedThis)\n");
-                    push(@implContent, "            return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
-                    push(@implContent, "        reportDeprecatedGetterError(*state, \"$interfaceName\", \"$name\");\n");
                 } else {
                     push(@implContent, "        return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
                 }
@@ -2874,16 +2850,6 @@
                 push(@implContent, "    if (UNLIKELY(!castedThis)) {\n");
                 if ($attribute->signature->extendedAttributes->{"LenientThis"}) {
                     push(@implContent, "        return false;\n");
-                } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
-                    # Fallback to trying to searching the prototype chain for compatibility reasons.
-                    push(@implContent, "        JSObject* thisObject = JSValue::decode(thisValue).getObject();\n");
-                    push(@implContent, "        for (thisObject = thisObject ? thisObject->getPrototypeDirect().getObject() : nullptr; thisObject; thisObject = thisObject->getPrototypeDirect().getObject()) {\n");
-                    push(@implContent, "            if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n");
-                    push(@implContent, "                break;\n");
-                    push(@implContent, "        }\n");
-                    push(@implContent, "        if (!castedThis)\n");
-                    push(@implContent, "            return throwSetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
-                    push(@implContent, "        reportDeprecatedSetterError(*state, \"$interfaceName\", \"$name\");\n");
                 } else {
                     push(@implContent, "        return throwSetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
                 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to