Chromium Code Reviews| Index: third_party/WebKit/Source/modules/geometry/DOMPointReadOnly.js |
| diff --git a/third_party/WebKit/Source/modules/geometry/DOMPointReadOnly.js b/third_party/WebKit/Source/modules/geometry/DOMPointReadOnly.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1621c61b9bc6dc2070ebbdbee02ed774863c1375 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/geometry/DOMPointReadOnly.js |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +(function(global, binding, v8) { |
| + 'use strict'; |
| + |
| + const defineProperty = global.Object.defineProperty; |
| + |
| + class DOMPointReadOnly { |
| + constructor(x = 0, y = 0, z = 0, w = 1) { |
| + defineProperty(this, 'x', { |
|
domenic
2016/02/18 19:04:41
While I personally prefer this design, the spec ma
zino
2016/02/22 09:51:01
Done.
|
| + value: x, |
| + configurable: true, |
| + enumerable: true, |
| + writable: false |
| + }); |
| + |
| + defineProperty(this, 'y', { |
| + value: y, |
| + configurable: true, |
| + enumerable: true, |
| + writable: false |
| + }); |
| + |
| + defineProperty(this, 'z', { |
| + value: z, |
| + configurable: true, |
| + enumerable: true, |
| + writable: false |
| + }); |
| + |
| + defineProperty(this, 'w', { |
| + value: w, |
| + configurable: true, |
| + enumerable: true, |
| + writable: false |
| + }); |
| + } |
| + |
| + static fromPoint(init) { |
| + return new DOMPointReadOnly(init.x, init.y, init.z, init.w); |
| + } |
| + } |
| + |
| + binding.createDOMPointReadOnly = DOMPointReadOnly.fromPoint; |
|
domenic
2016/02/18 19:04:41
An option here would be to instead do `binding.cre
zino
2016/02/22 09:51:01
Done.
|
| + |
| + defineProperty(global, 'DOMPointReadOnly', { |
| + value: DOMPointReadOnly, |
| + configurable: true, |
| + enumerable: false, |
| + writable: true |
| + }); |
| +}); |