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

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

Issue 1909233002: Spec-compliant parsing and initial values for 'orphans' and 'widows'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some unit tests had non-conformant widphans assumptions too. Created 4 years, 8 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 if (!isValidAnimationPropertyList(shorthand.properties()[i], *longhands[ i])) 1217 if (!isValidAnimationPropertyList(shorthand.properties()[i], *longhands[ i]))
1218 return false; 1218 return false;
1219 } 1219 }
1220 1220
1221 for (size_t i = 0; i < longhandCount; ++i) 1221 for (size_t i = 0; i < longhandCount; ++i)
1222 addProperty(shorthand.properties()[i], longhands[i], important); 1222 addProperty(shorthand.properties()[i], longhands[i], important);
1223 1223
1224 return m_range.atEnd(); 1224 return m_range.atEnd();
1225 } 1225 }
1226 1226
1227 static CSSValue* consumeWidowsOrOrphans(CSSParserTokenRange& range)
1228 {
1229 // Support for auto is non-standard and for backwards compatibility.
1230 if (range.peek().id() == CSSValueAuto)
1231 return consumeIdent(range);
1232 return consumePositiveInteger(range);
1233 }
1234
1235 static CSSValue* consumeZIndex(CSSParserTokenRange& range) 1227 static CSSValue* consumeZIndex(CSSParserTokenRange& range)
1236 { 1228 {
1237 if (range.peek().id() == CSSValueAuto) 1229 if (range.peek().id() == CSSValueAuto)
1238 return consumeIdent(range); 1230 return consumeIdent(range);
1239 return consumeInteger(range); 1231 return consumeInteger(range);
1240 } 1232 }
1241 1233
1242 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo de cssParserMode, bool allowInset, bool allowSpread) 1234 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range, CSSParserMo de cssParserMode, bool allowInset, bool allowSpread)
1243 { 1235 {
1244 CSSPrimitiveValue* style = nullptr; 1236 CSSPrimitiveValue* style = nullptr;
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 case CSSPropertyTransitionTimingFunction: 3559 case CSSPropertyTransitionTimingFunction:
3568 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName); 3560 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName);
3569 case CSSPropertyGridColumnGap: 3561 case CSSPropertyGridColumnGap:
3570 case CSSPropertyGridRowGap: 3562 case CSSPropertyGridRowGap:
3571 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative); 3563 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative);
3572 case CSSPropertyShapeMargin: 3564 case CSSPropertyShapeMargin:
3573 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe gative); 3565 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe gative);
3574 case CSSPropertyShapeImageThreshold: 3566 case CSSPropertyShapeImageThreshold:
3575 return consumeNumber(m_range, ValueRangeAll); 3567 return consumeNumber(m_range, ValueRangeAll);
3576 case CSSPropertyWebkitBoxOrdinalGroup: 3568 case CSSPropertyWebkitBoxOrdinalGroup:
3577 return consumePositiveInteger(m_range);
3578 case CSSPropertyOrphans: 3569 case CSSPropertyOrphans:
3579 case CSSPropertyWidows: 3570 case CSSPropertyWidows:
3580 return consumeWidowsOrOrphans(m_range); 3571 return consumePositiveInteger(m_range);
3581 case CSSPropertyTextDecorationColor: 3572 case CSSPropertyTextDecorationColor:
3582 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); 3573 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
3583 return consumeColor(m_range, m_context.mode()); 3574 return consumeColor(m_range, m_context.mode());
3584 case CSSPropertyWebkitTextStrokeWidth: 3575 case CSSPropertyWebkitTextStrokeWidth:
3585 return consumeTextStrokeWidth(m_range, m_context.mode()); 3576 return consumeTextStrokeWidth(m_range, m_context.mode());
3586 case CSSPropertyWebkitTextFillColor: 3577 case CSSPropertyWebkitTextFillColor:
3587 case CSSPropertyWebkitTapHighlightColor: 3578 case CSSPropertyWebkitTapHighlightColor:
3588 case CSSPropertyWebkitTextEmphasisColor: 3579 case CSSPropertyWebkitTextEmphasisColor:
3589 case CSSPropertyWebkitBorderStartColor: 3580 case CSSPropertyWebkitBorderStartColor:
3590 case CSSPropertyWebkitBorderEndColor: 3581 case CSSPropertyWebkitBorderEndColor:
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
4974 return consumeGridTemplateShorthand(important); 4965 return consumeGridTemplateShorthand(important);
4975 case CSSPropertyGrid: 4966 case CSSPropertyGrid:
4976 return consumeGridShorthand(important); 4967 return consumeGridShorthand(important);
4977 default: 4968 default:
4978 m_currentShorthand = oldShorthand; 4969 m_currentShorthand = oldShorthand;
4979 return false; 4970 return false;
4980 } 4971 }
4981 } 4972 }
4982 4973
4983 } // namespace blink 4974 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698