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

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

Issue 1576163002: Move scroll-snap related properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 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/CSSCalculationValue.h" 8 #include "core/css/CSSCalculationValue.h"
9 #include "core/css/CSSCounterValue.h" 9 #include "core/css/CSSCounterValue.h"
10 #include "core/css/CSSCrossfadeValue.h" 10 #include "core/css/CSSCrossfadeValue.h"
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 double perspective; 2881 double perspective;
2882 if (!consumeNumberRaw(range, perspective)) 2882 if (!consumeNumberRaw(range, perspective))
2883 return nullptr; 2883 return nullptr;
2884 parsedValue = cssValuePool().createValue(perspective, CSSPrimitiveValue: :UnitType::Pixels); 2884 parsedValue = cssValuePool().createValue(perspective, CSSPrimitiveValue: :UnitType::Pixels);
2885 } 2885 }
2886 if (parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubleVal ue() > 0)) 2886 if (parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubleVal ue() > 0))
2887 return parsedValue.release(); 2887 return parsedValue.release();
2888 return nullptr; 2888 return nullptr;
2889 } 2889 }
2890 2890
2891 static PassRefPtrWillBeRawPtr<CSSValueList> consumePositionList(CSSParserTokenRa nge& range, CSSParserMode cssParserMode)
2892 {
2893 RefPtrWillBeRawPtr<CSSValueList> positions = CSSValueList::createCommaSepara ted();
2894 do {
2895 RefPtrWillBeRawPtr<CSSValue> position = consumePosition(range, cssParser Mode, UnitlessQuirk::Forbid);
2896 if (!position)
2897 return nullptr;
2898 positions->append(position);
2899 } while (consumeCommaIncludingWhitespace(range));
2900 return positions.release();
2901 }
2902
2903 static PassRefPtrWillBeRawPtr<CSSValue> consumeScrollSnapCoordinate(CSSParserTok enRange& range, CSSParserMode cssParserMode)
2904 {
2905 if (range.peek().id() == CSSValueNone)
2906 return consumeIdent(range);
2907 return consumePositionList(range, cssParserMode);
2908 }
2909
2910 static PassRefPtrWillBeRawPtr<CSSValue> consumeScrollSnapPoints(CSSParserTokenRa nge& range, CSSParserMode cssParserMode)
2911 {
2912 if (range.peek().id() == CSSValueNone)
2913 return consumeIdent(range);
2914 if (range.peek().functionId() == CSSValueRepeat) {
2915 CSSParserTokenRange args = consumeFunction(range);
2916 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = consumeLengthOrPerce nt(args, cssParserMode, ValueRangeNonNegative);
2917 if (parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubl eValue() > 0)) {
Timothy Loh 2016/01/12 05:19:01 missing args.atEnd() check
2918 RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::crea te(CSSValueRepeat);
2919 result->append(parsedValue.release());
2920 return result.release();
2921 }
2922 }
2923 return nullptr;
2924 }
2925
2891 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) 2926 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty)
2892 { 2927 {
2893 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 2928 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
2894 switch (property) { 2929 switch (property) {
2895 case CSSPropertyWillChange: 2930 case CSSPropertyWillChange:
2896 return consumeWillChange(m_range); 2931 return consumeWillChange(m_range);
2897 case CSSPropertyPage: 2932 case CSSPropertyPage:
2898 return consumePage(m_range); 2933 return consumePage(m_range);
2899 case CSSPropertyQuotes: 2934 case CSSPropertyQuotes:
2900 return consumeQuotes(m_range); 2935 return consumeQuotes(m_range);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 case CSSPropertyContain: 3163 case CSSPropertyContain:
3129 return consumeContain(m_range); 3164 return consumeContain(m_range);
3130 case CSSPropertyTransformOrigin: 3165 case CSSPropertyTransformOrigin:
3131 return consumeTransformOrigin(m_range, m_context.mode(), UnitlessQuirk:: Forbid); 3166 return consumeTransformOrigin(m_range, m_context.mode(), UnitlessQuirk:: Forbid);
3132 case CSSPropertyContent: 3167 case CSSPropertyContent:
3133 return consumeContent(m_range, m_context); 3168 return consumeContent(m_range, m_context);
3134 case CSSPropertyListStyleImage: 3169 case CSSPropertyListStyleImage:
3135 return consumeImage(m_range, m_context); 3170 return consumeImage(m_range, m_context);
3136 case CSSPropertyPerspective: 3171 case CSSPropertyPerspective:
3137 return consumePerspective(m_range, m_context.mode(), unresolvedProperty) ; 3172 return consumePerspective(m_range, m_context.mode(), unresolvedProperty) ;
3173 case CSSPropertyScrollSnapCoordinate:
3174 return consumeScrollSnapCoordinate(m_range, m_context.mode());
3175 case CSSPropertyScrollSnapPointsX:
3176 case CSSPropertyScrollSnapPointsY:
3177 return consumeScrollSnapPoints(m_range, m_context.mode());
3138 default: 3178 default:
3139 return nullptr; 3179 return nullptr;
3140 } 3180 }
3141 } 3181 }
3142 3182
3143 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) 3183 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range)
3144 { 3184 {
3145 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 3185 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
3146 3186
3147 do { 3187 do {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3730 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); 3770 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important);
3731 case CSSPropertyListStyle: 3771 case CSSPropertyListStyle:
3732 return consumeShorthandGreedily(listStyleShorthand(), important); 3772 return consumeShorthandGreedily(listStyleShorthand(), important);
3733 default: 3773 default:
3734 m_currentShorthand = oldShorthand; 3774 m_currentShorthand = oldShorthand;
3735 return false; 3775 return false;
3736 } 3776 }
3737 } 3777 }
3738 3778
3739 } // namespace blink 3779 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698