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

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

Issue 2867883003: [CSS Typed OM] Delete obsolete number and length classes from Typed OM (Closed)
Patch Set: rebase Created 3 years, 6 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
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/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/CSSAngleValue.h" 9 #include "core/css/cssom/CSSNumericValue.h"
10 #include "core/css/cssom/CSSUnitValue.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 CSSSkew* CSSSkew::FromCSSValue(const CSSFunctionValue& value) { 14 CSSSkew* CSSSkew::FromCSSValue(const CSSFunctionValue& value) {
14 const CSSPrimitiveValue& x_value = ToCSSPrimitiveValue(value.Item(0)); 15 return nullptr;
15 if (x_value.IsCalculated()) { 16 // TODO(meade): Re-enable this code once numbers and units types have been
16 // TODO(meade): Decide what we want to do with calc angles. 17 // re-written to the new spec.
17 return nullptr; 18 // const CSSPrimitiveValue& x_value = ToCSSPrimitiveValue(value.Item(0));
18 } 19 // if (x_value.IsCalculated()) {
19 DCHECK(x_value.IsAngle()); 20 // // TODO(meade): Decide what we want to do with calc angles.
20 switch (value.FunctionType()) { 21 // return nullptr;
21 case CSSValueSkew: 22 // }
22 if (value.length() == 2U) { 23 // DCHECK(x_value.IsAngle());
23 const CSSPrimitiveValue& y_value = ToCSSPrimitiveValue(value.Item(1)); 24 // switch (value.FunctionType()) {
24 if (y_value.IsCalculated()) { 25 // case CSSValueSkew:
25 // TODO(meade): Decide what we want to do with calc angles. 26 // if (value.length() == 2U) {
26 return nullptr; 27 // const CSSPrimitiveValue& y_value =
27 } 28 // ToCSSPrimitiveValue(value.Item(1)); if (y_value.IsCalculated()) {
28 DCHECK(y_value.IsAngle()); 29 // // TODO(meade): Decide what we want to do with calc angles.
29 return CSSSkew::Create(CSSAngleValue::FromCSSValue(x_value), 30 // return nullptr;
30 CSSAngleValue::FromCSSValue(y_value)); 31 // }
31 } 32 // DCHECK(y_value.IsAngle());
32 // Else fall through; skew(ax) == skewX(ax). 33 // return CSSSkew::Create(CSSNumericValue::FromCSSValue(x_value),
33 case CSSValueSkewX: 34 // CSSNumericValue::FromCSSValue(y_value));
34 DCHECK_EQ(value.length(), 1U); 35 // }
35 return CSSSkew::Create( 36 // // Else fall through; skew(ax) == skewX(ax).
36 CSSAngleValue::FromCSSValue(x_value), 37 // case CSSValueSkewX:
37 CSSAngleValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees)); 38 // DCHECK_EQ(value.length(), 1U);
38 case CSSValueSkewY: 39 // return CSSSkew::Create(
39 DCHECK_EQ(value.length(), 1U); 40 // CSSNumericValue::FromCSSValue(x_value),
40 return CSSSkew::Create( 41 // CSSUnitValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees));
41 CSSAngleValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees), 42 // case CSSValueSkewY:
42 CSSAngleValue::FromCSSValue(x_value)); 43 // DCHECK_EQ(value.length(), 1U);
43 default: 44 // return CSSSkew::Create(
44 NOTREACHED(); 45 // CSSUnitValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees),
45 return nullptr; 46 // CSSNumericValue::FromCSSValue(x_value));
46 } 47 // default:
48 // NOTREACHED();
49 // return nullptr;
50 // }
47 } 51 }
48 52
49 CSSFunctionValue* CSSSkew::ToCSSValue() const { 53 CSSFunctionValue* CSSSkew::ToCSSValue() const {
50 CSSFunctionValue* result = CSSFunctionValue::Create(CSSValueSkew); 54 return nullptr;
51 result->Append(*CSSPrimitiveValue::Create(ax_->Value(), ax_->Unit())); 55 // TODO(meade): Re-implement this when we finish rewriting number/length
52 result->Append(*CSSPrimitiveValue::Create(ay_->Value(), ay_->Unit())); 56 // types.
53 return result; 57 // CSSFunctionValue* result = CSSFunctionValue::Create(CSSValueSkew);
58 // result->Append(*CSSPrimitiveValue::Create(ax_->Value(), ax_->Unit()));
59 // result->Append(*CSSPrimitiveValue::Create(ay_->Value(), ay_->Unit()));
60 // return result;
54 } 61 }
55 62
56 } // namespace blink 63 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSSkew.h ('k') | third_party/WebKit/Source/core/css/cssom/CSSSkew.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698