| 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/StylePropertyMap.h" | 5 #include "core/css/cssom/StylePropertyMap.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/cssom/CSSSimpleLength.h" | 9 #include "core/css/cssom/CSSSimpleLength.h" |
| 10 #include "core/css/cssom/CSSStyleValue.h" | 10 #include "core/css/cssom/CSSStyleValue.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 CSSStyleValueVector styleVector = getAllInternal(propertyID); | 61 CSSStyleValueVector styleVector = getAllInternal(propertyID); |
| 62 if (styleVector.isEmpty()) | 62 if (styleVector.isEmpty()) |
| 63 return nullptr; | 63 return nullptr; |
| 64 | 64 |
| 65 return styleVector[0]; | 65 return styleVector[0]; |
| 66 } | 66 } |
| 67 | 67 |
| 68 CSSStyleValueVector StylePropertyMap::getAll(const String& propertyName, | 68 CSSStyleValueVector StylePropertyMap::getAll(const String& propertyName, |
| 69 ExceptionState& exceptionState) { | 69 ExceptionState& exceptionState) { |
| 70 CSSPropertyID propertyID = cssPropertyID(propertyName); | 70 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 71 if (propertyID != CSSPropertyInvalid && propertyID != CSSPropertyVariable) | 71 if (propertyID == CSSPropertyInvalid) { |
| 72 return getAllInternal(propertyID); | 72 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
| 73 return CSSStyleValueVector(); |
| 74 } |
| 73 | 75 |
| 74 // TODO(meade): Handle custom properties here. | 76 if (propertyID == CSSPropertyVariable) |
| 75 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); | 77 return getAllInternal(propertyName); |
| 76 return CSSStyleValueVector(); | 78 |
| 79 return getAllInternal(propertyID); |
| 77 } | 80 } |
| 78 | 81 |
| 79 bool StylePropertyMap::has(const String& propertyName, | 82 bool StylePropertyMap::has(const String& propertyName, |
| 80 ExceptionState& exceptionState) { | 83 ExceptionState& exceptionState) { |
| 81 CSSPropertyID propertyID = cssPropertyID(propertyName); | 84 CSSPropertyID propertyID = cssPropertyID(propertyName); |
| 82 if (propertyID != CSSPropertyInvalid && propertyID != CSSPropertyVariable) | 85 if (propertyID != CSSPropertyInvalid && propertyID != CSSPropertyVariable) |
| 83 return !getAllInternal(propertyID).isEmpty(); | 86 return !getAllInternal(propertyID).isEmpty(); |
| 84 | 87 |
| 85 // TODO(meade): Handle custom properties here. | 88 // TODO(meade): Handle custom properties here. |
| 86 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); | 89 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); | 126 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
| 124 } | 127 } |
| 125 | 128 |
| 126 StylePropertyMap::IterationSource* StylePropertyMap::startIteration( | 129 StylePropertyMap::IterationSource* StylePropertyMap::startIteration( |
| 127 ScriptState*, | 130 ScriptState*, |
| 128 ExceptionState&) { | 131 ExceptionState&) { |
| 129 return new StylePropertyMapIterationSource(getIterationEntries()); | 132 return new StylePropertyMapIterationSource(getIterationEntries()); |
| 130 } | 133 } |
| 131 | 134 |
| 132 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |