| Index: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
 | 
| diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
 | 
| index a3cc1da8182c721b93b902f67c7778c802ccabcd..e4c1ed95915423ee26b242a647d136df8fafd511 100644
 | 
| --- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
 | 
| +++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
 | 
| @@ -5,10 +5,17 @@
 | 
|  #include "core/dom/DOMMatrixReadOnly.h"
 | 
|  
 | 
|  #include "bindings/core/v8/V8ObjectBuilder.h"
 | 
| +#include "core/css/CSSIdentifierValue.h"
 | 
| +#include "core/css/CSSToLengthConversionData.h"
 | 
| +#include "core/css/CSSValueList.h"
 | 
| +#include "core/css/parser/CSSParser.h"
 | 
| +#include "core/css/resolver/TransformBuilder.h"
 | 
|  #include "core/dom/DOMMatrix.h"
 | 
|  #include "core/dom/DOMMatrixInit.h"
 | 
|  #include "core/dom/DOMPoint.h"
 | 
|  #include "core/dom/DOMPointInit.h"
 | 
| +#include "core/layout/api/LayoutViewItem.h"
 | 
| +#include "core/style/ComputedStyle.h"
 | 
|  
 | 
|  namespace blink {
 | 
|  namespace {
 | 
| @@ -89,6 +96,13 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::create(ExceptionState& exceptionState) {
 | 
|    return new DOMMatrixReadOnly(TransformationMatrix());
 | 
|  }
 | 
|  
 | 
| +DOMMatrixReadOnly* DOMMatrixReadOnly::create(const String& transformList,
 | 
| +                                             ExceptionState& exceptionState) {
 | 
| +  DOMMatrixReadOnly* matrix = new DOMMatrixReadOnly(TransformationMatrix());
 | 
| +  matrix->setMatrixValueFromString(transformList, exceptionState);
 | 
| +  return matrix;
 | 
| +}
 | 
| +
 | 
|  DOMMatrixReadOnly* DOMMatrixReadOnly::create(Vector<double> sequence,
 | 
|                                               ExceptionState& exceptionState) {
 | 
|    if (sequence.size() != 6 && sequence.size() != 16) {
 | 
| @@ -332,4 +346,53 @@ ScriptValue DOMMatrixReadOnly::toJSONForBinding(
 | 
|    return result.scriptValue();
 | 
|  }
 | 
|  
 | 
| +void DOMMatrixReadOnly::setMatrixValueFromString(
 | 
| +    const String& inputString,
 | 
| +    ExceptionState& exceptionState) {
 | 
| +  DEFINE_STATIC_LOCAL(String, identityMatrix2D, ("matrix(1, 0, 0, 1, 0, 0)"));
 | 
| +  String string = inputString;
 | 
| +  if (string.isEmpty())
 | 
| +    string = identityMatrix2D;
 | 
| +
 | 
| +  const CSSValue* value =
 | 
| +      CSSParser::parseSingleValue(CSSPropertyTransform, string);
 | 
| +
 | 
| +  if (!value || value->isCSSWideKeyword()) {
 | 
| +    exceptionState.throwDOMException(SyntaxError,
 | 
| +                                     "Failed to parse '" + inputString + "'.");
 | 
| +    return;
 | 
| +  }
 | 
| +
 | 
| +  if (value->isIdentifierValue()) {
 | 
| +    DCHECK(toCSSIdentifierValue(value)->getValueID() == CSSValueNone);
 | 
| +    m_matrix->makeIdentity();
 | 
| +    m_is2D = true;
 | 
| +    return;
 | 
| +  }
 | 
| +
 | 
| +  if (TransformBuilder::hasRelativeLengths(toCSSValueList(*value))) {
 | 
| +    exceptionState.throwDOMException(SyntaxError,
 | 
| +                                     "Lengths must be absolute, not relative");
 | 
| +    return;
 | 
| +  }
 | 
| +
 | 
| +  const ComputedStyle& initialStyle = ComputedStyle::initialStyle();
 | 
| +  TransformOperations operations = TransformBuilder::createTransformOperations(
 | 
| +      *value, CSSToLengthConversionData(&initialStyle, &initialStyle,
 | 
| +                                        LayoutViewItem(nullptr), 1.0f));
 | 
| +
 | 
| +  if (operations.dependsOnBoxSize()) {
 | 
| +    exceptionState.throwDOMException(
 | 
| +        SyntaxError, "Lengths must be absolute, not depend on the box size");
 | 
| +    return;
 | 
| +  }
 | 
| +
 | 
| +  m_matrix->makeIdentity();
 | 
| +  operations.apply(FloatSize(0, 0), *m_matrix);
 | 
| +
 | 
| +  m_is2D = !operations.has3DOperation();
 | 
| +
 | 
| +  return;
 | 
| +}
 | 
| +
 | 
|  }  // namespace blink
 | 
| 
 |