OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return initialStyle; | 63 return initialStyle; |
64 } | 64 } |
65 | 65 |
66 void CSSMatrix::setMatrixValue(const String& string, | 66 void CSSMatrix::setMatrixValue(const String& string, |
67 ExceptionState& exceptionState) { | 67 ExceptionState& exceptionState) { |
68 if (string.isEmpty()) | 68 if (string.isEmpty()) |
69 return; | 69 return; |
70 | 70 |
71 if (const CSSValue* value = | 71 if (const CSSValue* value = |
72 CSSParser::parseSingleValue(CSSPropertyTransform, string)) { | 72 CSSParser::parseSingleValue(CSSPropertyTransform, string)) { |
73 // Check for a "none" transform. In these cases we can use the default ident
ity matrix. | 73 // Check for a "none" transform. In these cases we can use the default |
| 74 // identity matrix. |
74 if (value->isIdentifierValue() && | 75 if (value->isIdentifierValue() && |
75 (toCSSIdentifierValue(value))->getValueID() == CSSValueNone) | 76 (toCSSIdentifierValue(value))->getValueID() == CSSValueNone) |
76 return; | 77 return; |
77 | 78 |
78 DEFINE_STATIC_REF(ComputedStyle, initialStyle, createInitialStyle()); | 79 DEFINE_STATIC_REF(ComputedStyle, initialStyle, createInitialStyle()); |
79 TransformOperations operations; | 80 TransformOperations operations; |
80 TransformBuilder::createTransformOperations( | 81 TransformBuilder::createTransformOperations( |
81 *value, CSSToLengthConversionData(initialStyle, initialStyle, | 82 *value, CSSToLengthConversionData(initialStyle, initialStyle, |
82 LayoutViewItem(nullptr), 1.0f), | 83 LayoutViewItem(nullptr), 1.0f), |
83 operations); | 84 operations); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return CSSMatrix::create(TransformationMatrix(*m_matrix).skewX(angle)); | 180 return CSSMatrix::create(TransformationMatrix(*m_matrix).skewX(angle)); |
180 } | 181 } |
181 | 182 |
182 CSSMatrix* CSSMatrix::skewY(double angle) const { | 183 CSSMatrix* CSSMatrix::skewY(double angle) const { |
183 if (std::isnan(angle)) | 184 if (std::isnan(angle)) |
184 angle = 0; | 185 angle = 0; |
185 return CSSMatrix::create(TransformationMatrix(*m_matrix).skewY(angle)); | 186 return CSSMatrix::create(TransformationMatrix(*m_matrix).skewY(angle)); |
186 } | 187 } |
187 | 188 |
188 String CSSMatrix::toString() const { | 189 String CSSMatrix::toString() const { |
189 // FIXME - Need to ensure valid CSS floating point values (https://bugs.webkit
.org/show_bug.cgi?id=20674) | 190 // FIXME - Need to ensure valid CSS floating point values |
| 191 // (https://bugs.webkit.org/show_bug.cgi?id=20674) |
190 if (m_matrix->isAffine()) | 192 if (m_matrix->isAffine()) |
191 return String::format("matrix(%f, %f, %f, %f, %f, %f)", m_matrix->a(), | 193 return String::format("matrix(%f, %f, %f, %f, %f, %f)", m_matrix->a(), |
192 m_matrix->b(), m_matrix->c(), m_matrix->d(), | 194 m_matrix->b(), m_matrix->c(), m_matrix->d(), |
193 m_matrix->e(), m_matrix->f()); | 195 m_matrix->e(), m_matrix->f()); |
194 return String::format( | 196 return String::format( |
195 "matrix3d(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, " | 197 "matrix3d(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, " |
196 "%f)", | 198 "%f)", |
197 m_matrix->m11(), m_matrix->m12(), m_matrix->m13(), m_matrix->m14(), | 199 m_matrix->m11(), m_matrix->m12(), m_matrix->m13(), m_matrix->m14(), |
198 m_matrix->m21(), m_matrix->m22(), m_matrix->m23(), m_matrix->m24(), | 200 m_matrix->m21(), m_matrix->m22(), m_matrix->m23(), m_matrix->m24(), |
199 m_matrix->m31(), m_matrix->m32(), m_matrix->m33(), m_matrix->m34(), | 201 m_matrix->m31(), m_matrix->m32(), m_matrix->m33(), m_matrix->m34(), |
200 m_matrix->m41(), m_matrix->m42(), m_matrix->m43(), m_matrix->m44()); | 202 m_matrix->m41(), m_matrix->m42(), m_matrix->m43(), m_matrix->m44()); |
201 } | 203 } |
202 | 204 |
203 } // namespace blink | 205 } // namespace blink |
OLD | NEW |