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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 return nullptr; | 974 return nullptr; |
975 CSSPrimitiveValue* bottom = consumeClipComponent(args, cssParserMode); | 975 CSSPrimitiveValue* bottom = consumeClipComponent(args, cssParserMode); |
976 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args))) | 976 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args))) |
977 return nullptr; | 977 return nullptr; |
978 CSSPrimitiveValue* left = consumeClipComponent(args, cssParserMode); | 978 CSSPrimitiveValue* left = consumeClipComponent(args, cssParserMode); |
979 if (!left || !args.atEnd()) | 979 if (!left || !args.atEnd()) |
980 return nullptr; | 980 return nullptr; |
981 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Serializ
eAsRect); | 981 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Serializ
eAsRect); |
982 } | 982 } |
983 | 983 |
984 static bool consumePan(CSSParserTokenRange& range, CSSValue*& panX, CSSValue*& p
anY) | 984 static bool consumePan(CSSParserTokenRange& range, CSSValue*& panX, CSSValue*& p
anY, CSSValue*& pinchZoom) |
985 { | 985 { |
986 CSSValueID id = range.peek().id(); | 986 CSSValueID id = range.peek().id(); |
987 if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft)
&& !panX) { | 987 if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft)
&& !panX) { |
988 if (id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDire
ctionsEnabled()) | 988 if (id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDire
ctionsEnabled()) |
989 return false; | 989 return false; |
990 panX = consumeIdent(range); | 990 panX = consumeIdent(range); |
991 } else if ((id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePan
Up) && !panY) { | 991 } else if ((id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePan
Up) && !panY) { |
992 if (id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDire
ctionsEnabled()) | 992 if (id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDire
ctionsEnabled()) |
993 return false; | 993 return false; |
994 panY = consumeIdent(range); | 994 panY = consumeIdent(range); |
| 995 } else if (id == CSSValuePinchZoom && !pinchZoom && RuntimeEnabledFeatures::
cssTouchActionPinchZoomEnabled()) { |
| 996 pinchZoom = consumeIdent(range); |
995 } else { | 997 } else { |
996 return false; | 998 return false; |
997 } | 999 } |
998 return true; | 1000 return true; |
999 } | 1001 } |
1000 | 1002 |
1001 static CSSValue* consumeTouchAction(CSSParserTokenRange& range) | 1003 static CSSValue* consumeTouchAction(CSSParserTokenRange& range) |
1002 { | 1004 { |
1003 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1005 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1004 CSSValueID id = range.peek().id(); | 1006 CSSValueID id = range.peek().id(); |
1005 if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation)
{ | 1007 if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation)
{ |
1006 list->append(*consumeIdent(range)); | 1008 list->append(*consumeIdent(range)); |
1007 return list; | 1009 return list; |
1008 } | 1010 } |
1009 | 1011 |
1010 CSSValue* panX = nullptr; | 1012 CSSValue* panX = nullptr; |
1011 CSSValue* panY = nullptr; | 1013 CSSValue* panY = nullptr; |
1012 if (!consumePan(range, panX, panY)) | 1014 CSSValue* pinchZoom = nullptr; |
| 1015 if (!consumePan(range, panX, panY, pinchZoom)) |
1013 return nullptr; | 1016 return nullptr; |
1014 if (!range.atEnd() && !consumePan(range, panX, panY)) | 1017 if (!range.atEnd() && !consumePan(range, panX, panY, pinchZoom)) |
| 1018 return nullptr; |
| 1019 if (!range.atEnd() && !consumePan(range, panX, panY, pinchZoom)) |
1015 return nullptr; | 1020 return nullptr; |
1016 | 1021 |
1017 if (panX) | 1022 if (panX) |
1018 list->append(*panX); | 1023 list->append(*panX); |
1019 if (panY) | 1024 if (panY) |
1020 list->append(*panY); | 1025 list->append(*panY); |
| 1026 if (pinchZoom) |
| 1027 list->append(*pinchZoom); |
1021 return list; | 1028 return list; |
1022 } | 1029 } |
1023 | 1030 |
1024 static CSSPrimitiveValue* consumeLineClamp(CSSParserTokenRange& range) | 1031 static CSSPrimitiveValue* consumeLineClamp(CSSParserTokenRange& range) |
1025 { | 1032 { |
1026 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT
oken) | 1033 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT
oken) |
1027 return nullptr; | 1034 return nullptr; |
1028 CSSPrimitiveValue* clampValue = consumePercent(range, ValueRangeNonNegative)
; | 1035 CSSPrimitiveValue* clampValue = consumePercent(range, ValueRangeNonNegative)
; |
1029 if (clampValue) | 1036 if (clampValue) |
1030 return clampValue; | 1037 return clampValue; |
(...skipping 3740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4771 case CSSPropertyGridTemplate: | 4778 case CSSPropertyGridTemplate: |
4772 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4779 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4773 case CSSPropertyGrid: | 4780 case CSSPropertyGrid: |
4774 return consumeGridShorthand(important); | 4781 return consumeGridShorthand(important); |
4775 default: | 4782 default: |
4776 return false; | 4783 return false; |
4777 } | 4784 } |
4778 } | 4785 } |
4779 | 4786 |
4780 } // namespace blink | 4787 } // namespace blink |
OLD | NEW |