Chromium Code Reviews| 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 731b6f0aedd16e297d8a82d034da7e40ab184885..0ca6bbed172ebebfc451b5257a00151036dccbbe 100644 |
| --- a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp |
| +++ b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp |
| @@ -4,14 +4,6 @@ |
| #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) { |
| @@ -29,6 +21,11 @@ DOMMatrix* DOMMatrix::create(const SkMatrix44& matrix, |
| return new DOMMatrix(transformationMatrix, transformationMatrix.isAffine()); |
| } |
| +DOMMatrix* DOMMatrix::create(const String& transformList, |
| + ExceptionState& exceptionState) { |
| + return new DOMMatrix(transformList, exceptionState); |
| +} |
| + |
| DOMMatrix* DOMMatrix::create(Vector<double> sequence, |
| ExceptionState& exceptionState) { |
| if (sequence.size() != 6 && sequence.size() != 16) { |
| @@ -62,6 +59,10 @@ DOMMatrix* DOMMatrix::fromFloat64Array(DOMFloat64Array* float64Array, |
| return new DOMMatrix(float64Array->data(), float64Array->length()); |
| } |
| +DOMMatrix::DOMMatrix(const String& transformList, |
| + ExceptionState& exceptionState) |
| + : DOMMatrixReadOnly(transformList, exceptionState) {} |
| + |
| template <typename T> |
| DOMMatrix::DOMMatrix(T sequence, int size) |
| : DOMMatrixReadOnly(sequence, size) {} |
| @@ -253,51 +254,8 @@ DOMMatrix* DOMMatrix::invertSelf() { |
| 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 || value->isCSSWideKeyword()) { |
| - exceptionState.throwDOMException(SyntaxError, |
| - "Failed to parse '" + inputString + "'."); |
| - return nullptr; |
| - } |
| - |
| - if (value->isIdentifierValue()) { |
| - DCHECK(toCSSIdentifierValue(value)->getValueID() == CSSValueNone); |
| - m_matrix->makeIdentity(); |
| - m_is2D = true; |
| - return this; |
| - } |
| - |
| - if (TransformBuilder::hasRelativeLengths(toCSSValueList(*value))) { |
| - exceptionState.throwDOMException(SyntaxError, |
| - "Relative lengths not supported."); |
| - return nullptr; |
| - } |
| - |
| - const ComputedStyle& initialStyle = ComputedStyle::initialStyle(); |
| - TransformOperations operations = TransformBuilder::createTransformOperations( |
| - *value, CSSToLengthConversionData(&initialStyle, &initialStyle, |
| - LayoutViewItem(nullptr), 1.0f)); |
| - |
| - if (operations.dependsOnBoxSize()) { |
| - exceptionState.throwDOMException(SyntaxError, |
| - "The transformation depends on the box " |
| - "size, which is not supported."); |
| - return nullptr; |
| - } |
| - |
| - m_matrix->makeIdentity(); |
| - operations.apply(FloatSize(0, 0), *m_matrix); |
| - |
| - m_is2D = !operations.has3DOperation(); |
| - |
| - return this; |
| + return static_cast<DOMMatrix*>( |
|
zino
2016/11/29 01:09:24
This casting isn't a right way.
I think we can mak
Hwanseung Lee
2016/11/29 14:31:25
Done.
|
| + DOMMatrixReadOnly::setMatrixValue(inputString, exceptionState)); |
| } |
| } // namespace blink |