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

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: dependencies 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1020
1021 if (panX) 1021 if (panX)
1022 list->append(*panX); 1022 list->append(*panX);
1023 if (panY) 1023 if (panY)
1024 list->append(*panY); 1024 list->append(*panY);
1025 if (pinchZoom) 1025 if (pinchZoom)
1026 list->append(*pinchZoom); 1026 list->append(*pinchZoom);
1027 return list; 1027 return list;
1028 } 1028 }
1029 1029
1030 static CSSPrimitiveValue* consumeLineClamp(CSSParserTokenRange& range) {
1031 if (range.peek().type() != PercentageToken &&
1032 range.peek().type() != NumberToken)
1033 return nullptr;
1034 CSSPrimitiveValue* clampValue = consumePercent(range, ValueRangeNonNegative);
1035 if (clampValue)
1036 return clampValue;
1037 // When specifying number of lines, don't allow 0 as a valid value.
1038 return consumePositiveInteger(range);
1039 }
1040
1041 static CSSValue* consumeLocale(CSSParserTokenRange& range) { 1030 static CSSValue* consumeLocale(CSSParserTokenRange& range) {
1042 if (range.peek().id() == CSSValueAuto) 1031 if (range.peek().id() == CSSValueAuto)
1043 return consumeIdent(range); 1032 return consumeIdent(range);
1044 return consumeString(range); 1033 return consumeString(range);
1045 } 1034 }
1046 1035
1047 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) { 1036 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) {
1048 if (range.peek().id() == CSSValueAuto) 1037 if (range.peek().id() == CSSValueAuto)
1049 return consumeIdent(range); 1038 return consumeIdent(range);
1050 // Always parse lengths in strict mode here, since it would be ambiguous 1039 // Always parse lengths in strict mode here, since it would be ambiguous
(...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3502 ValueRangeNonNegative, 3491 ValueRangeNonNegative,
3503 UnitlessQuirk::Allow); 3492 UnitlessQuirk::Allow);
3504 case CSSPropertyClip: 3493 case CSSPropertyClip:
3505 return consumeClip(m_range, m_context.mode()); 3494 return consumeClip(m_range, m_context.mode());
3506 case CSSPropertyTouchAction: 3495 case CSSPropertyTouchAction:
3507 return consumeTouchAction(m_range); 3496 return consumeTouchAction(m_range);
3508 case CSSPropertyScrollSnapDestination: 3497 case CSSPropertyScrollSnapDestination:
3509 case CSSPropertyObjectPosition: 3498 case CSSPropertyObjectPosition:
3510 case CSSPropertyPerspectiveOrigin: 3499 case CSSPropertyPerspectiveOrigin:
3511 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid); 3500 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid);
3512 case CSSPropertyWebkitLineClamp:
3513 return consumeLineClamp(m_range);
3514 case CSSPropertyWebkitFontSizeDelta: 3501 case CSSPropertyWebkitFontSizeDelta:
3515 return consumeLength(m_range, m_context.mode(), ValueRangeAll, 3502 return consumeLength(m_range, m_context.mode(), ValueRangeAll,
3516 UnitlessQuirk::Allow); 3503 UnitlessQuirk::Allow);
3517 case CSSPropertyWebkitHyphenateCharacter: 3504 case CSSPropertyWebkitHyphenateCharacter:
3518 case CSSPropertyWebkitLocale: 3505 case CSSPropertyWebkitLocale:
3519 return consumeLocale(m_range); 3506 return consumeLocale(m_range);
3520 case CSSPropertyColumnWidth: 3507 case CSSPropertyColumnWidth:
3521 return consumeColumnWidth(m_range); 3508 return consumeColumnWidth(m_range);
3522 case CSSPropertyColumnCount: 3509 case CSSPropertyColumnCount:
3523 return consumeColumnCount(m_range); 3510 return consumeColumnCount(m_range);
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5296 case CSSPropertyGridTemplate: 5283 case CSSPropertyGridTemplate:
5297 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 5284 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
5298 case CSSPropertyGrid: 5285 case CSSPropertyGrid:
5299 return consumeGridShorthand(important); 5286 return consumeGridShorthand(important);
5300 default: 5287 default:
5301 return false; 5288 return false;
5302 } 5289 }
5303 } 5290 }
5304 5291
5305 } // namespace blink 5292 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698