OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF
::equalIgnoringCase(b, a.characters16(), length); | 78 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF
::equalIgnoringCase(b, a.characters16(), length); |
79 } | 79 } |
80 | 80 |
81 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe
fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent
icalValues) | 81 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe
fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent
icalValues) |
82 { | 82 { |
83 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); | 83 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); |
84 } | 84 } |
85 | 85 |
86 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, | 86 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, |
87 const CSSParserContext& context, bool inViewport, | 87 const CSSParserContext& context, WillBeHeapVector<CSSProperty, 256>& parsedP
roperties, |
88 WillBeHeapVector<CSSProperty, 256>& parsedProperties, | |
89 StyleRule::Type ruleType) | 88 StyleRule::Type ruleType) |
90 : m_valueList(valueList) | 89 : m_valueList(valueList) |
91 , m_context(context) | 90 , m_context(context) |
92 , m_inViewport(inViewport) | |
93 , m_parsedProperties(parsedProperties) | 91 , m_parsedProperties(parsedProperties) |
94 , m_ruleType(ruleType) | 92 , m_ruleType(ruleType) |
95 , m_inParseShorthand(0) | 93 , m_inParseShorthand(0) |
96 , m_currentShorthand(CSSPropertyInvalid) | 94 , m_currentShorthand(CSSPropertyInvalid) |
97 , m_implicitShorthand(false) | 95 , m_implicitShorthand(false) |
98 { | 96 { |
99 } | 97 } |
100 | 98 |
101 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ant, | 99 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ant, |
102 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp
ort, | 100 CSSParserValueList* valueList, const CSSParserContext& context, |
103 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy
pe) | 101 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy
pe) |
104 { | 102 { |
105 int parsedPropertiesSize = parsedProperties.size(); | 103 int parsedPropertiesSize = parsedProperties.size(); |
106 | 104 |
107 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r
uleType); | 105 CSSPropertyParser parser(valueList, context, parsedProperties, ruleType); |
108 bool parseSuccess = parser.parseValue(unresolvedProperty, important); | 106 bool parseSuccess = parser.parseValue(unresolvedProperty, important); |
109 | 107 |
110 // This doesn't count UA style sheets | 108 // This doesn't count UA style sheets |
111 if (parseSuccess && context.useCounter()) | 109 if (parseSuccess && context.useCounter()) |
112 context.useCounter()->count(context, unresolvedProperty); | 110 context.useCounter()->count(context, unresolvedProperty); |
113 | 111 |
114 if (!parseSuccess) | 112 if (!parseSuccess) |
115 parser.rollbackLastProperties(parsedProperties.size() - parsedProperties
Size); | 113 parser.rollbackLastProperties(parsedProperties.size() - parsedProperties
Size); |
116 | 114 |
117 return parseSuccess; | 115 return parseSuccess; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 CSSPropertyID propId = resolveCSSPropertyID(unresolvedProperty); | 410 CSSPropertyID propId = resolveCSSPropertyID(unresolvedProperty); |
413 | 411 |
414 if (!m_valueList) | 412 if (!m_valueList) |
415 return false; | 413 return false; |
416 | 414 |
417 CSSParserValue* value = m_valueList->current(); | 415 CSSParserValue* value = m_valueList->current(); |
418 | 416 |
419 if (!value) | 417 if (!value) |
420 return false; | 418 return false; |
421 | 419 |
422 if (inViewport()) { | 420 if (m_ruleType == StyleRule::Viewport) { |
423 // Allow @viewport rules from UA stylesheets even if the feature is disa
bled. | 421 // Allow @viewport rules from UA stylesheets even if the feature is disa
bled. |
424 if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(
m_context.mode())) | 422 if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(
m_context.mode())) |
425 return false; | 423 return false; |
426 | 424 |
427 return parseViewportProperty(propId, important); | 425 return parseViewportProperty(propId, important); |
428 } | 426 } |
429 if (m_ruleType == StyleRule::FontFace) { | 427 if (m_ruleType == StyleRule::FontFace) { |
430 if (important) | 428 if (important) |
431 return false; | 429 return false; |
432 return parseFontFaceDescriptor(propId); | 430 return parseFontFaceDescriptor(propId); |
(...skipping 8033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8466 } | 8464 } |
8467 } | 8465 } |
8468 | 8466 |
8469 if (!list->length()) | 8467 if (!list->length()) |
8470 return nullptr; | 8468 return nullptr; |
8471 | 8469 |
8472 return list.release(); | 8470 return list.release(); |
8473 } | 8471 } |
8474 | 8472 |
8475 } // namespace blink | 8473 } // namespace blink |
OLD | NEW |