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

Side by Side Diff: Source/core/css/CSSMatrix.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
63 // Convert to TransformOperations. This can fail if a property 63 // Convert to TransformOperations. This can fail if a property
64 // requires style (i.e., param uses 'ems' or 'exs') 64 // requires style (i.e., param uses 'ems' or 'exs')
65 RefPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSProper tyWebkitTransform); 65 RefPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSProper tyWebkitTransform);
66 66
67 // Check for a "none" or empty transform. In these cases we can use the default identity matrix. 67 // Check for a "none" or empty transform. In these cases we can use the default identity matrix.
68 if (!value || (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.g et()))->getValueID() == CSSValueNone)) 68 if (!value || (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.g et()))->getValueID() == CSSValueNone))
69 return; 69 return;
70 70
71 TransformOperations operations; 71 TransformOperations operations;
72 if (!TransformBuilder::createTransformOperations(value.get(), 0, 0, oper ations)) { 72 if (!TransformBuilder::createTransformOperations(value.get(), 0, 0, oper ations)) {
73 es.throwDOMException(SyntaxError); 73 es.throwUninformativeAndGenericDOMException(SyntaxError);
74 return; 74 return;
75 } 75 }
76 76
77 // Convert transform operations to a TransformationMatrix. This can fail 77 // Convert transform operations to a TransformationMatrix. This can fail
78 // if a param has a percentage ('%') 78 // if a param has a percentage ('%')
79 TransformationMatrix t; 79 TransformationMatrix t;
80 for (unsigned i = 0; i < operations.operations().size(); ++i) { 80 for (unsigned i = 0; i < operations.operations().size(); ++i) {
81 if (operations.operations()[i].get()->apply(t, IntSize(0, 0))) { 81 if (operations.operations()[i].get()->apply(t, IntSize(0, 0))) {
82 es.throwDOMException(SyntaxError); 82 es.throwUninformativeAndGenericDOMException(SyntaxError);
83 return; 83 return;
84 } 84 }
85 } 85 }
86 86
87 // set the matrix 87 // set the matrix
88 m_matrix = t; 88 m_matrix = t;
89 } else { // There is something there but parsing failed. 89 } else { // There is something there but parsing failed.
90 es.throwDOMException(SyntaxError); 90 es.throwUninformativeAndGenericDOMException(SyntaxError);
91 } 91 }
92 } 92 }
93 93
94 // Perform a concatenation of the matrices (this * secondMatrix) 94 // Perform a concatenation of the matrices (this * secondMatrix)
95 PassRefPtr<CSSMatrix> CSSMatrix::multiply(CSSMatrix* secondMatrix) const 95 PassRefPtr<CSSMatrix> CSSMatrix::multiply(CSSMatrix* secondMatrix) const
96 { 96 {
97 if (!secondMatrix) 97 if (!secondMatrix)
98 return 0; 98 return 0;
99 99
100 return CSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatri x->m_matrix)); 100 return CSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatri x->m_matrix));
101 } 101 }
102 102
103 PassRefPtr<CSSMatrix> CSSMatrix::inverse(ExceptionState& es) const 103 PassRefPtr<CSSMatrix> CSSMatrix::inverse(ExceptionState& es) const
104 { 104 {
105 if (!m_matrix.isInvertible()) { 105 if (!m_matrix.isInvertible()) {
106 es.throwDOMException(NotSupportedError); 106 es.throwUninformativeAndGenericDOMException(NotSupportedError);
107 return 0; 107 return 0;
108 } 108 }
109 109
110 return CSSMatrix::create(m_matrix.inverse()); 110 return CSSMatrix::create(m_matrix.inverse());
111 } 111 }
112 112
113 PassRefPtr<CSSMatrix> CSSMatrix::translate(double x, double y, double z) const 113 PassRefPtr<CSSMatrix> CSSMatrix::translate(double x, double y, double z) const
114 { 114 {
115 if (std::isnan(x)) 115 if (std::isnan(x))
116 x = 0; 116 x = 0;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (m_matrix.isAffine()) 185 if (m_matrix.isAffine())
186 return String::format("matrix(%f, %f, %f, %f, %f, %f)", m_matrix.a(), m_ matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f()); 186 return String::format("matrix(%f, %f, %f, %f, %f, %f)", m_matrix.a(), m_ matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f());
187 return String::format("matrix3d(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f)", 187 return String::format("matrix3d(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f)",
188 m_matrix.m11(), m_matrix.m12(), m_matrix.m13(), m_matrix.m14(), 188 m_matrix.m11(), m_matrix.m12(), m_matrix.m13(), m_matrix.m14(),
189 m_matrix.m21(), m_matrix.m22(), m_matrix.m23(), m_matrix.m24(), 189 m_matrix.m21(), m_matrix.m22(), m_matrix.m23(), m_matrix.m24(),
190 m_matrix.m31(), m_matrix.m32(), m_matrix.m33(), m_matrix.m34(), 190 m_matrix.m31(), m_matrix.m32(), m_matrix.m33(), m_matrix.m34(),
191 m_matrix.m41(), m_matrix.m42(), m_matrix.m43(), m_matrix.m44()); 191 m_matrix.m41(), m_matrix.m42(), m_matrix.m43(), m_matrix.m44());
192 } 192 }
193 193
194 } // namespace WebCore 194 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698