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

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

Issue 645033004: Move rolling back badly parsed property to CSSPropertyParser::parseValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/css/parser/CSSGrammar.y ('k') | no next file » | 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 , m_inParseShorthand(0) 113 , m_inParseShorthand(0)
114 , m_currentShorthand(CSSPropertyInvalid) 114 , m_currentShorthand(CSSPropertyInvalid)
115 , m_implicitShorthand(false) 115 , m_implicitShorthand(false)
116 { 116 {
117 } 117 }
118 118
119 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, 119 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important,
120 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort, 120 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort,
121 WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Typ e ruleType) 121 WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Typ e ruleType)
122 { 122 {
123 int parsedPropertiesSize = parsedProperties.size();
124
123 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType); 125 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType);
124 bool parseSuccess = parser.parseValue(property, important); 126 bool parseSuccess = parser.parseValue(property, important);
125 127
126 // This doesn't count UA style sheets 128 // This doesn't count UA style sheets
127 if (parseSuccess && context.useCounter()) 129 if (parseSuccess && context.useCounter())
128 context.useCounter()->count(context, property); 130 context.useCounter()->count(context, property);
129 131
132 if (!parseSuccess)
133 parser.rollbackLastProperties(parsedProperties.size() - parsedProperties Size);
134
130 return parseSuccess; 135 return parseSuccess;
131 } 136 }
132 137
133 void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, Pa ssRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit) 138 void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, Pa ssRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit)
134 { 139 {
135 RefPtrWillBeRawPtr<CSSValue> val = value.get(); 140 RefPtrWillBeRawPtr<CSSValue> val = value.get();
136 addProperty(propId, value, important, implicit); 141 addProperty(propId, value, important, implicit);
137 142
138 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId); 143 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId);
139 if (prefixingVariant == propId) 144 if (prefixingVariant == propId)
(...skipping 8201 matching lines...) Expand 10 before | Expand all | Expand 10 after
8341 return nullptr; 8346 return nullptr;
8342 a = args->next(); 8347 a = args->next();
8343 8348
8344 argNumber++; 8349 argNumber++;
8345 } 8350 }
8346 8351
8347 return transformValue.release(); 8352 return transformValue.release();
8348 } 8353 }
8349 8354
8350 } // namespace blink 8355 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSGrammar.y ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698