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

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

Issue 1441233006: Move remaining SVG properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests for opacity+percentage combination Created 5 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSPropertyParser.h" 6 #include "core/css/parser/CSSPropertyParser.h"
7 7
8 #include "core/StylePropertyShorthand.h" 8 #include "core/StylePropertyShorthand.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/CSSCustomIdentValue.h" 10 #include "core/css/CSSCustomIdentValue.h"
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 RefPtrWillBeRawPtr<CSSValueList> dashes = CSSValueList::createCommaSeparated (); 2089 RefPtrWillBeRawPtr<CSSValueList> dashes = CSSValueList::createCommaSeparated ();
2090 do { 2090 do {
2091 RefPtrWillBeRawPtr<CSSPrimitiveValue> dash = consumeLengthOrPercent(rang e, SVGAttributeMode, ValueRangeNonNegative, UnitlessQuirk::Allow); 2091 RefPtrWillBeRawPtr<CSSPrimitiveValue> dash = consumeLengthOrPercent(rang e, SVGAttributeMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
2092 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) 2092 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd()))
2093 return nullptr; 2093 return nullptr;
2094 dashes->append(dash.release()); 2094 dashes->append(dash.release());
2095 } while (!range.atEnd()); 2095 } while (!range.atEnd());
2096 return dashes.release(); 2096 return dashes.release();
2097 } 2097 }
2098 2098
2099 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeBaselineShift(CSSParserT okenRange& range)
2100 {
2101 CSSValueID id = range.peek().id();
2102 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper)
2103 return consumeIdent(range);
2104 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll, Unitle ssQuirk::Forbid);
2105 }
2106
2099 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) 2107 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty)
2100 { 2108 {
2101 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 2109 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
2102 switch (property) { 2110 switch (property) {
2103 case CSSPropertyWillChange: 2111 case CSSPropertyWillChange:
2104 return consumeWillChange(m_range); 2112 return consumeWillChange(m_range);
2105 case CSSPropertyPage: 2113 case CSSPropertyPage:
2106 return consumePage(m_range); 2114 return consumePage(m_range);
2107 case CSSPropertyQuotes: 2115 case CSSPropertyQuotes:
2108 return consumeQuotes(m_range); 2116 return consumeQuotes(m_range);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 case CSSPropertyTransform: 2275 case CSSPropertyTransform:
2268 return consumeTransform(m_range, m_context.mode(), unresolvedProperty == CSSPropertyAliasWebkitTransform); 2276 return consumeTransform(m_range, m_context.mode(), unresolvedProperty == CSSPropertyAliasWebkitTransform);
2269 case CSSPropertyFill: 2277 case CSSPropertyFill:
2270 case CSSPropertyStroke: 2278 case CSSPropertyStroke:
2271 return consumePaint(m_range, m_context); 2279 return consumePaint(m_range, m_context);
2272 case CSSPropertyPaintOrder: 2280 case CSSPropertyPaintOrder:
2273 return consumePaintOrder(m_range); 2281 return consumePaintOrder(m_range);
2274 case CSSPropertyMarkerStart: 2282 case CSSPropertyMarkerStart:
2275 case CSSPropertyMarkerMid: 2283 case CSSPropertyMarkerMid:
2276 case CSSPropertyMarkerEnd: 2284 case CSSPropertyMarkerEnd:
2285 case CSSPropertyClipPath:
2286 case CSSPropertyFilter:
2287 case CSSPropertyMask:
2277 return consumeNoneOrURI(m_range); 2288 return consumeNoneOrURI(m_range);
2278 case CSSPropertyFlexBasis: 2289 case CSSPropertyFlexBasis:
2279 return consumeFlexBasis(m_range, m_context.mode()); 2290 return consumeFlexBasis(m_range, m_context.mode());
2280 case CSSPropertyFlexGrow: 2291 case CSSPropertyFlexGrow:
2281 case CSSPropertyFlexShrink: 2292 case CSSPropertyFlexShrink:
2282 return consumeNumber(m_range, ValueRangeNonNegative); 2293 return consumeNumber(m_range, ValueRangeNonNegative);
2283 case CSSPropertyStrokeDasharray: 2294 case CSSPropertyStrokeDasharray:
2284 return consumeStrokeDasharray(m_range); 2295 return consumeStrokeDasharray(m_range);
2285 case CSSPropertyWebkitColumnRuleWidth: 2296 case CSSPropertyWebkitColumnRuleWidth:
2286 return consumeColumnRuleWidth(m_range, m_context.mode()); 2297 return consumeColumnRuleWidth(m_range, m_context.mode());
2298 case CSSPropertyStrokeOpacity:
2299 case CSSPropertyFillOpacity:
2300 case CSSPropertyStopOpacity:
2301 case CSSPropertyFloodOpacity:
2302 return consumeNumber(m_range, ValueRangeAll);
2303 case CSSPropertyBaselineShift:
2304 return consumeBaselineShift(m_range);
2305 case CSSPropertyStrokeMiterlimit:
2306 return consumeNumber(m_range, ValueRangeNonNegative);
2307 case CSSPropertyStrokeWidth:
2308 case CSSPropertyStrokeDashoffset:
2309 case CSSPropertyCx:
2310 case CSSPropertyCy:
2311 case CSSPropertyX:
2312 case CSSPropertyY:
2313 case CSSPropertyR:
2314 case CSSPropertyRx:
2315 case CSSPropertyRy:
2316 return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll, UnitlessQuirk::Forbid);
2287 default: 2317 default:
2288 return nullptr; 2318 return nullptr;
2289 } 2319 }
2290 } 2320 }
2291 2321
2292 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) 2322 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range)
2293 { 2323 {
2294 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 2324 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
2295 2325
2296 do { 2326 do {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 return consumeShorthandGreedily(flexFlowShorthand(), important); 2904 return consumeShorthandGreedily(flexFlowShorthand(), important);
2875 case CSSPropertyWebkitColumnRule: 2905 case CSSPropertyWebkitColumnRule:
2876 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); 2906 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important);
2877 default: 2907 default:
2878 m_currentShorthand = oldShorthand; 2908 m_currentShorthand = oldShorthand;
2879 return false; 2909 return false;
2880 } 2910 }
2881 } 2911 }
2882 2912
2883 } // namespace blink 2913 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698