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

Unified Diff: third_party/WebKit/Source/core/geometry/DOMQuad.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/geometry/DOMQuad.cpp
diff --git a/third_party/WebKit/Source/core/geometry/DOMQuad.cpp b/third_party/WebKit/Source/core/geometry/DOMQuad.cpp
deleted file mode 100644
index f3acb8ebe245992c03696d4082d20a60ff02be71..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/geometry/DOMQuad.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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.
-
-#include "core/geometry/DOMQuad.h"
-
-#include "bindings/core/v8/V8ObjectBuilder.h"
-#include "core/geometry/DOMPoint.h"
-#include "core/geometry/DOMQuadInit.h"
-#include "core/geometry/DOMRect.h"
-#include "core/geometry/DOMRectInit.h"
-
-namespace blink {
-
-DOMQuad* DOMQuad::create(const DOMPointInit& p1,
- const DOMPointInit& p2,
- const DOMPointInit& p3,
- const DOMPointInit& p4) {
- 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::fromQuad(const DOMQuadInit& other) {
- return new DOMQuad(other.hasP1() ? other.p1() : DOMPointInit(),
- other.hasP2() ? other.p2() : DOMPointInit(),
- other.hasP3() ? other.p3() : DOMPointInit(),
- other.hasP3() ? other.p4() : DOMPointInit());
-}
-
-DOMRect* DOMQuad::getBounds() {
- return DOMRect::create(m_left, m_top, m_right - m_left, m_bottom - m_top);
-}
-
-void DOMQuad::calculateBounds() {
- m_left = std::min(p1()->x(), p2()->x());
- m_left = std::min(m_left, p3()->x());
- m_left = std::min(m_left, p4()->x());
- m_top = std::min(p1()->y(), p2()->y());
- m_top = std::min(m_top, p3()->y());
- m_top = std::min(m_top, p4()->y());
- m_right = std::max(p1()->x(), p2()->x());
- m_right = std::max(m_right, p3()->x());
- m_right = std::max(m_right, p4()->x());
- m_bottom = std::max(p1()->y(), p2()->y());
- m_bottom = std::max(m_bottom, p3()->y());
- m_bottom = std::max(m_bottom, p4()->y());
-}
-
-DOMQuad::DOMQuad(const DOMPointInit& p1,
- const DOMPointInit& p2,
- const DOMPointInit& p3,
- const DOMPointInit& p4)
- : m_p1(DOMPoint::fromPoint(p1)),
- m_p2(DOMPoint::fromPoint(p2)),
- m_p3(DOMPoint::fromPoint(p3)),
- m_p4(DOMPoint::fromPoint(p4)) {
- calculateBounds();
-}
-
-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)) {
- calculateBounds();
-}
-
-ScriptValue DOMQuad::toJSONForBinding(ScriptState* scriptState) const {
- V8ObjectBuilder result(scriptState);
- result.add("p1", p1());
- result.add("p2", p2());
- result.add("p3", p3());
- result.add("p4", p4());
- return result.scriptValue();
-}
-
-} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/geometry/DOMQuad.h ('k') | third_party/WebKit/Source/core/geometry/DOMQuad.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698