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/CSSPerspective.h" | 5 #include "core/css/cssom/CSSPerspective.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 CSSPerspective* CSSPerspective::Create(const CSSLengthValue* length, | 11 CSSPerspective* CSSPerspective::Create(const CSSNumericValue* length, |
12 ExceptionState& exception_state) { | 12 ExceptionState& exception_state) { |
13 if (length->ContainsPercent()) { | 13 if (length->ContainsPercent()) { |
14 exception_state.ThrowTypeError( | 14 exception_state.ThrowTypeError( |
15 "CSSPerspective does not support CSSLengthValues with percent units"); | 15 "CSSPerspective does not support CSSNumericValues with percent units"); |
16 return nullptr; | 16 return nullptr; |
17 } | 17 } |
18 return new CSSPerspective(length); | 18 return new CSSPerspective(length); |
19 } | 19 } |
20 | 20 |
21 CSSPerspective* CSSPerspective::FromCSSValue(const CSSFunctionValue& value) { | 21 CSSPerspective* CSSPerspective::FromCSSValue(const CSSFunctionValue& value) { |
22 DCHECK_EQ(value.FunctionType(), CSSValuePerspective); | 22 DCHECK_EQ(value.FunctionType(), CSSValuePerspective); |
23 DCHECK_EQ(value.length(), 1U); | 23 DCHECK_EQ(value.length(), 1U); |
24 CSSLengthValue* length = | 24 CSSNumericValue* length = |
25 CSSLengthValue::FromCSSValue(ToCSSPrimitiveValue(value.Item(0))); | 25 CSSNumericValue::FromCSSValue(ToCSSPrimitiveValue(value.Item(0))); |
26 DCHECK(!length->ContainsPercent()); | 26 DCHECK(!length->ContainsPercent()); |
27 return new CSSPerspective(length); | 27 return new CSSPerspective(length); |
28 } | 28 } |
29 | 29 |
30 CSSFunctionValue* CSSPerspective::ToCSSValue() const { | 30 CSSFunctionValue* CSSPerspective::ToCSSValue() const { |
31 CSSFunctionValue* result = CSSFunctionValue::Create(CSSValuePerspective); | 31 return nullptr; |
32 result->Append(*length_->ToCSSValue()); | 32 // CSSFunctionValue* result = CSSFunctionValue::Create(CSSValuePerspective); |
33 return result; | 33 // result->Append(*length_->ToCSSValue()); |
| 34 // return result; |
34 } | 35 } |
35 | 36 |
36 } // namespace blink | 37 } // namespace blink |
OLD | NEW |