OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "core/css/CSSStringValues.h" | |
7 | |
8 #include "core/css/CSSMarkup.h" | |
9 #include "wtf/text/WTFString.h" | |
10 | |
11 namespace blink { | |
12 | |
13 namespace { | |
Timothy Loh
2015/09/25 05:44:16
..please read over your patches before sending the
| |
14 | |
15 } // namespace | |
16 | |
17 CSSStringValue::CSSStringValue(const String& str) | |
18 : CSSValue(StringClass) | |
19 , m_string(str) { } | |
20 | |
21 String CSSStringValue::customCSSText() const | |
22 { | |
23 return serializeString(m_string); | |
24 } | |
25 | |
26 CSSCustomIdentValue::CSSCustomIdentValue(const String& str) | |
27 : CSSValue(CustomIdentClass), | |
28 m_isPropertyID(false), | |
29 m_string(str) { } | |
30 | |
31 CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID propertyID) | |
32 : CSSValue(CustomIdentClass), | |
33 m_isPropertyID(true), | |
34 m_id(propertyID) { } | |
35 | |
36 String CSSCustomIdentValue::customCSSText() const | |
37 { | |
38 if (m_isPropertyID) | |
39 return getPropertyNameAtomicString(m_id); | |
40 return quoteCSSStringIfNeeded(m_string); | |
41 } | |
42 | |
43 bool CSSCustomIdentValue::equals(const CSSCustomIdentValue& other) const | |
44 { | |
45 if (m_isPropertyID != other.m_isPropertyID) | |
46 return false; | |
47 | |
48 if (m_isPropertyID) | |
49 return m_id == other.m_id; | |
50 return m_string == other.m_string; | |
51 } | |
52 | |
53 CSSURIValue::CSSURIValue(const String& str) | |
54 : CSSValue(URIClass) | |
55 , m_string(str) { } | |
56 | |
57 | |
58 String CSSURIValue::customCSSText() const | |
59 { | |
60 return "url(" + quoteCSSURLIfNeeded(m_string) + ")"; | |
61 } | |
62 | |
63 } // namespace blink | |
OLD | NEW |