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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp

Issue 2482743002: [GeometryInterface] add toJson() function in DOMMatrixReadOnly. (Closed)
Patch Set: add test for DOMMatrix Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/DOMMatrixReadOnly.h"
6
7 #include "bindings/core/v8/V8ObjectBuilder.h"
5 #include "core/dom/DOMMatrix.h" 8 #include "core/dom/DOMMatrix.h"
6 #include "core/dom/DOMMatrixInit.h" 9 #include "core/dom/DOMMatrixInit.h"
7 10
8 namespace blink { 11 namespace blink {
9 namespace { 12 namespace {
10 13
11 void setDictionaryMembers(DOMMatrixInit& other) { 14 void setDictionaryMembers(DOMMatrixInit& other) {
12 if (!other.hasM11()) 15 if (!other.hasM11())
13 other.setM11(other.hasA() ? other.a() : 1); 16 other.setM11(other.hasA() ? other.a() : 1);
14 17
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 << m14() << ", " << m21() << ", " << m22() << ", " << m23() << ", " 263 << m14() << ", " << m21() << ", " << m22() << ", " << m23() << ", "
261 << m24() << ", " << m31() << ", " << m32() << ", " << m33() << ", " 264 << m24() << ", " << m31() << ", " << m32() << ", " << m33() << ", "
262 << m34() << ", " << m41() << ", " << m42() << ", " << m43() << ", " 265 << m34() << ", " << m41() << ", " << m42() << ", " << m43() << ", "
263 << m44(); 266 << m44();
264 } 267 }
265 stream << ")"; 268 stream << ")";
266 269
267 return String(stream.str().c_str()); 270 return String(stream.str().c_str());
268 } 271 }
269 272
273 ScriptValue DOMMatrixReadOnly::toJSONForBinding(
274 ScriptState* scriptState) const {
275 V8ObjectBuilder result(scriptState);
276 result.addNumber("a", a());
277 result.addNumber("b", b());
278 result.addNumber("c", c());
279 result.addNumber("d", d());
280 result.addNumber("e", e());
281 result.addNumber("f", f());
282 result.addNumber("m11", m11());
283 result.addNumber("m12", m12());
284 result.addNumber("m13", m13());
285 result.addNumber("m14", m14());
286 result.addNumber("m21", m21());
287 result.addNumber("m22", m22());
288 result.addNumber("m23", m23());
289 result.addNumber("m24", m24());
290 result.addNumber("m31", m31());
291 result.addNumber("m32", m32());
292 result.addNumber("m33", m33());
293 result.addNumber("m34", m34());
294 result.addNumber("m41", m41());
295 result.addNumber("m42", m42());
296 result.addNumber("m43", m43());
297 result.addNumber("m44", m44());
298 result.addBoolean("is2D", is2D());
299 result.addBoolean("isIdentity", isIdentity());
300 return result.scriptValue();
301 }
302
270 } // namespace blink 303 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h ('k') | third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698