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

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: Created 6 years, 6 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 return false; 1605 return false;
1606 // Properties below are validated inside parseViewportProperty, because we 1606 // Properties below are validated inside parseViewportProperty, because we
1607 // check for parser state. We need to invalidate if someone adds them outsid e 1607 // check for parser state. We need to invalidate if someone adds them outsid e
1608 // a @viewport rule. 1608 // a @viewport rule.
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
1616 case CSSPropertyAll:
1617 if (id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnse t) {
1618 validPrimitive = true;
1619 break;
1620 }
1621 return false;
1622
1615 default: 1623 default:
1616 return parseSVGValue(propId, important); 1624 return parseSVGValue(propId, important);
1617 } 1625 }
1618 1626
1619 if (validPrimitive) { 1627 if (validPrimitive) {
1620 parsedValue = parseValidPrimitive(id, value); 1628 parsedValue = parseValidPrimitive(id, value);
1621 m_valueList->next(); 1629 m_valueList->next();
1622 } 1630 }
1623 ASSERT(!m_parsedCalculation); 1631 ASSERT(!m_parsedCalculation);
1624 if (parsedValue) { 1632 if (parsedValue) {
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 if (value->id == CSSValueRunning || value->id == CSSValuePaused) 3074 if (value->id == CSSValueRunning || value->id == CSSValuePaused)
3067 return cssValuePool().createIdentifierValue(value->id); 3075 return cssValuePool().createIdentifierValue(value->id);
3068 return nullptr; 3076 return nullptr;
3069 } 3077 }
3070 3078
3071 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty() 3079 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty()
3072 { 3080 {
3073 CSSParserValue* value = m_valueList->current(); 3081 CSSParserValue* value = m_valueList->current();
3074 if (value->unit != CSSPrimitiveValue::CSS_IDENT) 3082 if (value->unit != CSSPrimitiveValue::CSS_IDENT)
3075 return nullptr; 3083 return nullptr;
3084 // Since all is valid css property keyword, cssPropertyID for all
3085 // returns non-null value. We need to check "all" before
3086 // cssPropertyID check.
3087 if (equalIgnoringCase(value, "all"))
3088 return cssValuePool().createIdentifierValue(CSSValueAll);
3076 CSSPropertyID result = cssPropertyID(value->string); 3089 CSSPropertyID result = cssPropertyID(value->string);
3077 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) 3090 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result))
3078 return cssValuePool().createIdentifierValue(result); 3091 return cssValuePool().createIdentifierValue(result);
3079 if (equalIgnoringCase(value, "all"))
3080 return cssValuePool().createIdentifierValue(CSSValueAll);
3081 if (equalIgnoringCase(value, "none")) 3092 if (equalIgnoringCase(value, "none"))
3082 return cssValuePool().createIdentifierValue(CSSValueNone); 3093 return cssValuePool().createIdentifierValue(CSSValueNone);
3083 return nullptr; 3094 return nullptr;
3084 } 3095 }
3085 3096
3086 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa lue>& value3) 3097 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa lue>& value3)
3087 { 3098 {
3088 parse2ValuesFillPosition(m_valueList.get(), value1, value2); 3099 parse2ValuesFillPosition(m_valueList.get(), value1, value2);
3089 3100
3090 // now get z 3101 // now get z
(...skipping 4080 matching lines...) Expand 10 before | Expand all | Expand 10 after
7171 expectComma = false; 7182 expectComma = false;
7172 m_valueList->next(); 7183 m_valueList->next();
7173 continue; 7184 continue;
7174 } 7185 }
7175 7186
7176 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT) 7187 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT)
7177 return false; 7188 return false;
7178 7189
7179 CSSPropertyID property = cssPropertyID(currentValue->string); 7190 CSSPropertyID property = cssPropertyID(currentValue->string);
7180 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) { 7191 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) {
7181 if (property == CSSPropertyWillChange) 7192 // Now "all" is used by both CSSValue and CSSPropertyValue.
7193 // Need to return false when currentValue is CSSPropertyAll.
7194 if (property == CSSPropertyWillChange || property == CSSPropertyAll)
7182 return false; 7195 return false;
7183 values->append(cssValuePool().createIdentifierValue(property)); 7196 values->append(cssValuePool().createIdentifierValue(property));
7184 } else { 7197 } else {
7185 switch (currentValue->id) { 7198 switch (currentValue->id) {
7186 case CSSValueNone: 7199 case CSSValueNone:
7187 case CSSValueAll: 7200 case CSSValueAll:
7188 case CSSValueAuto: 7201 case CSSValueAuto:
7189 case CSSValueDefault: 7202 case CSSValueDefault:
7190 case CSSValueInitial: 7203 case CSSValueInitial:
7191 case CSSValueInherit: 7204 case CSSValueInherit:
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
8418 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8431 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8419 if (!seenStroke) 8432 if (!seenStroke)
8420 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8433 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8421 if (!seenMarkers) 8434 if (!seenMarkers)
8422 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8435 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8423 8436
8424 return parsedValues.release(); 8437 return parsedValues.release();
8425 } 8438 }
8426 8439
8427 } // namespace WebCore 8440 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698