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

Unified Diff: third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp

Issue 2846523002: Update the stringifier behavior for DOMMatrixReadOnly (Closed)
Patch Set: Update the stringifier behavior for DOMMatrixReadOnly Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
diff --git a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
index fd09781ae4727015e83006bf86f86971163d5b6c..e179448cacafaf3ce33e9224b093b6a410df2f2b 100644
--- a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
+++ b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
@@ -304,20 +304,57 @@ NotShared<DOMFloat64Array> DOMMatrixReadOnly::toFloat64Array() const {
}
const String DOMMatrixReadOnly::toString() const {
- std::stringstream stream;
+ String result;
if (is2D()) {
- stream << "matrix(" << a() << ", " << b() << ", " << c() << ", " << d()
zino 2017/05/09 09:32:04 Looks good to me. BTW, don't we use stringstream
- << ", " << e() << ", " << f();
+ result.append("matrix(");
+ result.append(String::NumberToStringECMAScript(a()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(b()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(c()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(d()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(e()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(f()));
} else {
- stream << "matrix3d(" << m11() << ", " << m12() << ", " << m13() << ", "
- << m14() << ", " << m21() << ", " << m22() << ", " << m23() << ", "
- << m24() << ", " << m31() << ", " << m32() << ", " << m33() << ", "
- << m34() << ", " << m41() << ", " << m42() << ", " << m43() << ", "
- << m44();
+ result.append("matrix3d(");
+ result.append(String::NumberToStringECMAScript(m11()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m12()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m13()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m14()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m21()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m22()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m23()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m24()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m31()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m32()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m33()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m34()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m41()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m42()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m43()));
+ result.append(", ");
+ result.append(String::NumberToStringECMAScript(m44()));
}
- stream << ")";
+ result.append(")");
- return String(stream.str().c_str());
+ return result;
}
ScriptValue DOMMatrixReadOnly::toJSONForBinding(
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698