OLD | NEW |
---|---|
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 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2777 return false; | 2777 return false; |
2778 | 2778 |
2779 return true; | 2779 return true; |
2780 } | 2780 } |
2781 | 2781 |
2782 static bool isGridTrackFixedSized(const CSSValue& value) | 2782 static bool isGridTrackFixedSized(const CSSValue& value) |
2783 { | 2783 { |
2784 if (value.isPrimitiveValue()) | 2784 if (value.isPrimitiveValue()) |
2785 return isGridTrackFixedSized(toCSSPrimitiveValue(value)); | 2785 return isGridTrackFixedSized(toCSSPrimitiveValue(value)); |
2786 | 2786 |
2787 if (value.isFunctionValue() && toCSSFunctionValue(value).functionType() == C SSValueFitContent) | |
2788 return false; | |
2789 | |
2787 const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(toCSSFuncti onValue(value).item(0)); | 2790 const CSSPrimitiveValue& minPrimitiveValue = toCSSPrimitiveValue(toCSSFuncti onValue(value).item(0)); |
2788 const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(toCSSFuncti onValue(value).item(1)); | 2791 const CSSPrimitiveValue& maxPrimitiveValue = toCSSPrimitiveValue(toCSSFuncti onValue(value).item(1)); |
2789 return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(max PrimitiveValue); | 2792 return isGridTrackFixedSized(minPrimitiveValue) || isGridTrackFixedSized(max PrimitiveValue); |
2790 } | 2793 } |
2791 | 2794 |
2792 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam es) | 2795 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam es) |
2793 { | 2796 { |
2794 ASSERT(!gridRowNames.isEmpty()); | 2797 ASSERT(!gridRowNames.isEmpty()); |
2795 Vector<String> columnNames; | 2798 Vector<String> columnNames; |
2796 // Using StringImpl to avoid checks and indirection in every call to String: :operator[]. | 2799 // Using StringImpl to avoid checks and indirection in every call to String: :operator[]. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2910 return nullptr; | 2913 return nullptr; |
2911 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM ode); | 2914 CSSPrimitiveValue* maxTrackBreadth = consumeGridBreadth(args, cssParserM ode); |
2912 if (!maxTrackBreadth || !args.atEnd()) | 2915 if (!maxTrackBreadth || !args.atEnd()) |
2913 return nullptr; | 2916 return nullptr; |
2914 range = rangeCopy; | 2917 range = rangeCopy; |
2915 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); | 2918 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueMinmax); |
2916 result->append(*minTrackBreadth); | 2919 result->append(*minTrackBreadth); |
2917 result->append(*maxTrackBreadth); | 2920 result->append(*maxTrackBreadth); |
2918 return result; | 2921 return result; |
2919 } | 2922 } |
2923 if (token.functionId() == CSSValueFitContent) { | |
2924 CSSParserTokenRange rangeCopy = range; | |
2925 CSSParserTokenRange args = consumeFunction(rangeCopy); | |
2926 CSSPrimitiveValue* trackBreadth = consumeGridBreadth(args, cssParserMode ); | |
2927 if (!trackBreadth || trackBreadth->isFlex() || !args.atEnd()) | |
2928 return nullptr; | |
2929 range = rangeCopy; | |
2930 CSSFunctionValue* result = CSSFunctionValue::create(CSSValueFitContent); | |
2931 result->append(*trackBreadth); | |
2932 return result; | |
Manuel Rego
2016/08/31 07:24:29
I'm wondering if it'd be nice to move this to a se
svillar
2016/08/31 09:50:04
That's a good idea. Actually using consumeGridBrea
| |
2933 } | |
2920 return consumeGridBreadth(range, cssParserMode); | 2934 return consumeGridBreadth(range, cssParserMode); |
2921 } | 2935 } |
2922 | 2936 |
2923 // Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a ne w one. | 2937 // Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a ne w one. |
2924 static CSSGridLineNamesValue* consumeGridLineNames(CSSParserTokenRange& range, C SSGridLineNamesValue* lineNames = nullptr) | 2938 static CSSGridLineNamesValue* consumeGridLineNames(CSSParserTokenRange& range, C SSGridLineNamesValue* lineNames = nullptr) |
2925 { | 2939 { |
2926 CSSParserTokenRange rangeCopy = range; | 2940 CSSParserTokenRange rangeCopy = range; |
2927 if (rangeCopy.consumeIncludingWhitespace().type() != LeftBracketToken) | 2941 if (rangeCopy.consumeIncludingWhitespace().type() != LeftBracketToken) |
2928 return nullptr; | 2942 return nullptr; |
2929 if (!lineNames) | 2943 if (!lineNames) |
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4697 case CSSPropertyGridTemplate: | 4711 case CSSPropertyGridTemplate: |
4698 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4712 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4699 case CSSPropertyGrid: | 4713 case CSSPropertyGrid: |
4700 return consumeGridShorthand(important); | 4714 return consumeGridShorthand(important); |
4701 default: | 4715 default: |
4702 return false; | 4716 return false; |
4703 } | 4717 } |
4704 } | 4718 } |
4705 | 4719 |
4706 } // namespace blink | 4720 } // namespace blink |
OLD | NEW |