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