Title: [203702] trunk
Revision
203702
Author
cdu...@apple.com
Date
2016-07-25 17:21:31 -0700 (Mon, 25 Jul 2016)

Log Message

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

Reviewed by Geoffrey Garen.

Source/WebCore:

Move ClientRect properties from the instance to the prototype. This
matches the specification, Firefox and Chrome.

Also add a serializer to ClientRect in order to match the specification:
- https://drafts.fxtf.org/geometry/Overview.html#domrectreadonly
- https://heycam.github.io/webidl/#es-serializer

This avoids breaking content that relies on JSON.stringify() to
serialize ClientRect objects.

Tests: fast/css/ClientRect-attributes-prototype.html
       fast/css/ClientRect-serialization.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSClientRectCustom.cpp: Added.
(WebCore::JSClientRect::toJSON):
* bindings/scripts/CodeGeneratorJS.pm:
* dom/ClientRect.idl:

LayoutTests:

* fast/css/ClientRect-attributes-prototype-expected.txt: Added.
* fast/css/ClientRect-attributes-prototype.html: Added.
Add layout test to check that ClientRect's properties are on the
prototype.

* fast/css/ClientRect-serialization-expected.txt: Added.
* fast/css/ClientRect-serialization.html: Added.
Add layout test to check that ClientRect has a serializer.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203701 => 203702)


--- trunk/LayoutTests/ChangeLog	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/LayoutTests/ChangeLog	2016-07-26 00:21:31 UTC (rev 203702)
@@ -1,5 +1,21 @@
 2016-07-25  Chris Dumez  <cdu...@apple.com>
 
+        ClientRect properties should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=160165
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/css/ClientRect-attributes-prototype-expected.txt: Added.
+        * fast/css/ClientRect-attributes-prototype.html: Added.
+        Add layout test to check that ClientRect's properties are on the
+        prototype.
+
+        * fast/css/ClientRect-serialization-expected.txt: Added.
+        * fast/css/ClientRect-serialization.html: Added.
+        Add layout test to check that ClientRect has a serializer.
+
+2016-07-25  Chris Dumez  <cdu...@apple.com>
+
         Parameters to DOMImplementation.createDocumentType() should be mandatory and non-nullable
         https://bugs.webkit.org/show_bug.cgi?id=160167
 

Modified: trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt (203701 => 203702)


--- trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt	2016-07-26 00:21:31 UTC (rev 203702)
@@ -4,6 +4,7 @@
 PASS beforePosition[key] is afterPosition[key]
 PASS beforePosition[key] is afterPosition[key]
 PASS beforePosition[key] is afterPosition[key]
+PASS beforePosition[key] is afterPosition[key]
 PASS
 PASS
 PASS

Added: trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt (0 => 203702)


--- trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt	2016-07-26 00:21:31 UTC (rev 203702)
@@ -0,0 +1,78 @@
+Test that ClientRect's properties are on the prototype.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS clientRect.__proto__ is ClientRect.prototype
+PASS Object.getOwnPropertyNames(clientRect).length is 0
+PASS Object.hasOwnProperty(clientRect, 'top') is false
+PASS Object.hasOwnProperty(clientRect, 'right') is false
+PASS Object.hasOwnProperty(clientRect, 'bottom') is false
+PASS Object.hasOwnProperty(clientRect, 'left') is false
+PASS Object.hasOwnProperty(clientRect, 'width') is false
+PASS Object.hasOwnProperty(clientRect, 'height') is false
+
+* clientRect.__proto__.top
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.top
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* clientRect.__proto__.right
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.right
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* clientRect.__proto__.bottom
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.bottom
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* clientRect.__proto__.left
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.left
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* clientRect.__proto__.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* clientRect.__proto__.height
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* ClientRect.prototype.height
+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/fast/css/ClientRect-attributes-prototype.html (0 => 203702)


--- trunk/LayoutTests/fast/css/ClientRect-attributes-prototype.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/ClientRect-attributes-prototype.html	2016-07-26 00:21:31 UTC (rev 203702)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that ClientRect's properties are on the prototype.");
+
+var clientRect = document.body.getBoundingClientRect();
+shouldBe("clientRect.__proto__", "ClientRect.prototype");
+shouldBe("Object.getOwnPropertyNames(clientRect).length", "0");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'top')");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'right')");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'bottom')");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'left')");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'width')");
+shouldBeFalse("Object.hasOwnProperty(clientRect, 'height')");
+
+function checkAttributeGetter(prototype, propertyName)
+{
+    descriptor = Object.getOwnPropertyDescriptor(prototype, propertyName);
+    shouldBeType("descriptor.get", "Function");
+    shouldBeTrue("descriptor.enumerable");
+    shouldBeTrue("descriptor.configurable");
+}
+
+for (var propertyName of ['top', 'right', 'bottom', 'left', 'width', 'height']) {
+    debug("");
+    debug("* clientRect.__proto__." + propertyName);
+    checkAttributeGetter(clientRect.__proto__, propertyName);
+
+    debug("");
+    debug("* ClientRect.prototype." + propertyName);
+    checkAttributeGetter(ClientRect.prototype, propertyName);
+}
+
+debug("");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt (0 => 203702)


--- trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt	2016-07-26 00:21:31 UTC (rev 203702)
@@ -0,0 +1,28 @@
+Test that ClientRect has a serializer
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS clientRect.__proto__ is ClientRect.prototype
+PASS toJSONDescriptor.value is an instance of Function
+PASS toJSONDescriptor.enumerable is true
+PASS toJSONDescriptor.configurable is true
+PASS toJSONDescriptor.writable is true
+PASS jsonObject = clientRect.toJSON() did not throw exception.
+PASS jsonObject.top is clientRect.top
+PASS jsonObject.right is clientRect.right
+PASS jsonObject.bottom is clientRect.bottom
+PASS jsonObject.left is clientRect.left
+PASS jsonObject.width is clientRect.width
+PASS jsonObject.height is clientRect.height
+PASS parsedJSONObject = JSON.parse(JSON.stringify(clientRect)) did not throw exception.
+PASS parsedJSONObject.top is clientRect.top
+PASS parsedJSONObject.right is clientRect.right
+PASS parsedJSONObject.bottom is clientRect.bottom
+PASS parsedJSONObject.left is clientRect.left
+PASS parsedJSONObject.width is clientRect.width
+PASS parsedJSONObject.height is clientRect.height
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/ClientRect-serialization.html (0 => 203702)


--- trunk/LayoutTests/fast/css/ClientRect-serialization.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/ClientRect-serialization.html	2016-07-26 00:21:31 UTC (rev 203702)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that ClientRect has a serializer");
+
+var clientRect = document.body.getBoundingClientRect();
+shouldBe("clientRect.__proto__", "ClientRect.prototype");
+var toJSONDescriptor = Object.getOwnPropertyDescriptor(clientRect.__proto__, "toJSON");
+shouldBeType("toJSONDescriptor.value", "Function");
+shouldBeTrue("toJSONDescriptor.enumerable");
+shouldBeTrue("toJSONDescriptor.configurable");
+shouldBeTrue("toJSONDescriptor.writable");
+
+shouldNotThrow("jsonObject = clientRect.toJSON()");
+shouldBe("jsonObject.top", "clientRect.top");
+shouldBe("jsonObject.right", "clientRect.right");
+shouldBe("jsonObject.bottom", "clientRect.bottom");
+shouldBe("jsonObject.left", "clientRect.left");
+shouldBe("jsonObject.width", "clientRect.width");
+shouldBe("jsonObject.height", "clientRect.height");
+
+shouldNotThrow("parsedJSONObject = JSON.parse(JSON.stringify(clientRect))");
+shouldBe("parsedJSONObject.top", "clientRect.top");
+shouldBe("parsedJSONObject.right", "clientRect.right");
+shouldBe("parsedJSONObject.bottom", "clientRect.bottom");
+shouldBe("parsedJSONObject.left", "clientRect.left");
+shouldBe("parsedJSONObject.width", "clientRect.width");
+shouldBe("parsedJSONObject.height", "clientRect.height");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (203701 => 203702)


--- trunk/Source/WebCore/CMakeLists.txt	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-07-26 00:21:31 UTC (rev 203702)
@@ -1105,6 +1105,7 @@
     bindings/js/JSCanvasRenderingContext2DCustom.cpp
     bindings/js/JSCanvasRenderingContextCustom.cpp
     bindings/js/JSCharacterDataCustom.cpp
+    bindings/js/JSClientRectCustom.cpp
     bindings/js/JSCommandLineAPIHostCustom.cpp
     bindings/js/JSCryptoAlgorithmBuilder.cpp
     bindings/js/JSCryptoAlgorithmDictionary.cpp

Modified: trunk/Source/WebCore/ChangeLog (203701 => 203702)


--- trunk/Source/WebCore/ChangeLog	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/ChangeLog	2016-07-26 00:21:31 UTC (rev 203702)
@@ -1,5 +1,33 @@
 2016-07-25  Chris Dumez  <cdu...@apple.com>
 
+        ClientRect properties should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=160165
+
+        Reviewed by Geoffrey Garen.
+
+        Move ClientRect properties from the instance to the prototype. This
+        matches the specification, Firefox and Chrome.
+
+        Also add a serializer to ClientRect in order to match the specification:
+        - https://drafts.fxtf.org/geometry/Overview.html#domrectreadonly
+        - https://heycam.github.io/webidl/#es-serializer
+
+        This avoids breaking content that relies on JSON.stringify() to
+        serialize ClientRect objects.
+
+        Tests: fast/css/ClientRect-attributes-prototype.html
+               fast/css/ClientRect-serialization.html
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSClientRectCustom.cpp: Added.
+        (WebCore::JSClientRect::toJSON):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * dom/ClientRect.idl:
+
+2016-07-25  Chris Dumez  <cdu...@apple.com>
+
         Parameters to DOMImplementation.createDocumentType() should be mandatory and non-nullable
         https://bugs.webkit.org/show_bug.cgi?id=160167
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203701 => 203702)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-26 00:21:31 UTC (rev 203702)
@@ -1795,6 +1795,7 @@
 		4669B2871B852A0B000F905F /* JSDOMNamedFlowCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */; };
 		467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; };
 		4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
+		46A58AC51D46B3FA00432036 /* JSClientRectCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */; };
 		46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */; };
 		46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6905,11 +6906,11 @@
 		F98FFF4411A2676200F548E8 /* CSSOMUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */; };
 		F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F98FFF4311A2676200F548E8 /* CSSOMUtils.h */; };
 		F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; };
+		FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTextElement.cpp */; };
 		FA654A6B1108ABED002616F1 /* MathMLOperatorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */; };
+		FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */; };
+		FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTextElement.h */; };
 		FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */; };
-		FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTextElement.cpp */; };
-		FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTextElement.h */; };
-		FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */; };
 		FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */; };
 		FABE72F41059C1EB00D999DD /* MathMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */; };
 		FABE72F51059C1EB00D999DD /* MathMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72EE1059C1EB00D999DD /* MathMLElement.h */; };
@@ -9420,6 +9421,7 @@
 		465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecks.mm; sourceTree = "<group>"; };
 		467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
 		4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
+		46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClientRectCustom.cpp; sourceTree = "<group>"; };
 		46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; };
 		46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeoNotifier.cpp; sourceTree = "<group>"; };
 		46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = "<group>"; };
@@ -15087,11 +15089,11 @@
 		F9F0ED780DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XMLHttpRequestProgressEvent.idl; sourceTree = "<group>"; };
 		FA654A631108ABB7002615E0 /* mathml.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mathml.css; sourceTree = "<group>"; };
 		FA654A671108ABE2002615E0 /* mathattrs.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mathattrs.in; sourceTree = "<group>"; };
+		FA654A691108ABED002615E0 /* MathMLTextElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTextElement.cpp; sourceTree = "<group>"; };
 		FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLOperatorElement.cpp; sourceTree = "<group>"; };
+		FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLUnderOverElement.cpp; sourceTree = "<group>"; };
+		FA654A6A1108ABED002615E0 /* MathMLTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTextElement.h; sourceTree = "<group>"; };
 		FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLOperatorElement.h; sourceTree = "<group>"; };
-		FA654A691108ABED002615E0 /* MathMLTextElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTextElement.cpp; sourceTree = "<group>"; };
-		FA654A6A1108ABED002615E0 /* MathMLTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTextElement.h; sourceTree = "<group>"; };
-		FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLUnderOverElement.cpp; sourceTree = "<group>"; };
 		FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLUnderOverElement.h; sourceTree = "<group>"; };
 		FA6E466FCD0418A9966A5B60 /* DNSResolveQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNSResolveQueue.h; sourceTree = "<group>"; };
 		FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElement.cpp; sourceTree = "<group>"; };
@@ -22527,6 +22529,7 @@
 				1432E8460C51493800B1500F /* GCController.h */,
 				C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */,
 				C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */,
+				46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */,
 				E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */,
 				E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */,
 				E1C657101815F9DD00256CDD /* JSCryptoAlgorithmDictionary.cpp */,
@@ -32027,6 +32030,7 @@
 				24D912B013CA9A1F00D21915 /* SVGAltGlyphDefElement.cpp in Sources */,
 				65653F2D0D9727D200CA9723 /* SVGAltGlyphElement.cpp in Sources */,
 				24D912B713CA9A6900D21915 /* SVGAltGlyphItemElement.cpp in Sources */,
+				46A58AC51D46B3FA00432036 /* JSClientRectCustom.cpp in Sources */,
 				B22279760D00BF220071B782 /* SVGAngle.cpp in Sources */,
 				B22279790D00BF220071B782 /* SVGAnimateColorElement.cpp in Sources */,
 				4362C7B913AC6F1A00344BEB /* SVGAnimatedAngle.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (203701 => 203702)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-07-26 00:21:31 UTC (rev 203702)
@@ -43,6 +43,7 @@
 #include "JSCanvasRenderingContext2DCustom.cpp"
 #include "JSCanvasRenderingContextCustom.cpp"
 #include "JSCharacterDataCustom.cpp"
+#include "JSClientRectCustom.cpp"
 #include "JSCommandLineAPIHostCustom.cpp"
 #include "JSCryptoCustom.cpp"
 #include "JSCustomEventCustom.cpp"

Added: trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp (0 => 203702)


--- trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp	2016-07-26 00:21:31 UTC (rev 203702)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "JSClientRect.h"
+
+#include "ClientRect.h"
+#include <bytecode/CodeBlock.h>
+#include <runtime/IdentifierInlines.h>
+#include <runtime/JSObject.h>
+#include <runtime/ObjectConstructor.h>
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+using namespace JSC;
+
+JSC::JSValue JSClientRect::toJSON(ExecState& state)
+{
+    ClientRect& rect = wrapped();
+    VM& vm = state.vm();
+
+    JSValue object = constructEmptyObject(&state);
+    CodeBlock* codeBlock = state.codeBlock();
+    PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("top")), jsNumber(rect.top()), slot);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("right")), jsNumber(rect.right()), slot);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("bottom")), jsNumber(rect.bottom()), slot);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("left")), jsNumber(rect.left()), slot);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("width")), jsNumber(rect.width()), slot);
+    object.put(&state, Identifier::fromString(&vm, ASCIILiteral("height")), jsNumber(rect.height()), slot);
+
+    return object;
+}
+
+}

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (203701 => 203702)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-26 00:21:31 UTC (rev 203702)
@@ -541,7 +541,6 @@
 
     # Needed for compatibility with existing content
     return 1 if $interfaceName =~ "Touch";
-    return 1 if $interfaceName =~ "ClientRect";
 
     return 0;
 }

Modified: trunk/Source/WebCore/dom/ClientRect.idl (203701 => 203702)


--- trunk/Source/WebCore/dom/ClientRect.idl	2016-07-25 21:53:33 UTC (rev 203701)
+++ trunk/Source/WebCore/dom/ClientRect.idl	2016-07-26 00:21:31 UTC (rev 203702)
@@ -34,5 +34,8 @@
     readonly attribute unrestricted float left;
     readonly attribute unrestricted float width;
     readonly attribute unrestricted float height;
+
+    // FIXME: should be serializer = { attribute };
+    [Custom] Object toJSON();
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to