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

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 ASSERT_NOT_REACH in linux_blink_dbg Created 6 years, 7 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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 return false; 1634 return false;
1635 // Properties below are validated inside parseViewportProperty, because we 1635 // Properties below are validated inside parseViewportProperty, because we
1636 // check for parser state. We need to invalidate if someone adds them outsid e 1636 // check for parser state. We need to invalidate if someone adds them outsid e
1637 // a @viewport rule. 1637 // a @viewport rule.
1638 case CSSPropertyMaxZoom: 1638 case CSSPropertyMaxZoom:
1639 case CSSPropertyMinZoom: 1639 case CSSPropertyMinZoom:
1640 case CSSPropertyOrientation: 1640 case CSSPropertyOrientation:
1641 case CSSPropertyUserZoom: 1641 case CSSPropertyUserZoom:
1642 validPrimitive = false; 1642 validPrimitive = false;
1643 break; 1643 break;
1644
1645 case CSSPropertyAll:
1646 if (id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnse t) {
1647 validPrimitive = true;
1648 break;
1649 }
1650 return false;
1651
1644 default: 1652 default:
1645 return parseSVGValue(propId, important); 1653 return parseSVGValue(propId, important);
1646 } 1654 }
1647 1655
1648 if (validPrimitive) { 1656 if (validPrimitive) {
1649 parsedValue = parseValidPrimitive(id, value); 1657 parsedValue = parseValidPrimitive(id, value);
1650 m_valueList->next(); 1658 m_valueList->next();
1651 } 1659 }
1652 ASSERT(!m_parsedCalculation); 1660 ASSERT(!m_parsedCalculation);
1653 if (parsedValue) { 1661 if (parsedValue) {
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 if (value->id == CSSValueRunning || value->id == CSSValuePaused) 3119 if (value->id == CSSValueRunning || value->id == CSSValuePaused)
3112 return cssValuePool().createIdentifierValue(value->id); 3120 return cssValuePool().createIdentifierValue(value->id);
3113 return nullptr; 3121 return nullptr;
3114 } 3122 }
3115 3123
3116 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima tionParseContext& context) 3124 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima tionParseContext& context)
3117 { 3125 {
3118 CSSParserValue* value = m_valueList->current(); 3126 CSSParserValue* value = m_valueList->current();
3119 if (value->unit != CSSPrimitiveValue::CSS_IDENT) 3127 if (value->unit != CSSPrimitiveValue::CSS_IDENT)
3120 return nullptr; 3128 return nullptr;
3129 // Since all is valid css property keyword, cssPropertyID for all
3130 // returns non-null value. We need to check "all" before
3131 // cssPropertyID check.
3132 if (equalIgnoringCase(value, "all"))
3133 return cssValuePool().createIdentifierValue(CSSValueAll);
3121 CSSPropertyID result = cssPropertyID(value->string); 3134 CSSPropertyID result = cssPropertyID(value->string);
3122 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) 3135 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result))
3123 return cssValuePool().createIdentifierValue(result); 3136 return cssValuePool().createIdentifierValue(result);
3124 if (equalIgnoringCase(value, "all"))
3125 return cssValuePool().createIdentifierValue(CSSValueAll);
3126 if (equalIgnoringCase(value, "none")) { 3137 if (equalIgnoringCase(value, "none")) {
3127 context.commitAnimationPropertyKeyword(); 3138 context.commitAnimationPropertyKeyword();
3128 return cssValuePool().createIdentifierValue(CSSValueNone); 3139 return cssValuePool().createIdentifierValue(CSSValueNone);
3129 } 3140 }
3130 return nullptr; 3141 return nullptr;
3131 } 3142 }
3132 3143
3133 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa lue>& value3) 3144 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa lue>& value3)
3134 { 3145 {
3135 parse2ValuesFillPosition(m_valueList.get(), value1, value2); 3146 parse2ValuesFillPosition(m_valueList.get(), value1, value2);
(...skipping 4123 matching lines...) Expand 10 before | Expand all | Expand 10 after
7259 expectComma = false; 7270 expectComma = false;
7260 m_valueList->next(); 7271 m_valueList->next();
7261 continue; 7272 continue;
7262 } 7273 }
7263 7274
7264 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT) 7275 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT)
7265 return false; 7276 return false;
7266 7277
7267 CSSPropertyID property = cssPropertyID(currentValue->string); 7278 CSSPropertyID property = cssPropertyID(currentValue->string);
7268 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) { 7279 if (property && RuntimeCSSEnabled::isCSSPropertyEnabled(property)) {
7269 if (property == CSSPropertyWillChange) 7280 // Now "all" is used by both CSSValue and CSSPropertyValue.
7281 // Need to return false when currentValue is CSSPropertyAll.
7282 if (property == CSSPropertyWillChange || property == CSSPropertyAll)
esprehn 2014/05/30 00:59:22 Does the spec say that will-change: all doesn't wo
tasak 2014/06/04 09:37:41 I looked at the below "swith~case" and found that
7270 return false; 7283 return false;
7271 values->append(cssValuePool().createIdentifierValue(property)); 7284 values->append(cssValuePool().createIdentifierValue(property));
7272 } else { 7285 } else {
7273 switch (currentValue->id) { 7286 switch (currentValue->id) {
7274 case CSSValueNone: 7287 case CSSValueNone:
7275 case CSSValueAll: 7288 case CSSValueAll:
7276 case CSSValueAuto: 7289 case CSSValueAuto:
7277 case CSSValueDefault: 7290 case CSSValueDefault:
7278 case CSSValueInitial: 7291 case CSSValueInitial:
7279 case CSSValueInherit: 7292 case CSSValueInherit:
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
8506 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8519 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8507 if (!seenStroke) 8520 if (!seenStroke)
8508 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8521 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8509 if (!seenMarkers) 8522 if (!seenMarkers)
8510 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8523 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8511 8524
8512 return parsedValues.release(); 8525 return parsedValues.release();
8513 } 8526 }
8514 8527
8515 } // namespace WebCore 8528 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698