Index: third_party/WebKit/Source/core/dom/DOMQuad.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DOMQuad.cpp b/third_party/WebKit/Source/core/dom/DOMQuad.cpp |
index e93bce2293dbe2b0997b063edb1a09dad994b112..1b87a2196f8f044c3a77f6ccbf8b4da5a1cf691a 100644 |
--- a/third_party/WebKit/Source/core/dom/DOMQuad.cpp |
+++ b/third_party/WebKit/Source/core/dom/DOMQuad.cpp |
@@ -6,6 +6,7 @@ |
#include "bindings/core/v8/V8ObjectBuilder.h" |
#include "core/dom/DOMPoint.h" |
+#include "core/dom/DOMRectInit.h" |
namespace blink { |
@@ -16,6 +17,10 @@ DOMQuad* DOMQuad::create(const DOMPointInit& p1, |
return new DOMQuad(p1, p2, p3, p4); |
} |
+DOMQuad* DOMQuad::fromRect(const DOMRectInit& other) { |
+ return new DOMQuad(other.x(), other.y(), other.width(), other.height()); |
+} |
+ |
DOMQuad::DOMQuad(const DOMPointInit& p1, |
const DOMPointInit& p2, |
const DOMPointInit& p3, |
@@ -25,6 +30,12 @@ DOMQuad::DOMQuad(const DOMPointInit& p1, |
m_p3(DOMPoint::fromPoint(p3)), |
m_p4(DOMPoint::fromPoint(p4)) {} |
+DOMQuad::DOMQuad(double x, double y, double width, double height) |
+ : m_p1(DOMPoint::create(x, y, 0, 1)), |
+ m_p2(DOMPoint::create(x + width, y, 0, 1)), |
+ m_p3(DOMPoint::create(x + width, y + height, 0, 1)), |
+ m_p4(DOMPoint::create(x, y + height, 0, 1)) {} |
+ |
ScriptValue DOMQuad::toJSONForBinding(ScriptState* scriptState) const { |
V8ObjectBuilder result(scriptState); |
result.add("p1", p1()); |