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

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

Issue 2641223003: Proof of concept that CSSPropertyAPI*::parseSingleValue may need more tahn 2 arguments (Closed)
Patch Set: 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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 if (range.peek().id() == CSSValueFromImage) 1629 if (range.peek().id() == CSSValueFromImage)
1630 return consumeIdent(range); 1630 return consumeIdent(range);
1631 if (range.peek().type() != NumberToken) { 1631 if (range.peek().type() != NumberToken) {
1632 CSSPrimitiveValue* angle = consumeAngle(range); 1632 CSSPrimitiveValue* angle = consumeAngle(range);
1633 if (angle && angle->getDoubleValue() == 0) 1633 if (angle && angle->getDoubleValue() == 0)
1634 return angle; 1634 return angle;
1635 } 1635 }
1636 return nullptr; 1636 return nullptr;
1637 } 1637 }
1638 1638
1639 static CSSValue* consumeCommaSeparatedBackgroundComponent(
1640 CSSPropertyID unresolvedProperty,
1641 CSSParserTokenRange& range,
1642 const CSSParserContext* context) {
1643 CSSValue* result = nullptr;
1644 do {
1645 CSSValue* value =
1646 CSSPropertyBackgroundComponentUtils::consumeBackgroundComponent(
1647 unresolvedProperty, range, context);
1648 if (!value)
1649 return nullptr;
1650 CSSPropertyBackgroundComponentUtils::addBackgroundValue(result, value);
1651 } while (consumeCommaIncludingWhitespace(range));
1652 return result;
1653 }
1654
1655 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) { 1639 static CSSValue* consumeAlignItems(CSSParserTokenRange& range) {
1656 // align-items property does not allow the 'auto' value. 1640 // align-items property does not allow the 'auto' value.
1657 if (identMatches<CSSValueAuto>(range.peek().id())) 1641 if (identMatches<CSSValueAuto>(range.peek().id()))
1658 return nullptr; 1642 return nullptr;
1659 return CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition(range); 1643 return CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition(range);
1660 } 1644 }
1661 1645
1662 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) { 1646 static CSSValue* consumeJustifyItems(CSSParserTokenRange& range) {
1663 CSSParserTokenRange rangeCopy = range; 1647 CSSParserTokenRange rangeCopy = range;
1664 CSSIdentifierValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy); 1648 CSSIdentifierValue* legacy = consumeIdent<CSSValueLegacy>(rangeCopy);
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 case CSSPropertyBorderImageWidth: 2405 case CSSPropertyBorderImageWidth:
2422 case CSSPropertyWebkitMaskBoxImageWidth: 2406 case CSSPropertyWebkitMaskBoxImageWidth:
2423 return consumeBorderImageWidth(m_range); 2407 return consumeBorderImageWidth(m_range);
2424 case CSSPropertyWebkitBorderImage: 2408 case CSSPropertyWebkitBorderImage:
2425 return consumeWebkitBorderImage(property, m_range, m_context); 2409 return consumeWebkitBorderImage(property, m_range, m_context);
2426 case CSSPropertyWebkitBoxReflect: 2410 case CSSPropertyWebkitBoxReflect:
2427 return consumeReflect(m_range, m_context); 2411 return consumeReflect(m_range, m_context);
2428 case CSSPropertyImageOrientation: 2412 case CSSPropertyImageOrientation:
2429 ASSERT(RuntimeEnabledFeatures::imageOrientationEnabled()); 2413 ASSERT(RuntimeEnabledFeatures::imageOrientationEnabled());
2430 return consumeImageOrientation(m_range); 2414 return consumeImageOrientation(m_range);
2431 case CSSPropertyBackgroundAttachment:
2432 case CSSPropertyBackgroundBlendMode:
2433 case CSSPropertyBackgroundClip:
2434 case CSSPropertyBackgroundImage:
2435 case CSSPropertyBackgroundOrigin:
2436 case CSSPropertyBackgroundPositionX:
2437 case CSSPropertyBackgroundPositionY:
2438 case CSSPropertyBackgroundSize:
2439 case CSSPropertyMaskSourceType:
2440 case CSSPropertyWebkitBackgroundClip:
2441 case CSSPropertyWebkitBackgroundOrigin:
2442 case CSSPropertyWebkitMaskClip:
2443 case CSSPropertyWebkitMaskComposite:
2444 case CSSPropertyWebkitMaskImage:
2445 case CSSPropertyWebkitMaskOrigin:
2446 case CSSPropertyWebkitMaskPositionX:
2447 case CSSPropertyWebkitMaskPositionY:
2448 case CSSPropertyWebkitMaskSize:
2449 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty,
2450 m_range, m_context);
2451 case CSSPropertyWebkitMaskRepeatX: 2415 case CSSPropertyWebkitMaskRepeatX:
2452 case CSSPropertyWebkitMaskRepeatY: 2416 case CSSPropertyWebkitMaskRepeatY:
2453 return nullptr; 2417 return nullptr;
2454 case CSSPropertyAlignItems: 2418 case CSSPropertyAlignItems:
2455 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2419 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2456 return consumeAlignItems(m_range); 2420 return consumeAlignItems(m_range);
2457 case CSSPropertyJustifySelf: 2421 case CSSPropertyJustifySelf:
2458 case CSSPropertyAlignSelf: 2422 case CSSPropertyAlignSelf:
2459 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2423 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2460 return CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition( 2424 return CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition(
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
3953 case CSSPropertyGridTemplate: 3917 case CSSPropertyGridTemplate:
3954 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 3918 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
3955 case CSSPropertyGrid: 3919 case CSSPropertyGrid:
3956 return consumeGridShorthand(important); 3920 return consumeGridShorthand(important);
3957 default: 3921 default:
3958 return false; 3922 return false;
3959 } 3923 }
3960 } 3924 }
3961 3925
3962 } // namespace blink 3926 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698