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 "config.h" | 5 #include "config.h" |
6 #include "core/css/CSSCustomIdentValue.h" | 6 #include "core/css/CSSCustomIdentValue.h" |
7 | 7 |
8 #include "core/css/CSSMarkup.h" | 8 #include "core/css/CSSMarkup.h" |
9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 CSSCustomIdentValue::CSSCustomIdentValue(const String& str) | 13 CSSCustomIdentValue::CSSCustomIdentValue(const String& str) |
14 : CSSValue(CustomIdentClass) | 14 : CSSValue(CustomIdentClass) |
15 , m_string(str) { } | 15 , m_string(str) |
| 16 , m_propertyId(CSSPropertyInvalid) { } |
| 17 |
| 18 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id) |
| 19 : CSSValue(CustomIdentClass) |
| 20 , m_string() |
| 21 , m_propertyId(id) |
| 22 { |
| 23 ASSERT(isKnownPropertyID()); |
| 24 } |
| 25 |
16 | 26 |
17 String CSSCustomIdentValue::customCSSText() const | 27 String CSSCustomIdentValue::customCSSText() const |
18 { | 28 { |
| 29 if (isKnownPropertyID()) |
| 30 return getPropertyNameAtomicString(m_propertyId); |
19 return quoteCSSStringIfNeeded(m_string); | 31 return quoteCSSStringIfNeeded(m_string); |
20 } | 32 } |
21 | 33 |
22 DEFINE_TRACE_AFTER_DISPATCH(CSSCustomIdentValue) | 34 DEFINE_TRACE_AFTER_DISPATCH(CSSCustomIdentValue) |
23 { | 35 { |
24 CSSValue::traceAfterDispatch(visitor); | 36 CSSValue::traceAfterDispatch(visitor); |
25 } | 37 } |
26 | 38 |
27 } // namespace blink | 39 } // namespace blink |
OLD | NEW |