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