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