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

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: rebase 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 806
807 if (panX) 807 if (panX)
808 list->append(*panX); 808 list->append(*panX);
809 if (panY) 809 if (panY)
810 list->append(*panY); 810 list->append(*panY);
811 if (pinchZoom) 811 if (pinchZoom)
812 list->append(*pinchZoom); 812 list->append(*pinchZoom);
813 return list; 813 return list;
814 } 814 }
815 815
816 static CSSPrimitiveValue* consumeLineClamp(CSSParserTokenRange& range) {
817 if (range.peek().type() != PercentageToken &&
818 range.peek().type() != NumberToken)
819 return nullptr;
820 CSSPrimitiveValue* clampValue = consumePercent(range, ValueRangeNonNegative);
821 if (clampValue)
822 return clampValue;
823 // When specifying number of lines, don't allow 0 as a valid value.
824 return consumePositiveInteger(range);
825 }
826
827 static CSSValue* consumeLocale(CSSParserTokenRange& range) { 816 static CSSValue* consumeLocale(CSSParserTokenRange& range) {
828 if (range.peek().id() == CSSValueAuto) 817 if (range.peek().id() == CSSValueAuto)
829 return consumeIdent(range); 818 return consumeIdent(range);
830 return consumeString(range); 819 return consumeString(range);
831 } 820 }
832 821
833 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) { 822 static CSSValue* consumeColumnWidth(CSSParserTokenRange& range) {
834 if (range.peek().id() == CSSValueAuto) 823 if (range.peek().id() == CSSValueAuto)
835 return consumeIdent(range); 824 return consumeIdent(range);
836 // Always parse lengths in strict mode here, since it would be ambiguous 825 // Always parse lengths in strict mode here, since it would be ambiguous
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 case CSSPropertyPaddingLeft: 3098 case CSSPropertyPaddingLeft:
3110 return consumeLengthOrPercent(m_range, m_context->mode(), 3099 return consumeLengthOrPercent(m_range, m_context->mode(),
3111 ValueRangeNonNegative, 3100 ValueRangeNonNegative,
3112 UnitlessQuirk::Allow); 3101 UnitlessQuirk::Allow);
3113 case CSSPropertyTouchAction: 3102 case CSSPropertyTouchAction:
3114 return consumeTouchAction(m_range); 3103 return consumeTouchAction(m_range);
3115 case CSSPropertyScrollSnapDestination: 3104 case CSSPropertyScrollSnapDestination:
3116 case CSSPropertyObjectPosition: 3105 case CSSPropertyObjectPosition:
3117 case CSSPropertyPerspectiveOrigin: 3106 case CSSPropertyPerspectiveOrigin:
3118 return consumePosition(m_range, m_context->mode(), UnitlessQuirk::Forbid); 3107 return consumePosition(m_range, m_context->mode(), UnitlessQuirk::Forbid);
3119 case CSSPropertyWebkitLineClamp:
3120 return consumeLineClamp(m_range);
3121 case CSSPropertyWebkitFontSizeDelta: 3108 case CSSPropertyWebkitFontSizeDelta:
3122 return consumeLength(m_range, m_context->mode(), ValueRangeAll, 3109 return consumeLength(m_range, m_context->mode(), ValueRangeAll,
3123 UnitlessQuirk::Allow); 3110 UnitlessQuirk::Allow);
3124 case CSSPropertyWebkitHyphenateCharacter: 3111 case CSSPropertyWebkitHyphenateCharacter:
3125 case CSSPropertyWebkitLocale: 3112 case CSSPropertyWebkitLocale:
3126 return consumeLocale(m_range); 3113 return consumeLocale(m_range);
3127 case CSSPropertyColumnWidth: 3114 case CSSPropertyColumnWidth:
3128 return consumeColumnWidth(m_range); 3115 return consumeColumnWidth(m_range);
3129 case CSSPropertyColumnCount: 3116 case CSSPropertyColumnCount:
3130 return consumeColumnCount(m_range); 3117 return consumeColumnCount(m_range);
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
4864 case CSSPropertyGridTemplate: 4851 case CSSPropertyGridTemplate:
4865 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 4852 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
4866 case CSSPropertyGrid: 4853 case CSSPropertyGrid:
4867 return consumeGridShorthand(important); 4854 return consumeGridShorthand(important);
4868 default: 4855 default:
4869 return false; 4856 return false;
4870 } 4857 }
4871 } 4858 }
4872 4859
4873 } // namespace blink 4860 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698