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/CSSKeywordValue.h" | 5 #include "core/css/cssom/CSSKeywordValue.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/css/CSSCustomIdentValue.h" | 8 #include "core/css/CSSCustomIdentValue.h" |
9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSIdentifierValue.h" |
10 #include "core/css/parser/CSSPropertyParser.h" | 10 #include "core/css/parser/CSSPropertyParser.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 CSSKeywordValue* CSSKeywordValue::create(const AtomicString& keyword, ExceptionS
tate& exceptionState) | 14 CSSKeywordValue* CSSKeywordValue::create(const AtomicString& keyword, ExceptionS
tate& exceptionState) |
15 { | 15 { |
16 if (keyword.isEmpty()) { | 16 if (keyword.isEmpty()) { |
17 exceptionState.throwTypeError("CSSKeywordValue does not support empty st
rings"); | 17 exceptionState.throwTypeError("CSSKeywordValue does not support empty st
rings"); |
18 return nullptr; | 18 return nullptr; |
19 } | 19 } |
20 return new CSSKeywordValue(keyword); | 20 return new CSSKeywordValue(keyword); |
21 } | 21 } |
22 | 22 |
23 const AtomicString& CSSKeywordValue::keywordValue() const | 23 const AtomicString& CSSKeywordValue::keywordValue() const |
24 { | 24 { |
25 return m_keywordValue; | 25 return m_keywordValue; |
26 } | 26 } |
27 | 27 |
28 CSSValueID CSSKeywordValue::keywordValueID() const | 28 CSSValueID CSSKeywordValue::keywordValueID() const |
29 { | 29 { |
30 return cssValueKeywordID(m_keywordValue); | 30 return cssValueKeywordID(m_keywordValue); |
31 } | 31 } |
32 | 32 |
33 CSSValue* CSSKeywordValue::toCSSValue() const | 33 CSSValue* CSSKeywordValue::toCSSValue() const |
34 { | 34 { |
35 CSSValueID keywordID = keywordValueID(); | 35 CSSValueID keywordID = keywordValueID(); |
36 if (keywordID == CSSValueID::CSSValueInvalid) { | 36 if (keywordID == CSSValueID::CSSValueInvalid) { |
37 return CSSCustomIdentValue::create(m_keywordValue); | 37 return CSSCustomIdentValue::create(m_keywordValue); |
38 } | 38 } |
39 return CSSPrimitiveValue::createIdentifier(keywordID); | 39 return CSSIdentifierValue::create(keywordID); |
40 } | 40 } |
41 | 41 |
42 } // namespace blink | 42 } // namespace blink |
OLD | NEW |