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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1408 } | 1408 } |
1409 | 1409 |
1410 void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr <CSSValue> value, bool important, bool implicit) | 1410 void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr <CSSValue> value, bool important, bool implicit) |
1411 { | 1411 { |
1412 RefPtr<CSSValue> val = value.get(); | 1412 RefPtr<CSSValue> val = value.get(); |
1413 addProperty(propId, value, important, implicit); | 1413 addProperty(propId, value, important, implicit); |
1414 | 1414 |
1415 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId); | 1415 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId); |
1416 if (prefixingVariant == propId) | 1416 if (prefixingVariant == propId) |
1417 return; | 1417 return; |
1418 addProperty(prefixingVariant, val.release(), important, implicit); | 1418 |
1419 if (m_currentShorthand) { | |
1420 // We can't use ShorthandScope here as we can already be inside one (e.g we are parsing CSSTransition). | |
1421 m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); | |
1422 addProperty(prefixingVariant, val.release(), important, implicit); | |
1423 m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); | |
Julien - ping for review
2013/06/10 23:29:57
Do we really need to reset m_currentShorthand befo
| |
1424 } else { | |
1425 addProperty(prefixingVariant, val.release(), important, implicit); | |
1426 } | |
1419 } | 1427 } |
1420 | 1428 |
1421 void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bo ol important, bool implicit) | 1429 void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bo ol important, bool implicit) |
1422 { | 1430 { |
1423 m_parsedProperties.append(CSSProperty(propId, value, important, m_currentSho rthand, m_implicitShorthand || implicit)); | 1431 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimiti veValue(value.get()) : 0; |
1432 // This property doesn't belong to a shorthand or is a CSS variable (which w ill be resolved later). | |
1433 if (!m_currentShorthand || (primitiveValue && primitiveValue->isVariableName ())) { | |
1434 m_parsedProperties.append(CSSProperty(propId, value, important, false, C SSPropertyInvalid, m_implicitShorthand || implicit)); | |
1435 return; | |
1436 } | |
1437 | |
1438 const Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLongh and(propId); | |
1439 // The longhand does not belong to multiple shorthands. | |
1440 if (shorthands.size() == 1) | |
1441 m_parsedProperties.append(CSSProperty(propId, value, important, true, CS SPropertyInvalid, m_implicitShorthand || implicit)); | |
1442 else | |
1443 m_parsedProperties.append(CSSProperty(propId, value, important, true, in dexOfShorthandForLonghand(m_currentShorthand, shorthands), m_implicitShorthand | | implicit)); | |
1424 } | 1444 } |
1425 | 1445 |
1426 void CSSParser::rollbackLastProperties(int num) | 1446 void CSSParser::rollbackLastProperties(int num) |
1427 { | 1447 { |
1428 ASSERT(num >= 0); | 1448 ASSERT(num >= 0); |
1429 ASSERT(m_parsedProperties.size() >= static_cast<unsigned>(num)); | 1449 ASSERT(m_parsedProperties.size() >= static_cast<unsigned>(num)); |
1430 m_parsedProperties.shrink(m_parsedProperties.size() - num); | 1450 m_parsedProperties.shrink(m_parsedProperties.size() - num); |
1431 } | 1451 } |
1432 | 1452 |
1433 void CSSParser::clearProperties() | 1453 void CSSParser::clearProperties() |
(...skipping 10376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11810 { | 11830 { |
11811 // The tokenizer checks for the construct of an+b. | 11831 // The tokenizer checks for the construct of an+b. |
11812 // However, since the {ident} rule precedes the {nth} rule, some of those | 11832 // However, since the {ident} rule precedes the {nth} rule, some of those |
11813 // tokens are identified as string literal. Furthermore we need to accept | 11833 // tokens are identified as string literal. Furthermore we need to accept |
11814 // "odd" and "even" which does not match to an+b. | 11834 // "odd" and "even" which does not match to an+b. |
11815 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11835 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11816 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11836 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11817 } | 11837 } |
11818 | 11838 |
11819 } | 11839 } |
OLD | NEW |