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

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

Issue 1979603002: [css-grid] Fix behavior of flexible track breadths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New version fixing comment Created 4 years, 7 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 3263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 return false; 3274 return false;
3275 3275
3276 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s tartLine(), gridArea.rows.endLine() + 1); 3276 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s tartLine(), gridArea.rows.endLine() + 1);
3277 } 3277 }
3278 currentColumn = lookAheadColumn - 1; 3278 currentColumn = lookAheadColumn - 1;
3279 } 3279 }
3280 3280
3281 return true; 3281 return true;
3282 } 3282 }
3283 3283
3284 enum TrackSizeRestriction { FixedSizeOnly, AllowAll }; 3284 enum TrackSizeRestriction { FixedSizeOnly, InflexibleSizeOnly, AllowAll };
3285 3285
3286 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars erMode cssParserMode, TrackSizeRestriction restriction = AllowAll) 3286 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars erMode cssParserMode, TrackSizeRestriction restriction = AllowAll)
3287 { 3287 {
3288 if (restriction == AllowAll) { 3288 if (restriction != FixedSizeOnly) {
3289 const CSSParserToken& token = range.peek(); 3289 const CSSParserToken& token = range.peek();
3290 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(t oken.id())) 3290 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(t oken.id()))
3291 return consumeIdent(range); 3291 return consumeIdent(range);
3292 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveVa lue::UnitType::Fraction) { 3292 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveVa lue::UnitType::Fraction) {
3293 if (range.peek().numericValue() < 0) 3293 if (restriction == InflexibleSizeOnly || range.peek().numericValue() < 0)
3294 return nullptr; 3294 return nullptr;
3295 return cssValuePool().createValue(range.consumeIncludingWhitespace() .numericValue(), CSSPrimitiveValue::UnitType::Fraction); 3295 return cssValuePool().createValue(range.consumeIncludingWhitespace() .numericValue(), CSSPrimitiveValue::UnitType::Fraction);
3296 } 3296 }
3297 } 3297 }
3298 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U nitlessQuirk::Allow); 3298 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U nitlessQuirk::Allow);
3299 } 3299 }
3300 3300
3301 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li st> for the grid shorthand. 3301 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li st> for the grid shorthand.
3302 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode cssParserMode, TrackSizeRestriction restriction = AllowAll) 3302 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode cssParserMode, TrackSizeRestriction restriction = AllowAll)
3303 { 3303 {
3304 const CSSParserToken& token = range.peek(); 3304 const CSSParserToken& token = range.peek();
3305 if (restriction == AllowAll && identMatches<CSSValueAuto>(token.id())) 3305 if (restriction == AllowAll && identMatches<CSSValueAuto>(token.id()))
3306 return consumeIdent(range); 3306 return consumeIdent(range);
3307 3307
3308 if (token.functionId() == CSSValueMinmax) { 3308 if (token.functionId() == CSSValueMinmax) {
3309 CSSParserTokenRange rangeCopy = range; 3309 CSSParserTokenRange rangeCopy = range;
3310 CSSParserTokenRange args = consumeFunction(rangeCopy); 3310 CSSParserTokenRange args = consumeFunction(rangeCopy);
3311 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM ode, restriction); 3311 TrackSizeRestriction minTrackBreadthRestriction = restriction == AllowAl l ? InflexibleSizeOnly : restriction;
3312 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM ode, minTrackBreadthRestriction);
3312 if (!minTrackBreadth || !consumeCommaIncludingWhitespace(args)) 3313 if (!minTrackBreadth || !consumeCommaIncludingWhitespace(args))
3313 return nullptr; 3314 return nullptr;
3314 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM ode); 3315 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM ode);
3315 if (!maxTrackBreadth || !args.atEnd()) 3316 if (!maxTrackBreadth || !args.atEnd())
3316 return nullptr; 3317 return nullptr;
3317 range = rangeCopy; 3318 range = rangeCopy;
3318 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); 3319 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax);
3319 result->append(minTrackBreadth); 3320 result->append(minTrackBreadth);
3320 result->append(maxTrackBreadth); 3321 result->append(maxTrackBreadth);
3321 return result; 3322 return result;
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
5031 case CSSPropertyGridTemplate: 5032 case CSSPropertyGridTemplate:
5032 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 5033 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
5033 case CSSPropertyGrid: 5034 case CSSPropertyGrid:
5034 return consumeGridShorthand(important); 5035 return consumeGridShorthand(important);
5035 default: 5036 default:
5036 return false; 5037 return false;
5037 } 5038 }
5038 } 5039 }
5039 5040
5040 } // namespace blink 5041 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698