| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/cssom/CSSRotation.h" | 5 #include "core/css/cssom/CSSRotation.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/css/CSSFunctionValue.h" | 8 #include "core/css/CSSFunctionValue.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 case CSSValueRotateX: | 90 case CSSValueRotateX: |
| 91 case CSSValueRotateY: | 91 case CSSValueRotateY: |
| 92 case CSSValueRotateZ: | 92 case CSSValueRotateZ: |
| 93 return FromCSSRotateXYZ(value); | 93 return FromCSSRotateXYZ(value); |
| 94 default: | 94 default: |
| 95 NOTREACHED(); | 95 NOTREACHED(); |
| 96 return nullptr; | 96 return nullptr; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void CSSRotation::setAngle(CSSNumericValue* angle, |
| 101 ExceptionState& exception_state) { |
| 102 if (angle->GetType() != CSSStyleValue::StyleValueType::kAngleType) { |
| 103 exception_state.ThrowTypeError("Must pass an angle to CSSRotation"); |
| 104 return; |
| 105 } |
| 106 if (angle->IsCalculated()) { |
| 107 exception_state.ThrowTypeError("Calculated angles are not supported yet"); |
| 108 return; |
| 109 } |
| 110 angle_ = angle; |
| 111 } |
| 112 |
| 100 CSSFunctionValue* CSSRotation::ToCSSValue() const { | 113 CSSFunctionValue* CSSRotation::ToCSSValue() const { |
| 101 return nullptr; | 114 return nullptr; |
| 102 // TODO(meade): Re-implement this when we finish rewriting number/length | 115 // TODO(meade): Re-implement this when we finish rewriting number/length |
| 103 // types. | 116 // types. |
| 104 // CSSFunctionValue* result = | 117 // CSSFunctionValue* result = |
| 105 // CSSFunctionValue::Create(is2d_ ? CSSValueRotate : CSSValueRotate3d); | 118 // CSSFunctionValue::Create(is2d_ ? CSSValueRotate : CSSValueRotate3d); |
| 106 // if (!is2d_) { | 119 // if (!is2d_) { |
| 107 // result->Append( | 120 // result->Append( |
| 108 // *CSSPrimitiveValue::Create(x_, CSSPrimitiveValue::UnitType::kNumber)); | 121 // *CSSPrimitiveValue::Create(x_, CSSPrimitiveValue::UnitType::kNumber)); |
| 109 // result->Append( | 122 // result->Append( |
| 110 // *CSSPrimitiveValue::Create(y_, CSSPrimitiveValue::UnitType::kNumber)); | 123 // *CSSPrimitiveValue::Create(y_, CSSPrimitiveValue::UnitType::kNumber)); |
| 111 // result->Append( | 124 // result->Append( |
| 112 // *CSSPrimitiveValue::Create(z_, CSSPrimitiveValue::UnitType::kNumber)); | 125 // *CSSPrimitiveValue::Create(z_, CSSPrimitiveValue::UnitType::kNumber)); |
| 113 // } | 126 // } |
| 114 // result->Append(*CSSPrimitiveValue::Create(angle_->Value(), | 127 // result->Append(*CSSPrimitiveValue::Create(angle_->Value(), |
| 115 // angle_->Unit())); | 128 // angle_->Unit())); |
| 116 // return result; | 129 // return result; |
| 117 } | 130 } |
| 118 | 131 |
| 119 } // namespace blink | 132 } // namespace blink |
| OLD | NEW |