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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSValuePool.h" | 10 #include "core/css/CSSValuePool.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return nullptr; | 166 return nullptr; |
167 } | 167 } |
168 | 168 |
169 static PassRefPtrWillBeRawPtr<CSSValue> consumeWebkitHighlight(CSSParserTokenRan
ge& range) | 169 static PassRefPtrWillBeRawPtr<CSSValue> consumeWebkitHighlight(CSSParserTokenRan
ge& range) |
170 { | 170 { |
171 if (range.peek().id() == CSSValueNone) | 171 if (range.peek().id() == CSSValueNone) |
172 return consumeIdent(range); | 172 return consumeIdent(range); |
173 return consumeString(range); | 173 return consumeString(range); |
174 } | 174 } |
175 | 175 |
| 176 static PassRefPtrWillBeRawPtr<CSSValue> consumeFontVariantLigatures(CSSParserTok
enRange& range) |
| 177 { |
| 178 if (range.peek().id() == CSSValueNormal) |
| 179 return consumeIdent(range); |
| 180 RefPtrWillBeRawPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceS
eparated(); |
| 181 bool sawCommonLigaturesValue = false; |
| 182 bool sawDiscretionaryLigaturesValue = false; |
| 183 bool sawHistoricalLigaturesValue = false; |
| 184 bool sawContextualLigaturesValue = false; |
| 185 do { |
| 186 CSSValueID id = range.peek().id(); |
| 187 switch (id) { |
| 188 case CSSValueNoCommonLigatures: |
| 189 case CSSValueCommonLigatures: |
| 190 if (sawCommonLigaturesValue) |
| 191 return nullptr; |
| 192 sawCommonLigaturesValue = true; |
| 193 break; |
| 194 case CSSValueNoDiscretionaryLigatures: |
| 195 case CSSValueDiscretionaryLigatures: |
| 196 if (sawDiscretionaryLigaturesValue) |
| 197 return nullptr; |
| 198 sawDiscretionaryLigaturesValue = true; |
| 199 break; |
| 200 case CSSValueNoHistoricalLigatures: |
| 201 case CSSValueHistoricalLigatures: |
| 202 if (sawHistoricalLigaturesValue) |
| 203 return nullptr; |
| 204 sawHistoricalLigaturesValue = true; |
| 205 break; |
| 206 case CSSValueNoContextual: |
| 207 case CSSValueContextual: |
| 208 if (sawContextualLigaturesValue) |
| 209 return nullptr; |
| 210 sawContextualLigaturesValue = true; |
| 211 break; |
| 212 default: |
| 213 return nullptr; |
| 214 } |
| 215 ligatureValues->append(consumeIdent(range)); |
| 216 } while (!range.atEnd()); |
| 217 |
| 218 return ligatureValues.release(); |
| 219 } |
| 220 |
176 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) | 221 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) |
177 { | 222 { |
178 m_range.consumeWhitespace(); | 223 m_range.consumeWhitespace(); |
179 switch (propId) { | 224 switch (propId) { |
180 case CSSPropertyWillChange: | 225 case CSSPropertyWillChange: |
181 return consumeWillChange(m_range); | 226 return consumeWillChange(m_range); |
182 case CSSPropertyPage: | 227 case CSSPropertyPage: |
183 return consumePage(m_range); | 228 return consumePage(m_range); |
184 case CSSPropertyQuotes: | 229 case CSSPropertyQuotes: |
185 return consumeQuotes(m_range); | 230 return consumeQuotes(m_range); |
186 case CSSPropertyWebkitHighlight: | 231 case CSSPropertyWebkitHighlight: |
187 return consumeWebkitHighlight(m_range); | 232 return consumeWebkitHighlight(m_range); |
| 233 case CSSPropertyFontVariantLigatures: |
| 234 return consumeFontVariantLigatures(m_range); |
188 default: | 235 default: |
189 return nullptr; | 236 return nullptr; |
190 } | 237 } |
191 } | 238 } |
192 | 239 |
193 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, bool important) | 240 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, bool important) |
194 { | 241 { |
195 m_range.consumeWhitespace(); | 242 m_range.consumeWhitespace(); |
196 switch (propId) { | 243 switch (propId) { |
197 case CSSPropertyWebkitMarginCollapse: { | 244 case CSSPropertyWebkitMarginCollapse: { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); | 278 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); |
232 addProperty(CSSPropertyOverflowY, overflowYValue.release(), important); | 279 addProperty(CSSPropertyOverflowY, overflowYValue.release(), important); |
233 return true; | 280 return true; |
234 } | 281 } |
235 default: | 282 default: |
236 return false; | 283 return false; |
237 } | 284 } |
238 } | 285 } |
239 | 286 |
240 } // namespace blink | 287 } // namespace blink |
OLD | NEW |