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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 216803002: Implement all shorthand property. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed parseAnimationProperty Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 case CSSPropertyMaxZoom: 1609 case CSSPropertyMaxZoom:
1610 case CSSPropertyMinZoom: 1610 case CSSPropertyMinZoom:
1611 case CSSPropertyOrientation: 1611 case CSSPropertyOrientation:
1612 case CSSPropertyUserZoom: 1612 case CSSPropertyUserZoom:
1613 validPrimitive = false; 1613 validPrimitive = false;
1614 break; 1614 break;
1615 // FIXME: crbug.com/154772 Unimplemented css-transforms properties 1615 // FIXME: crbug.com/154772 Unimplemented css-transforms properties
1616 case CSSPropertyPerspectiveOrigin: 1616 case CSSPropertyPerspectiveOrigin:
1617 case CSSPropertyTransformOrigin: 1617 case CSSPropertyTransformOrigin:
1618 return false; 1618 return false;
1619
1620 case CSSPropertyAll:
1621 // FIXME: need to add CSSValueUnset here.
1622 if (id == CSSValueInitial || id == CSSValueInherit) {
1623 validPrimitive = true;
1624 break;
1625 }
1626 return false;
1627
1619 default: 1628 default:
1620 return parseSVGValue(propId, important); 1629 return parseSVGValue(propId, important);
1621 } 1630 }
1622 1631
1623 if (validPrimitive) { 1632 if (validPrimitive) {
1624 parsedValue = parseValidPrimitive(id, value); 1633 parsedValue = parseValidPrimitive(id, value);
1625 m_valueList->next(); 1634 m_valueList->next();
1626 } 1635 }
1627 ASSERT(!m_parsedCalculation); 1636 ASSERT(!m_parsedCalculation);
1628 if (parsedValue) { 1637 if (parsedValue) {
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 if (value->id == CSSValueRunning || value->id == CSSValuePaused) 3091 if (value->id == CSSValueRunning || value->id == CSSValuePaused)
3083 return cssValuePool().createIdentifierValue(value->id); 3092 return cssValuePool().createIdentifierValue(value->id);
3084 return nullptr; 3093 return nullptr;
3085 } 3094 }
3086 3095
3087 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima tionParseContext& context) 3096 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima tionParseContext& context)
3088 { 3097 {
3089 CSSParserValue* value = m_valueList->current(); 3098 CSSParserValue* value = m_valueList->current();
3090 if (value->unit != CSSPrimitiveValue::CSS_IDENT) 3099 if (value->unit != CSSPrimitiveValue::CSS_IDENT)
3091 return nullptr; 3100 return nullptr;
3092 CSSPropertyID result = cssPropertyID(value->string); 3101 // We should treat "all" as CSSValue here.
3093 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result))
3094 return cssValuePool().createIdentifierValue(result);
3095 if (equalIgnoringCase(value, "all")) { 3102 if (equalIgnoringCase(value, "all")) {
3096 context.sawAnimationPropertyKeyword(); 3103 context.sawAnimationPropertyKeyword();
3097 return cssValuePool().createIdentifierValue(CSSValueAll); 3104 return cssValuePool().createIdentifierValue(CSSValueAll);
3098 } 3105 }
3106 CSSPropertyID result = cssPropertyID(value->string);
3107 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result))
3108 return cssValuePool().createIdentifierValue(result);
3099 if (equalIgnoringCase(value, "none")) { 3109 if (equalIgnoringCase(value, "none")) {
3100 context.commitAnimationPropertyKeyword(); 3110 context.commitAnimationPropertyKeyword();
3101 context.sawAnimationPropertyKeyword(); 3111 context.sawAnimationPropertyKeyword();
3102 return cssValuePool().createIdentifierValue(CSSValueNone); 3112 return cssValuePool().createIdentifierValue(CSSValueNone);
3103 } 3113 }
3104 return nullptr; 3114 return nullptr;
3105 } 3115 }
3106 3116
3107 bool CSSPropertyParser::parseTransformOriginShorthand(RefPtrWillBeRawPtr<CSSValu e>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSValue>& value3) 3117 bool CSSPropertyParser::parseTransformOriginShorthand(RefPtrWillBeRawPtr<CSSValu e>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSValue>& value3)
3108 { 3118 {
(...skipping 3917 matching lines...) Expand 10 before | Expand all | Expand 10 after
7026 expectComma = false; 7036 expectComma = false;
7027 m_valueList->next(); 7037 m_valueList->next();
7028 continue; 7038 continue;
7029 } 7039 }
7030 7040
7031 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT) 7041 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT)
7032 return false; 7042 return false;
7033 7043
7034 CSSPropertyID property = cssPropertyID(currentValue->string); 7044 CSSPropertyID property = cssPropertyID(currentValue->string);
7035 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) { 7045 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) {
7036 if (property == CSSPropertyWillChange) 7046 // Now "all" is used by both CSSValue and CSSPropertyValue.
7047 // Need to return false when currentValue is CSSPropertyAll.
7048 if (property == CSSPropertyWillChange || property == CSSPropertyAll)
7037 return false; 7049 return false;
7038 values->append(cssValuePool().createIdentifierValue(property)); 7050 values->append(cssValuePool().createIdentifierValue(property));
7039 } else { 7051 } else {
7040 switch (currentValue->id) { 7052 switch (currentValue->id) {
7041 case CSSValueNone: 7053 case CSSValueNone:
7042 case CSSValueAll: 7054 case CSSValueAll:
7043 case CSSValueAuto: 7055 case CSSValueAuto:
7044 case CSSValueDefault: 7056 case CSSValueDefault:
7045 case CSSValueInitial: 7057 case CSSValueInitial:
7046 case CSSValueInherit: 7058 case CSSValueInherit:
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
8241 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8253 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8242 if (!seenStroke) 8254 if (!seenStroke)
8243 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8255 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8244 if (!seenMarkers) 8256 if (!seenMarkers)
8245 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8257 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8246 8258
8247 return parsedValues.release(); 8259 return parsedValues.release();
8248 } 8260 }
8249 8261
8250 } // namespace WebCore 8262 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698