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

Side by Side Diff: Source/core/css/CSSParser-in.cpp

Issue 23011009: Implement computed style for animation shorthand and align parsing with the spec. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test modified according to Tab's comments Created 7 years, 4 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
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSShorthands.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 lval = list; 3082 lval = list;
3083 } 3083 }
3084 } 3084 }
3085 else 3085 else
3086 lval = rval; 3086 lval = rval;
3087 } 3087 }
3088 3088
3089 bool CSSParser::parseAnimationShorthand(CSSPropertyID propId, bool important) 3089 bool CSSParser::parseAnimationShorthand(CSSPropertyID propId, bool important)
3090 { 3090 {
3091 const StylePropertyShorthand& animationProperties = parsingShorthandForPrope rty(propId); 3091 const StylePropertyShorthand& animationProperties = parsingShorthandForPrope rty(propId);
3092 const unsigned numProperties = 7; 3092 const unsigned numProperties = 8;
3093 3093
3094 // The list of properties in the shorthand should be the same 3094 // The list of properties in the shorthand should be the same
3095 // length as the list with animation name in last position, even though they are 3095 // length as the list with animation name in last position, even though they are
3096 // in a different order. 3096 // in a different order.
3097 ASSERT(numProperties == animationProperties.length()); 3097 ASSERT(numProperties == animationProperties.length());
3098 ASSERT(numProperties == shorthandForProperty(propId).length()); 3098 ASSERT(numProperties == shorthandForProperty(propId).length());
3099 3099
3100 ShorthandScope scope(this, propId); 3100 ShorthandScope scope(this, propId);
3101 3101
3102 bool parsedProperty[numProperties] = { false }; 3102 bool parsedProperty[numProperties] = { false };
(...skipping 19 matching lines...) Expand all
3122 bool found = false; 3122 bool found = false;
3123 for (i = 0; i < numProperties; ++i) { 3123 for (i = 0; i < numProperties; ++i) {
3124 if (!parsedProperty[i]) { 3124 if (!parsedProperty[i]) {
3125 RefPtr<CSSValue> val; 3125 RefPtr<CSSValue> val;
3126 if (parseAnimationProperty(animationProperties.properties()[i], val, context)) { 3126 if (parseAnimationProperty(animationProperties.properties()[i], val, context)) {
3127 parsedProperty[i] = found = true; 3127 parsedProperty[i] = found = true;
3128 addAnimationValue(values[i], val.release()); 3128 addAnimationValue(values[i], val.release());
3129 break; 3129 break;
3130 } 3130 }
3131 } 3131 }
3132
3133 // There are more values to process but 'none' or 'all' were already defined as the animation property, the declaration becomes invalid.
3134 if (!context.animationPropertyKeywordAllowed() && context.hasCommitt edFirstAnimation())
3135 return false;
3136 } 3132 }
3137 3133
3138 // if we didn't find at least one match, this is an 3134 // if we didn't find at least one match, this is an
3139 // invalid shorthand and we have to ignore it 3135 // invalid shorthand and we have to ignore it
3140 if (!found) 3136 if (!found)
3141 return false; 3137 return false;
3142 } 3138 }
3143 3139
3144 for (i = 0; i < numProperties; ++i) { 3140 for (i = 0; i < numProperties; ++i) {
3145 // If we didn't find the property, set an intial value. 3141 // If we didn't find the property, set an intial value.
(...skipping 8798 matching lines...) Expand 10 before | Expand all | Expand 10 after
11944 { 11940 {
11945 // The tokenizer checks for the construct of an+b. 11941 // The tokenizer checks for the construct of an+b.
11946 // However, since the {ident} rule precedes the {nth} rule, some of those 11942 // However, since the {ident} rule precedes the {nth} rule, some of those
11947 // tokens are identified as string literal. Furthermore we need to accept 11943 // tokens are identified as string literal. Furthermore we need to accept
11948 // "odd" and "even" which does not match to an+b. 11944 // "odd" and "even" which does not match to an+b.
11949 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11945 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11950 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11946 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11951 } 11947 }
11952 11948
11953 } 11949 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSShorthands.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698