Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: third_party/WebKit/Source/core/dom/DOMRectReadOnly.cpp

Issue 2771683005: Revert of Move geometry interface files to geometry directory. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/DOMRectReadOnly.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMRectReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMRectReadOnly.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6b6e5154c45cc9fcfd9cddba2b5ff6c5ec36828c
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DOMRectReadOnly.cpp
@@ -0,0 +1,43 @@
+// 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.
+
+#include "core/dom/DOMRectReadOnly.h"
+
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
+#include "core/dom/DOMRectInit.h"
+
+namespace blink {
+
+DOMRectReadOnly* DOMRectReadOnly::create(double x,
+ double y,
+ double width,
+ double height) {
+ return new DOMRectReadOnly(x, y, width, height);
+}
+
+ScriptValue DOMRectReadOnly::toJSONForBinding(ScriptState* scriptState) const {
+ V8ObjectBuilder result(scriptState);
+ result.addNumber("x", x());
+ result.addNumber("y", y());
+ result.addNumber("width", width());
+ result.addNumber("height", height());
+ result.addNumber("top", top());
+ result.addNumber("right", right());
+ result.addNumber("bottom", bottom());
+ result.addNumber("left", left());
+ return result.scriptValue();
+}
+
+DOMRectReadOnly* DOMRectReadOnly::fromRect(const DOMRectInit& other) {
+ return new DOMRectReadOnly(other.x(), other.y(), other.width(), other.height());
+}
+
+DOMRectReadOnly::DOMRectReadOnly(double x,
+ double y,
+ double width,
+ double height)
+ : m_x(x), m_y(y), m_width(width), m_height(height) {}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMRectReadOnly.h ('k') | third_party/WebKit/Source/core/dom/DOMRectReadOnly.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698