Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/geometry/DOMMatrixReadOnly.h" | 5 #include "core/geometry/DOMMatrixReadOnly.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8ObjectBuilder.h" | 7 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 8 #include "core/css/CSSIdentifierValue.h" | 8 #include "core/css/CSSIdentifierValue.h" |
| 9 #include "core/css/CSSToLengthConversionData.h" | 9 #include "core/css/CSSToLengthConversionData.h" |
| 10 #include "core/css/CSSValueList.h" | 10 #include "core/css/CSSValueList.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 double array[] = { | 297 double array[] = { |
| 298 matrix_->M11(), matrix_->M12(), matrix_->M13(), matrix_->M14(), | 298 matrix_->M11(), matrix_->M12(), matrix_->M13(), matrix_->M14(), |
| 299 matrix_->M21(), matrix_->M22(), matrix_->M23(), matrix_->M24(), | 299 matrix_->M21(), matrix_->M22(), matrix_->M23(), matrix_->M24(), |
| 300 matrix_->M31(), matrix_->M32(), matrix_->M33(), matrix_->M34(), | 300 matrix_->M31(), matrix_->M32(), matrix_->M33(), matrix_->M34(), |
| 301 matrix_->M41(), matrix_->M42(), matrix_->M43(), matrix_->M44()}; | 301 matrix_->M41(), matrix_->M42(), matrix_->M43(), matrix_->M44()}; |
| 302 | 302 |
| 303 return NotShared<DOMFloat64Array>(DOMFloat64Array::Create(array, 16)); | 303 return NotShared<DOMFloat64Array>(DOMFloat64Array::Create(array, 16)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 const String DOMMatrixReadOnly::toString() const { | 306 const String DOMMatrixReadOnly::toString() const { |
| 307 std::stringstream stream; | 307 String result; |
| 308 if (is2D()) { | 308 if (is2D()) { |
| 309 stream << "matrix(" << a() << ", " << b() << ", " << c() << ", " << d() | 309 result.append("matrix("); |
|
zino
2017/05/09 09:32:04
Looks good to me.
BTW, don't we use stringstream
| |
| 310 << ", " << e() << ", " << f(); | 310 result.append(String::NumberToStringECMAScript(a())); |
| 311 result.append(", "); | |
| 312 result.append(String::NumberToStringECMAScript(b())); | |
| 313 result.append(", "); | |
| 314 result.append(String::NumberToStringECMAScript(c())); | |
| 315 result.append(", "); | |
| 316 result.append(String::NumberToStringECMAScript(d())); | |
| 317 result.append(", "); | |
| 318 result.append(String::NumberToStringECMAScript(e())); | |
| 319 result.append(", "); | |
| 320 result.append(String::NumberToStringECMAScript(f())); | |
| 311 } else { | 321 } else { |
| 312 stream << "matrix3d(" << m11() << ", " << m12() << ", " << m13() << ", " | 322 result.append("matrix3d("); |
| 313 << m14() << ", " << m21() << ", " << m22() << ", " << m23() << ", " | 323 result.append(String::NumberToStringECMAScript(m11())); |
| 314 << m24() << ", " << m31() << ", " << m32() << ", " << m33() << ", " | 324 result.append(", "); |
| 315 << m34() << ", " << m41() << ", " << m42() << ", " << m43() << ", " | 325 result.append(String::NumberToStringECMAScript(m12())); |
| 316 << m44(); | 326 result.append(", "); |
| 327 result.append(String::NumberToStringECMAScript(m13())); | |
| 328 result.append(", "); | |
| 329 result.append(String::NumberToStringECMAScript(m14())); | |
| 330 result.append(", "); | |
| 331 result.append(String::NumberToStringECMAScript(m21())); | |
| 332 result.append(", "); | |
| 333 result.append(String::NumberToStringECMAScript(m22())); | |
| 334 result.append(", "); | |
| 335 result.append(String::NumberToStringECMAScript(m23())); | |
| 336 result.append(", "); | |
| 337 result.append(String::NumberToStringECMAScript(m24())); | |
| 338 result.append(", "); | |
| 339 result.append(String::NumberToStringECMAScript(m31())); | |
| 340 result.append(", "); | |
| 341 result.append(String::NumberToStringECMAScript(m32())); | |
| 342 result.append(", "); | |
| 343 result.append(String::NumberToStringECMAScript(m33())); | |
| 344 result.append(", "); | |
| 345 result.append(String::NumberToStringECMAScript(m34())); | |
| 346 result.append(", "); | |
| 347 result.append(String::NumberToStringECMAScript(m41())); | |
| 348 result.append(", "); | |
| 349 result.append(String::NumberToStringECMAScript(m42())); | |
| 350 result.append(", "); | |
| 351 result.append(String::NumberToStringECMAScript(m43())); | |
| 352 result.append(", "); | |
| 353 result.append(String::NumberToStringECMAScript(m44())); | |
| 317 } | 354 } |
| 318 stream << ")"; | 355 result.append(")"); |
| 319 | 356 |
| 320 return String(stream.str().c_str()); | 357 return result; |
| 321 } | 358 } |
| 322 | 359 |
| 323 ScriptValue DOMMatrixReadOnly::toJSONForBinding( | 360 ScriptValue DOMMatrixReadOnly::toJSONForBinding( |
| 324 ScriptState* script_state) const { | 361 ScriptState* script_state) const { |
| 325 V8ObjectBuilder result(script_state); | 362 V8ObjectBuilder result(script_state); |
| 326 result.AddNumber("a", a()); | 363 result.AddNumber("a", a()); |
| 327 result.AddNumber("b", b()); | 364 result.AddNumber("b", b()); |
| 328 result.AddNumber("c", c()); | 365 result.AddNumber("c", c()); |
| 329 result.AddNumber("d", d()); | 366 result.AddNumber("d", d()); |
| 330 result.AddNumber("e", e()); | 367 result.AddNumber("e", e()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 | 430 |
| 394 matrix_->MakeIdentity(); | 431 matrix_->MakeIdentity(); |
| 395 operations.Apply(FloatSize(0, 0), *matrix_); | 432 operations.Apply(FloatSize(0, 0), *matrix_); |
| 396 | 433 |
| 397 is2d_ = !operations.Has3DOperation(); | 434 is2d_ = !operations.Has3DOperation(); |
| 398 | 435 |
| 399 return; | 436 return; |
| 400 } | 437 } |
| 401 | 438 |
| 402 } // namespace blink | 439 } // namespace blink |
| OLD | NEW |