| 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/CSSCustomIdentValue.h" |
| 10 #include "core/css/CSSFontFaceSrcValue.h" | 11 #include "core/css/CSSFontFaceSrcValue.h" |
| 11 #include "core/css/CSSFontFeatureValue.h" | 12 #include "core/css/CSSFontFeatureValue.h" |
| 12 #include "core/css/CSSPrimitiveValueMappings.h" | 13 #include "core/css/CSSPrimitiveValueMappings.h" |
| 14 #include "core/css/CSSStringValue.h" |
| 15 #include "core/css/CSSURIValue.h" |
| 13 #include "core/css/CSSUnicodeRangeValue.h" | 16 #include "core/css/CSSUnicodeRangeValue.h" |
| 14 #include "core/css/CSSValuePool.h" | 17 #include "core/css/CSSValuePool.h" |
| 15 #include "core/css/FontFace.h" | 18 #include "core/css/FontFace.h" |
| 16 #include "core/css/parser/CSSParserFastPaths.h" | 19 #include "core/css/parser/CSSParserFastPaths.h" |
| 17 #include "core/css/parser/CSSParserValues.h" | 20 #include "core/css/parser/CSSParserValues.h" |
| 18 #include "core/frame/UseCounter.h" | 21 #include "core/frame/UseCounter.h" |
| 19 #include "core/layout/LayoutTheme.h" | 22 #include "core/layout/LayoutTheme.h" |
| 20 #include "wtf/text/StringBuilder.h" | 23 #include "wtf/text/StringBuilder.h" |
| 21 | 24 |
| 22 namespace blink { | 25 namespace blink { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return true; | 79 return true; |
| 77 } | 80 } |
| 78 | 81 |
| 79 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeIdent(CSSParserTokenRang
e& range) | 82 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeIdent(CSSParserTokenRang
e& range) |
| 80 { | 83 { |
| 81 if (range.peek().type() != IdentToken) | 84 if (range.peek().type() != IdentToken) |
| 82 return nullptr; | 85 return nullptr; |
| 83 return cssValuePool().createIdentifierValue(range.consumeIncludingWhitespace
().id()); | 86 return cssValuePool().createIdentifierValue(range.consumeIncludingWhitespace
().id()); |
| 84 } | 87 } |
| 85 | 88 |
| 86 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeCustomIdent(CSSParserTok
enRange& range) | 89 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> consumeCustomIdent(CSSParserT
okenRange& range) |
| 87 { | 90 { |
| 88 if (range.peek().type() != IdentToken) | 91 if (range.peek().type() != IdentToken) |
| 89 return nullptr; | 92 return nullptr; |
| 90 return cssValuePool().createValue(range.consumeIncludingWhitespace().value()
, CSSPrimitiveValue::UnitType::CustomIdentifier); | 93 return CSSCustomIdentValue::create(range.consumeIncludingWhitespace().value(
)); |
| 91 } | 94 } |
| 92 | 95 |
| 93 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeString(CSSParserTokenRan
ge& range) | 96 static PassRefPtrWillBeRawPtr<CSSStringValue> consumeString(CSSParserTokenRange&
range) |
| 94 { | 97 { |
| 95 if (range.peek().type() != StringToken) | 98 if (range.peek().type() != StringToken) |
| 96 return nullptr; | 99 return nullptr; |
| 97 return cssValuePool().createValue(range.consumeIncludingWhitespace().value()
, CSSPrimitiveValue::UnitType::String); | 100 return CSSStringValue::create(range.consumeIncludingWhitespace().value()); |
| 98 } | 101 } |
| 99 | 102 |
| 100 static String consumeUrl(CSSParserTokenRange& range) | 103 static String consumeUrl(CSSParserTokenRange& range) |
| 101 { | 104 { |
| 102 const CSSParserToken& token = range.peek(); | 105 const CSSParserToken& token = range.peek(); |
| 103 if (token.type() == UrlToken) { | 106 if (token.type() == UrlToken) { |
| 104 range.consumeIncludingWhitespace(); | 107 range.consumeIncludingWhitespace(); |
| 105 return token.value(); | 108 return token.value(); |
| 106 } | 109 } |
| 107 if (token.functionId() == CSSValueUrl) { | 110 if (token.functionId() == CSSValueUrl) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat
ed(); | 392 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat
ed(); |
| 390 do { | 393 do { |
| 391 RefPtrWillBeRawPtr<CSSFontFeatureValue> fontFeatureValue = consumeFontFe
atureTag(range); | 394 RefPtrWillBeRawPtr<CSSFontFeatureValue> fontFeatureValue = consumeFontFe
atureTag(range); |
| 392 if (!fontFeatureValue) | 395 if (!fontFeatureValue) |
| 393 return nullptr; | 396 return nullptr; |
| 394 settings->append(fontFeatureValue); | 397 settings->append(fontFeatureValue); |
| 395 } while (consumeCommaIncludingWhitespace(range)); | 398 } while (consumeCommaIncludingWhitespace(range)); |
| 396 return settings.release(); | 399 return settings.release(); |
| 397 } | 400 } |
| 398 | 401 |
| 399 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumePage(CSSParserTokenRange
& range) | 402 static PassRefPtrWillBeRawPtr<CSSValue> consumePage(CSSParserTokenRange& range) |
| 400 { | 403 { |
| 401 if (range.peek().id() == CSSValueAuto) | 404 if (range.peek().id() == CSSValueAuto) |
| 402 return consumeIdent(range); | 405 return consumeIdent(range); |
| 403 return consumeCustomIdent(range); | 406 return consumeCustomIdent(range); |
| 404 } | 407 } |
| 405 | 408 |
| 406 static PassRefPtrWillBeRawPtr<CSSValue> consumeQuotes(CSSParserTokenRange& range
) | 409 static PassRefPtrWillBeRawPtr<CSSValue> consumeQuotes(CSSParserTokenRange& range
) |
| 407 { | 410 { |
| 408 if (range.peek().id() == CSSValueNone) | 411 if (range.peek().id() == CSSValueNone) |
| 409 return consumeIdent(range); | 412 return consumeIdent(range); |
| 410 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 413 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
| 411 while (!range.atEnd()) { | 414 while (!range.atEnd()) { |
| 412 RefPtrWillBeRawPtr<CSSValue> parsedValue = consumeString(range); | 415 RefPtrWillBeRawPtr<CSSStringValue> parsedValue = consumeString(range); |
| 413 if (!parsedValue) | 416 if (!parsedValue) |
| 414 return nullptr; | 417 return nullptr; |
| 415 values->append(parsedValue.release()); | 418 values->append(parsedValue.release()); |
| 416 } | 419 } |
| 417 if (values->length() && values->length() % 2 == 0) | 420 if (values->length() && values->length() % 2 == 0) |
| 418 return values.release(); | 421 return values.release(); |
| 419 return nullptr; | 422 return nullptr; |
| 420 } | 423 } |
| 421 | 424 |
| 422 static PassRefPtrWillBeRawPtr<CSSValue> consumeWebkitHighlight(CSSParserTokenRan
ge& range) | 425 static PassRefPtrWillBeRawPtr<CSSValue> consumeWebkitHighlight(CSSParserTokenRan
ge& range) |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 return consumeSystemFont(important); | 941 return consumeSystemFont(important); |
| 939 return consumeFont(important); | 942 return consumeFont(important); |
| 940 } | 943 } |
| 941 default: | 944 default: |
| 942 m_currentShorthand = oldShorthand; | 945 m_currentShorthand = oldShorthand; |
| 943 return false; | 946 return false; |
| 944 } | 947 } |
| 945 } | 948 } |
| 946 | 949 |
| 947 } // namespace blink | 950 } // namespace blink |
| OLD | NEW |