Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: Source/core/css/CSSValueList.cpp

Issue 973623002: Fix serialization of content property to always quote (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add another method Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 newList = createSlashSeparated(); 76 newList = createSlashSeparated();
77 break; 77 break;
78 default: 78 default:
79 ASSERT_NOT_REACHED(); 79 ASSERT_NOT_REACHED();
80 } 80 }
81 for (size_t index = 0; index < m_values.size(); index++) 81 for (size_t index = 0; index < m_values.size(); index++)
82 newList->append(m_values[index]); 82 newList->append(m_values[index]);
83 return newList.release(); 83 return newList.release();
84 } 84 }
85 85
86 String CSSValueList::customCSSText(CSSTextFormattingFlags formattingFlag) const 86 String CSSValueList::customCSSText() const
87 { 87 {
88 StringBuilder result; 88 StringBuilder result;
89 String separator; 89 String separator;
90 switch (m_valueListSeparator) { 90 switch (m_valueListSeparator) {
91 case SpaceSeparator: 91 case SpaceSeparator:
92 separator = " "; 92 separator = " ";
93 break; 93 break;
94 case CommaSeparator: 94 case CommaSeparator:
95 separator = ", "; 95 separator = ", ";
96 break; 96 break;
97 case SlashSeparator: 97 case SlashSeparator:
98 separator = " / "; 98 separator = " / ";
99 break; 99 break;
100 default: 100 default:
101 ASSERT_NOT_REACHED(); 101 ASSERT_NOT_REACHED();
102 } 102 }
103 103
104 unsigned size = m_values.size(); 104 unsigned size = m_values.size();
105 for (unsigned i = 0; i < size; i++) { 105 for (unsigned i = 0; i < size; i++) {
106 if (!result.isEmpty()) 106 if (!result.isEmpty())
107 result.append(separator); 107 result.append(separator);
108 if (formattingFlag == AlwaysQuoteCSSString && m_values[i]->isPrimitiveVa lue()) 108 result.append(m_values[i]->cssText());
109 result.append(toCSSPrimitiveValue(m_values[i].get())->customCSSText( AlwaysQuoteCSSString));
110 else
111 result.append(m_values[i]->cssText());
112 } 109 }
113 110
114 return result.toString(); 111 return result.toString();
115 } 112 }
116 113
117 bool CSSValueList::equals(const CSSValueList& other) const 114 bool CSSValueList::equals(const CSSValueList& other) const
118 { 115 {
119 return m_valueListSeparator == other.m_valueListSeparator && compareCSSValue Vector(m_values, other.m_values); 116 return m_valueListSeparator == other.m_valueListSeparator && compareCSSValue Vector(m_values, other.m_values);
120 } 117 }
121 118
(...skipping 15 matching lines...) Expand all
137 return false; 134 return false;
138 } 135 }
139 136
140 DEFINE_TRACE_AFTER_DISPATCH(CSSValueList) 137 DEFINE_TRACE_AFTER_DISPATCH(CSSValueList)
141 { 138 {
142 visitor->trace(m_values); 139 visitor->trace(m_values);
143 CSSValue::traceAfterDispatch(visitor); 140 CSSValue::traceAfterDispatch(visitor);
144 } 141 }
145 142
146 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698