| Index: third_party/WebKit/Source/core/dom/DOMMatrix.cpp | 
| diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp | 
| index 0e77259c9af33e0ffc0c6bc1bd47d0ce23edab1a..e7b565ae0aad2a3e6cd2dc96ef6cc4086caafa88 100644 | 
| --- a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp | 
| +++ b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp | 
| @@ -4,6 +4,14 @@ | 
|  | 
| #include "core/dom/DOMMatrix.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/layout/api/LayoutViewItem.h" | 
| +#include "core/style/ComputedStyle.h" | 
| + | 
| namespace blink { | 
|  | 
| DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) { | 
| @@ -215,4 +223,68 @@ DOMMatrix* DOMMatrix::invertSelf() { | 
| return this; | 
| } | 
|  | 
| +static inline PassRefPtr<ComputedStyle> createInitialStyle() { | 
| +  RefPtr<ComputedStyle> initialStyle = | 
| +      ComputedStyle::clone(ComputedStyle::initialStyle()); | 
| +  initialStyle->font().update(nullptr); | 
| +  return initialStyle; | 
| +} | 
| + | 
| +DOMMatrix* DOMMatrix::setMatrixValue(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) { | 
| +    exceptionState.throwDOMException(SyntaxError, | 
| +                                     "Failed to parse '" + inputString + "'."); | 
| +    return nullptr; | 
| +  } | 
| + | 
| +  if (value->isIdentifierValue()) { | 
| +    if ((toCSSIdentifierValue(value))->getValueID() == CSSValueNone) { | 
| +      return this; | 
| +    } | 
| +  } else { | 
| +    if (!value->isValueList()) { | 
| +      exceptionState.throwDOMException( | 
| +          SyntaxError, "Failed to parse '" + inputString + "'."); | 
| +      return nullptr; | 
| +    } | 
| +  } | 
| + | 
| +  DEFINE_STATIC_REF(ComputedStyle, initialStyle, createInitialStyle()); | 
| +  if (value->isValueList() && | 
| +      TransformBuilder::hasRelativeLengths(toCSSValueList(*value))) { | 
| +    exceptionState.throwDOMException(SyntaxError, | 
| +                                     "Relative lengths not supported."); | 
| +    return nullptr; | 
| +  } | 
| + | 
| +  TransformOperations operations; | 
| +  TransformBuilder::createTransformOperations( | 
| +      *value, CSSToLengthConversionData(initialStyle, initialStyle, | 
| +                                        LayoutViewItem(nullptr), 1.0f), | 
| +      operations); | 
| + | 
| +  if (operations.dependsOnBoxSize()) { | 
| +    exceptionState.throwDOMException(SyntaxError, | 
| +                                     "The transformation depends on the box " | 
| +                                     "size, which is not supported."); | 
| +    return nullptr; | 
| +  } | 
| + | 
| +  m_is2D = !operations.has3DOperation(); | 
| + | 
| +  m_matrix = TransformationMatrix::create(); | 
| +  operations.apply(FloatSize(0, 0), *m_matrix); | 
| + | 
| +  return this; | 
| +} | 
| + | 
| }  // namespace blink | 
|  |