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

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

Issue 1696373003: Add CSS parser support for the snap-height property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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/CSSCalculationValue.h" 10 #include "core/css/CSSCalculationValue.h"
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 1282
1283 if (!orientation && !pageSize) 1283 if (!orientation && !pageSize)
1284 return nullptr; 1284 return nullptr;
1285 if (pageSize) 1285 if (pageSize)
1286 result->append(pageSize.release()); 1286 result->append(pageSize.release());
1287 if (orientation) 1287 if (orientation)
1288 result->append(orientation.release()); 1288 result->append(orientation.release());
1289 return result.release(); 1289 return result.release();
1290 } 1290 }
1291 1291
1292 static PassRefPtrWillBeRawPtr<CSSValue> consumeSnapHeight(CSSParserTokenRange& r ange, CSSParserMode cssParserMode)
1293 {
1294 RefPtrWillBeRawPtr<CSSPrimitiveValue> unit = consumeLength(range, cssParserM ode, ValueRangeNonNegative);
1295 if (!unit)
1296 return nullptr;
1297 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1298 list->append(unit.release());
1299
1300 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> position = consumePositiveInteger( range)) {
1301 if (position->getIntValue() > 100)
1302 return nullptr;
1303 list->append(position.release());
1304 }
1305
1306 return list.release();
1307 }
1308
1292 static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& r ange, CSSParserMode cssParserMode) 1309 static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& r ange, CSSParserMode cssParserMode)
1293 { 1310 {
1294 // [ <length> | <percentage> ] && hanging? && each-line? 1311 // [ <length> | <percentage> ] && hanging? && each-line?
1295 // Keywords only allowed when css3Text is enabled. 1312 // Keywords only allowed when css3Text is enabled.
1296 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1313 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1297 1314
1298 bool hasLengthOrPercentage = false; 1315 bool hasLengthOrPercentage = false;
1299 bool hasEachLine = false; 1316 bool hasEachLine = false;
1300 bool hasHanging = false; 1317 bool hasHanging = false;
1301 1318
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 case CSSPropertyTranslate: 3435 case CSSPropertyTranslate:
3419 return consumeTranslate(m_range, m_context.mode()); 3436 return consumeTranslate(m_range, m_context.mode());
3420 case CSSPropertyWebkitBorderHorizontalSpacing: 3437 case CSSPropertyWebkitBorderHorizontalSpacing:
3421 case CSSPropertyWebkitBorderVerticalSpacing: 3438 case CSSPropertyWebkitBorderVerticalSpacing:
3422 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative); 3439 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative);
3423 case CSSPropertyCounterIncrement: 3440 case CSSPropertyCounterIncrement:
3424 case CSSPropertyCounterReset: 3441 case CSSPropertyCounterReset:
3425 return consumeCounter(m_range, m_context.mode(), property == CSSProperty CounterIncrement ? 1 : 0); 3442 return consumeCounter(m_range, m_context.mode(), property == CSSProperty CounterIncrement ? 1 : 0);
3426 case CSSPropertySize: 3443 case CSSPropertySize:
3427 return consumeSize(m_range, m_context.mode()); 3444 return consumeSize(m_range, m_context.mode());
3445 case CSSPropertySnapHeight:
3446 return consumeSnapHeight(m_range, m_context.mode());
3428 case CSSPropertyTextIndent: 3447 case CSSPropertyTextIndent:
3429 return consumeTextIndent(m_range, m_context.mode()); 3448 return consumeTextIndent(m_range, m_context.mode());
3430 case CSSPropertyMaxWidth: 3449 case CSSPropertyMaxWidth:
3431 case CSSPropertyMaxHeight: 3450 case CSSPropertyMaxHeight:
3432 return consumeMaxWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow) ; 3451 return consumeMaxWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow) ;
3433 case CSSPropertyWebkitMaxLogicalWidth: 3452 case CSSPropertyWebkitMaxLogicalWidth:
3434 case CSSPropertyWebkitMaxLogicalHeight: 3453 case CSSPropertyWebkitMaxLogicalHeight:
3435 return consumeMaxWidthOrHeight(m_range, m_context); 3454 return consumeMaxWidthOrHeight(m_range, m_context);
3436 case CSSPropertyMinWidth: 3455 case CSSPropertyMinWidth:
3437 case CSSPropertyMinHeight: 3456 case CSSPropertyMinHeight:
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
4392 m_currentShorthand = oldShorthand; 4411 m_currentShorthand = oldShorthand;
4393 CSSParserValueList valueList(m_range); 4412 CSSParserValueList valueList(m_range);
4394 if (!valueList.size()) 4413 if (!valueList.size())
4395 return false; 4414 return false;
4396 m_valueList = &valueList; 4415 m_valueList = &valueList;
4397 return legacyParseShorthand(unresolvedProperty, important); 4416 return legacyParseShorthand(unresolvedProperty, important);
4398 } 4417 }
4399 } 4418 }
4400 4419
4401 } // namespace blink 4420 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698