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

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

Issue 2615813002: Implements CSSPropertyAPI for the webkit-line-clamp property. (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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1040
1041 if (panX) 1041 if (panX)
1042 list->append(*panX); 1042 list->append(*panX);
1043 if (panY) 1043 if (panY)
1044 list->append(*panY); 1044 list->append(*panY);
1045 if (pinchZoom) 1045 if (pinchZoom)
1046 list->append(*pinchZoom); 1046 list->append(*pinchZoom);
1047 return list; 1047 return list;
1048 } 1048 }
1049 1049
1050 static CSSPrimitiveValue* consumeLineClamp(CSSParserTokenRange& range) {
1051 if (range.peek().type() != PercentageToken &&
1052 range.peek().type() != NumberToken)
1053 return nullptr;
1054 CSSPrimitiveValue* clampValue = consumePercent(range, ValueRangeNonNegative);
1055 if (clampValue)
1056 return clampValue;
1057 // When specifying number of lines, don't allow 0 as a valid value.
1058 return consumePositiveInteger(range);
1059 }
1060
1061 static CSSValue* consumeLocale(CSSParserTokenRange& range) { 1050 static CSSValue* consumeLocale(CSSParserTokenRange& range) {
1062 if (range.peek().id() == CSSValueAuto) 1051 if (range.peek().id() == CSSValueAuto)
1063 return consumeIdent(range); 1052 return consumeIdent(range);
1064 return consumeString(range); 1053 return consumeString(range);
1065 } 1054 }
1066 1055
1067 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) { 1056 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) {
1068 if (range.peek().id() == CSSValueAuto) 1057 if (range.peek().id() == CSSValueAuto)
1069 return consumeIdent(range); 1058 return consumeIdent(range);
1070 // Always parse lengths in strict mode here, since it would be ambiguous 1059 // Always parse lengths in strict mode here, since it would be ambiguous
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 ValueRangeNonNegative, 3513 ValueRangeNonNegative,
3525 UnitlessQuirk::Allow); 3514 UnitlessQuirk::Allow);
3526 case CSSPropertyClip: 3515 case CSSPropertyClip:
3527 return consumeClip(m_range, m_context.mode()); 3516 return consumeClip(m_range, m_context.mode());
3528 case CSSPropertyTouchAction: 3517 case CSSPropertyTouchAction:
3529 return consumeTouchAction(m_range); 3518 return consumeTouchAction(m_range);
3530 case CSSPropertyScrollSnapDestination: 3519 case CSSPropertyScrollSnapDestination:
3531 case CSSPropertyObjectPosition: 3520 case CSSPropertyObjectPosition:
3532 case CSSPropertyPerspectiveOrigin: 3521 case CSSPropertyPerspectiveOrigin:
3533 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid); 3522 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid);
3534 case CSSPropertyWebkitLineClamp:
3535 return consumeLineClamp(m_range);
3536 case CSSPropertyWebkitFontSizeDelta: 3523 case CSSPropertyWebkitFontSizeDelta:
3537 return consumeLength(m_range, m_context.mode(), ValueRangeAll, 3524 return consumeLength(m_range, m_context.mode(), ValueRangeAll,
3538 UnitlessQuirk::Allow); 3525 UnitlessQuirk::Allow);
3539 case CSSPropertyWebkitHyphenateCharacter: 3526 case CSSPropertyWebkitHyphenateCharacter:
3540 case CSSPropertyWebkitLocale: 3527 case CSSPropertyWebkitLocale:
3541 return consumeLocale(m_range); 3528 return consumeLocale(m_range);
3542 case CSSPropertyColumnWidth: 3529 case CSSPropertyColumnWidth:
3543 return consumeColumnWidth(m_range); 3530 return consumeColumnWidth(m_range);
3544 case CSSPropertyColumnCount: 3531 case CSSPropertyColumnCount:
3545 return consumeColumnCount(m_range); 3532 return consumeColumnCount(m_range);
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 case CSSPropertyGridTemplate: 5317 case CSSPropertyGridTemplate:
5331 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 5318 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
5332 case CSSPropertyGrid: 5319 case CSSPropertyGrid:
5333 return consumeGridShorthand(important); 5320 return consumeGridShorthand(important);
5334 default: 5321 default:
5335 return false; 5322 return false;
5336 } 5323 }
5337 } 5324 }
5338 5325
5339 } // namespace blink 5326 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698