Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/StyleValue.h" | 5 #include "core/css/cssom/StyleValue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptValue.h" | 7 #include "bindings/core/v8/ScriptValue.h" |
| 8 #include "core/css/cssom/SimpleLength.h" | |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 StyleValue* StyleValue::create(const CSSValue& val) | 12 StyleValue* StyleValue::create(const CSSValue& value) |
| 12 { | 13 { |
| 13 // TODO: implement. | 14 if (value.isPrimitiveValue()) { |
| 15 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | |
| 16 if (primitiveValue.isLength()) { | |
|
Timothy Loh
2016/02/09 07:29:32
doesn't work for calcs btw, they return true for i
meade_UTC10
2016/02/10 05:55:39
Done.
| |
| 17 return SimpleLength::create(primitiveValue.getDoubleValue(), primiti veValue.typeWithCalcResolved()); | |
| 18 } | |
| 19 } | |
| 20 // TODO: What if it is a list or pair? | |
| 21 // TODO: Implment the rest. | |
| 14 return nullptr; | 22 return nullptr; |
| 15 } | 23 } |
| 16 | 24 |
| 17 ScriptValue StyleValue::parse(ScriptState* state, const String& property, const String& cssText) | 25 ScriptValue StyleValue::parse(ScriptState* state, const String& property, const String& cssText) |
| 18 { | 26 { |
| 19 // TODO: implement. | 27 // TODO: implement. |
| 20 return ScriptValue(); | 28 return ScriptValue(); |
| 21 } | 29 } |
| 22 | 30 |
| 23 } // namespace blink | 31 } // namespace blink |
| OLD | NEW |