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/CSSSkew.h" | 5 #include "core/css/cssom/CSSSkew.h" |
6 | 6 |
7 #include "core/css/CSSFunctionValue.h" | 7 #include "core/css/CSSFunctionValue.h" |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/cssom/CSSNumericValue.h" | 9 #include "core/css/cssom/CSSNumericValue.h" |
10 #include "core/css/cssom/CSSUnitValue.h" | 10 #include "core/css/cssom/CSSUnitValue.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
| 14 void CSSSkew::setAx(CSSNumericValue* value, ExceptionState& exception_state) { |
| 15 if (value->GetType() != CSSStyleValue::StyleValueType::kAngleType) { |
| 16 exception_state.ThrowTypeError("Must specify an angle unit"); |
| 17 return; |
| 18 } |
| 19 if (value->IsCalculated()) { |
| 20 exception_state.ThrowTypeError("Calculated angles are not supported yet"); |
| 21 return; |
| 22 } |
| 23 ax_ = value; |
| 24 } |
| 25 |
| 26 void CSSSkew::setAy(CSSNumericValue* value, ExceptionState& exception_state) { |
| 27 if (value->GetType() != CSSStyleValue::StyleValueType::kAngleType) { |
| 28 exception_state.ThrowTypeError("Must specify an angle unit"); |
| 29 return; |
| 30 } |
| 31 if (value->IsCalculated()) { |
| 32 exception_state.ThrowTypeError("Calculated angles are not supported yet"); |
| 33 return; |
| 34 } |
| 35 ay_ = value; |
| 36 } |
| 37 |
14 CSSSkew* CSSSkew::FromCSSValue(const CSSFunctionValue& value) { | 38 CSSSkew* CSSSkew::FromCSSValue(const CSSFunctionValue& value) { |
15 return nullptr; | 39 return nullptr; |
16 // TODO(meade): Re-enable this code once numbers and units types have been | 40 // TODO(meade): Re-enable this code once numbers and units types have been |
17 // re-written to the new spec. | 41 // re-written to the new spec. |
18 // const CSSPrimitiveValue& x_value = ToCSSPrimitiveValue(value.Item(0)); | 42 // const CSSPrimitiveValue& x_value = ToCSSPrimitiveValue(value.Item(0)); |
19 // if (x_value.IsCalculated()) { | 43 // if (x_value.IsCalculated()) { |
20 // // TODO(meade): Decide what we want to do with calc angles. | 44 // // TODO(meade): Decide what we want to do with calc angles. |
21 // return nullptr; | 45 // return nullptr; |
22 // } | 46 // } |
23 // DCHECK(x_value.IsAngle()); | 47 // DCHECK(x_value.IsAngle()); |
(...skipping 30 matching lines...) Expand all Loading... |
54 return nullptr; | 78 return nullptr; |
55 // TODO(meade): Re-implement this when we finish rewriting number/length | 79 // TODO(meade): Re-implement this when we finish rewriting number/length |
56 // types. | 80 // types. |
57 // CSSFunctionValue* result = CSSFunctionValue::Create(CSSValueSkew); | 81 // CSSFunctionValue* result = CSSFunctionValue::Create(CSSValueSkew); |
58 // result->Append(*CSSPrimitiveValue::Create(ax_->Value(), ax_->Unit())); | 82 // result->Append(*CSSPrimitiveValue::Create(ax_->Value(), ax_->Unit())); |
59 // result->Append(*CSSPrimitiveValue::Create(ay_->Value(), ay_->Unit())); | 83 // result->Append(*CSSPrimitiveValue::Create(ay_->Value(), ay_->Unit())); |
60 // return result; | 84 // return result; |
61 } | 85 } |
62 | 86 |
63 } // namespace blink | 87 } // namespace blink |
OLD | NEW |