Commit a23c0523 authored by bashi@chromium.org's avatar bashi@chromium.org

Add DOMPointInit

To remove generic Dictionary from a DOMPoint constructor.
No changes in behavior; fast/dom/geometry-interfaces-dom-point.html
should cover this change.

Spec: http://dev.w3.org/fxtf/geometry/#DOMPoint

BUG=403150

Review URL: https://codereview.chromium.org/558163002

git-svn-id: svn://svn.chromium.org/blink/trunk@181877 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 30444604
...@@ -3346,11 +3346,14 @@ ...@@ -3346,11 +3346,14 @@
], ],
'core_dictionary_idl_files': [ 'core_dictionary_idl_files': [
'css/FontFaceDescriptors.idl', 'css/FontFaceDescriptors.idl',
'dom/DOMPointInit.idl',
'page/EventSourceInit.idl', 'page/EventSourceInit.idl',
], ],
'generated_core_dictionary_files': [ 'generated_core_dictionary_files': [
'<(blink_core_output_dir)/css/FontFaceDescriptors.cpp', '<(blink_core_output_dir)/css/FontFaceDescriptors.cpp',
'<(blink_core_output_dir)/css/FontFaceDescriptors.h', '<(blink_core_output_dir)/css/FontFaceDescriptors.h',
'<(blink_core_output_dir)/dom/DOMPointInit.cpp',
'<(blink_core_output_dir)/dom/DOMPointInit.h',
'<(blink_core_output_dir)/page/EventSourceInit.cpp', '<(blink_core_output_dir)/page/EventSourceInit.cpp',
'<(blink_core_output_dir)/page/EventSourceInit.h', '<(blink_core_output_dir)/page/EventSourceInit.h',
], ],
......
...@@ -4,26 +4,13 @@ ...@@ -4,26 +4,13 @@
#include "config.h" #include "config.h"
#include "core/dom/DOMPoint.h" #include "core/dom/DOMPoint.h"
#include "core/dom/DOMPointInit.h"
namespace blink { namespace blink {
DOMPoint* DOMPoint::create(const Dictionary& point) DOMPoint* DOMPoint::create(const DOMPointInit& point)
{ {
double x = 0; return new DOMPoint(point.x(), point.y(), point.z(), point.w());
double y = 0;
double z = 0;
double w = 0;
if (!DictionaryHelper::get(point, "x", x))
x = 0;
if (!DictionaryHelper::get(point, "y", y))
y = 0;
if (!DictionaryHelper::get(point, "z", z))
z = 0;
if (!DictionaryHelper::get(point, "w", w))
w = 1;
return new DOMPoint(x, y, z, w);
} }
DOMPoint* DOMPoint::create(double x, double y, double z, double w) DOMPoint* DOMPoint::create(double x, double y, double z, double w)
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
#ifndef DOMPoint_h #ifndef DOMPoint_h
#define DOMPoint_h #define DOMPoint_h
#include "bindings/core/v8/Dictionary.h"
#include "core/dom/DOMPointReadOnly.h" #include "core/dom/DOMPointReadOnly.h"
namespace blink { namespace blink {
class DOMPointInit;
class DOMPoint FINAL : public DOMPointReadOnly { class DOMPoint FINAL : public DOMPointReadOnly {
public: public:
static DOMPoint* create(const Dictionary&); static DOMPoint* create(const DOMPointInit&);
static DOMPoint* create(double x, double y, double z = 0, double w = 1); static DOMPoint* create(double x, double y, double z = 0, double w = 1);
void setX(double x) { m_x = x; } void setX(double x) { m_x = x; }
......
...@@ -2,17 +2,8 @@ ...@@ -2,17 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// FIXME: Blink doesn't currently support dictionary definitions.
// For now, we can use Dictionary interface. See http://crbug.com/321462.
// dictionary DOMPointInit {
// unrestricted double x = 0;
// unrestricted double y = 0;
// unrestricted double z = 0;
// unrestricted double w = 1;
// };
[ [
Constructor(optional Dictionary point), Constructor(optional DOMPointInit point),
Constructor(unrestricted double x, unrestricted double y, Constructor(unrestricted double x, unrestricted double y,
optional unrestricted double z = 0, optional unrestricted double w = 1), optional unrestricted double z = 0, optional unrestricted double w = 1),
RuntimeEnabled=GeometryInterfaces, RuntimeEnabled=GeometryInterfaces,
......
// Copyright 2014 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.
// Spec: http://dev.w3.org/fxtf/geometry/#DOMPoint
[
GarbageCollected
] dictionary DOMPointInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double z = 0;
unrestricted double w = 1;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment