| 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 "platform/wtf/text/StringBuilder.h" |
| 9 #include "wtf/text/WTFString.h" | 9 #include "platform/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(kCustomIdentClass), | 14 : CSSValue(kCustomIdentClass), |
| 15 string_(str), | 15 string_(str), |
| 16 property_id_(CSSPropertyInvalid) {} | 16 property_id_(CSSPropertyInvalid) {} |
| 17 | 17 |
| 18 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id) | 18 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id) |
| 19 : CSSValue(kCustomIdentClass), string_(), property_id_(id) { | 19 : CSSValue(kCustomIdentClass), string_(), property_id_(id) { |
| 20 DCHECK(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(property_id_); | 25 return getPropertyNameAtomicString(property_id_); |
| 26 StringBuilder builder; | 26 StringBuilder builder; |
| 27 SerializeIdentifier(string_, builder); | 27 SerializeIdentifier(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 |