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

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

Issue 2610893003: Implements CSSPropertyAPI for the stroke-dasharray property. (Closed)
Patch Set: changed reference to pointer Created 3 years, 11 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
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 "core/css/parser/CSSPropertyParser.h" 5 #include "core/css/parser/CSSPropertyParser.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h" 8 #include "core/css/CSSBasicShapeValues.h"
9 #include "core/css/CSSBorderImage.h" 9 #include "core/css/CSSBorderImage.h"
10 #include "core/css/CSSContentDistributionValue.h" 10 #include "core/css/CSSContentDistributionValue.h"
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 } 1704 }
1705 return consumeColor(range, cssParserMode); 1705 return consumeColor(range, cssParserMode);
1706 } 1706 }
1707 1707
1708 static CSSValue* consumeNoneOrURI(CSSParserTokenRange& range) { 1708 static CSSValue* consumeNoneOrURI(CSSParserTokenRange& range) {
1709 if (range.peek().id() == CSSValueNone) 1709 if (range.peek().id() == CSSValueNone)
1710 return consumeIdent(range); 1710 return consumeIdent(range);
1711 return consumeUrl(range); 1711 return consumeUrl(range);
1712 } 1712 }
1713 1713
1714 static CSSValue* consumeStrokeDasharray(CSSParserTokenRange& range) {
1715 CSSValueID id = range.peek().id();
1716 if (id == CSSValueNone)
1717 return consumeIdent(range);
1718
1719 CSSValueList* dashes = CSSValueList::createCommaSeparated();
1720 do {
1721 CSSPrimitiveValue* dash =
1722 consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeNonNegative);
1723 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd()))
1724 return nullptr;
1725 dashes->append(*dash);
1726 } while (!range.atEnd());
1727 return dashes;
1728 }
1729
1730 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) { 1714 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) {
1731 CSSValueID id = range.peek().id(); 1715 CSSValueID id = range.peek().id();
1732 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) 1716 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper)
1733 return consumeIdent(range); 1717 return consumeIdent(range);
1734 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); 1718 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll);
1735 } 1719 }
1736 1720
1737 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) { 1721 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) {
1738 if (range.peek().id() == CSSValueAuto) 1722 if (range.peek().id() == CSSValueAuto)
1739 return consumeIdent(range); 1723 return consumeIdent(range);
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 case CSSPropertyStroke: 3309 case CSSPropertyStroke:
3326 return consumePaintStroke(m_range, m_context->mode()); 3310 return consumePaintStroke(m_range, m_context->mode());
3327 case CSSPropertyMarkerStart: 3311 case CSSPropertyMarkerStart:
3328 case CSSPropertyMarkerMid: 3312 case CSSPropertyMarkerMid:
3329 case CSSPropertyMarkerEnd: 3313 case CSSPropertyMarkerEnd:
3330 case CSSPropertyMask: 3314 case CSSPropertyMask:
3331 return consumeNoneOrURI(m_range); 3315 return consumeNoneOrURI(m_range);
3332 case CSSPropertyFlexGrow: 3316 case CSSPropertyFlexGrow:
3333 case CSSPropertyFlexShrink: 3317 case CSSPropertyFlexShrink:
3334 return consumeNumber(m_range, ValueRangeNonNegative); 3318 return consumeNumber(m_range, ValueRangeNonNegative);
3335 case CSSPropertyStrokeDasharray:
3336 return consumeStrokeDasharray(m_range);
3337 case CSSPropertyColumnRuleWidth: 3319 case CSSPropertyColumnRuleWidth:
3338 return consumeColumnRuleWidth(m_range, m_context->mode()); 3320 return consumeColumnRuleWidth(m_range, m_context->mode());
3339 case CSSPropertyStrokeOpacity: 3321 case CSSPropertyStrokeOpacity:
3340 case CSSPropertyFillOpacity: 3322 case CSSPropertyFillOpacity:
3341 case CSSPropertyStopOpacity: 3323 case CSSPropertyStopOpacity:
3342 case CSSPropertyFloodOpacity: 3324 case CSSPropertyFloodOpacity:
3343 case CSSPropertyOpacity: 3325 case CSSPropertyOpacity:
3344 case CSSPropertyWebkitBoxFlex: 3326 case CSSPropertyWebkitBoxFlex:
3345 return consumeNumber(m_range, ValueRangeAll); 3327 return consumeNumber(m_range, ValueRangeAll);
3346 case CSSPropertyBaselineShift: 3328 case CSSPropertyBaselineShift:
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
4946 case CSSPropertyGridTemplate: 4928 case CSSPropertyGridTemplate:
4947 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 4929 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
4948 case CSSPropertyGrid: 4930 case CSSPropertyGrid:
4949 return consumeGridShorthand(important); 4931 return consumeGridShorthand(important);
4950 default: 4932 default:
4951 return false; 4933 return false;
4952 } 4934 }
4953 } 4935 }
4954 4936
4955 } // namespace blink 4937 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698