| 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/CSSStyleValue.h" | 5 #include "core/css/cssom/CSSStyleValue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "core/StylePropertyShorthand.h" | 10 #include "core/StylePropertyShorthand.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 if (isShorthandProperty(propertyID)) { | 28 if (isShorthandProperty(propertyID)) { |
| 29 exceptionState.throwTypeError("Parsing shorthand properties is not suppo
rted"); | 29 exceptionState.throwTypeError("Parsing shorthand properties is not suppo
rted"); |
| 30 return ScriptValue::createNull(scriptState); | 30 return ScriptValue::createNull(scriptState); |
| 31 } | 31 } |
| 32 | 32 |
| 33 CSSValue* cssValue = CSSParser::parseSingleValue(propertyID, value, strictCS
SParserContext()); | 33 CSSValue* cssValue = CSSParser::parseSingleValue(propertyID, value, strictCS
SParserContext()); |
| 34 if (!cssValue) | 34 if (!cssValue) |
| 35 return ScriptValue::createNull(scriptState); | 35 return ScriptValue::createNull(scriptState); |
| 36 | 36 |
| 37 CSSStyleValue* styleValue = StyleValueFactory::create(propertyID, *cssValue)
; | 37 CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueToStyleVal
ueVector(propertyID, *cssValue); |
| 38 if (!styleValue) | 38 if (styleValueVector.size() != 1) { |
| 39 // TODO(meade): Support returning a CSSStyleValueOrCSSStyleValueSequence |
| 40 // from this function. |
| 39 return ScriptValue::createNull(scriptState); | 41 return ScriptValue::createNull(scriptState); |
| 42 } |
| 40 | 43 |
| 41 v8::Local<v8::Value> wrappedValue = toV8(styleValue, scriptState->context()-
>Global(), scriptState->isolate()); | 44 v8::Local<v8::Value> wrappedValue = toV8(styleValueVector[0], scriptState->c
ontext()->Global(), scriptState->isolate()); |
| 42 return ScriptValue(scriptState, wrappedValue); | 45 return ScriptValue(scriptState, wrappedValue); |
| 43 } | 46 } |
| 44 | 47 |
| 45 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |