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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/CSSAngleValue.cpp

Issue 2514043002: [CSS Typed OM] Add CSSValue->CSSSkew conversions (Closed)
Patch Set: Merge branch 'update-transform-tests' into cssskew-fromcssvalue-2 Created 4 years 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
OLDNEW
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/CSSAngleValue.h" 5 #include "core/css/cssom/CSSAngleValue.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "wtf/MathExtras.h" 9 #include "wtf/MathExtras.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 CSSAngleValue* CSSAngleValue::create(double value,
14 CSSPrimitiveValue::UnitType unit) {
15 DCHECK(CSSPrimitiveValue::isAngle(unit));
16 return new CSSAngleValue(value, unit);
17 }
18
13 CSSAngleValue* CSSAngleValue::create(double value, const String& unit) { 19 CSSAngleValue* CSSAngleValue::create(double value, const String& unit) {
14 CSSPrimitiveValue::UnitType primitiveUnit = 20 CSSPrimitiveValue::UnitType primitiveUnit =
15 CSSPrimitiveValue::stringToUnitType(unit); 21 CSSPrimitiveValue::stringToUnitType(unit);
16 DCHECK(CSSPrimitiveValue::isAngle(primitiveUnit)); 22 return create(value, primitiveUnit);
17 return new CSSAngleValue(value, primitiveUnit);
18 } 23 }
19 24
20 CSSAngleValue* CSSAngleValue::fromCSSValue(const CSSPrimitiveValue& value) { 25 CSSAngleValue* CSSAngleValue::fromCSSValue(const CSSPrimitiveValue& value) {
21 DCHECK(value.isAngle()); 26 DCHECK(value.isAngle());
22 if (value.isCalculated()) 27 if (value.isCalculated())
23 return nullptr; 28 return nullptr;
24 return new CSSAngleValue(value.getDoubleValue(), 29 return new CSSAngleValue(value.getDoubleValue(),
25 value.typeWithCalcResolved()); 30 value.typeWithCalcResolved());
26 } 31 }
27 32
(...skipping 23 matching lines...) Expand all
51 56
52 double CSSAngleValue::turns() const { 57 double CSSAngleValue::turns() const {
53 return deg2turn(degrees()); 58 return deg2turn(degrees());
54 } 59 }
55 60
56 CSSValue* CSSAngleValue::toCSSValue() const { 61 CSSValue* CSSAngleValue::toCSSValue() const {
57 return CSSPrimitiveValue::create(m_value, m_unit); 62 return CSSPrimitiveValue::create(m_value, m_unit);
58 } 63 }
59 64
60 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSAngleValue.h ('k') | third_party/WebKit/Source/core/css/cssom/CSSSkew.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698