OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/properties/CSSPropertyAPIClip.h" | 5 #include "core/css/properties/CSSPropertyAPIClip.h" |
6 | 6 |
7 #include "core/css/CSSQuadValue.h" | 7 #include "core/css/CSSQuadValue.h" |
8 #include "core/css/parser/CSSParserContext.h" | 8 #include "core/css/parser/CSSParserContext.h" |
9 #include "core/css/parser/CSSPropertyParserHelpers.h" | 9 #include "core/css/parser/CSSPropertyParserHelpers.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 CSSValue* consumeClipComponent(CSSParserTokenRange& range, | 15 CSSValue* consumeClipComponent(CSSParserTokenRange& range, |
16 CSSParserMode cssParserMode) { | 16 CSSParserMode cssParserMode) { |
17 if (range.peek().id() == CSSValueAuto) | 17 if (range.peek().id() == CSSValueAuto) |
18 return CSSPropertyParserHelpers::consumeIdent(range); | 18 return CSSPropertyParserHelpers::consumeIdent(range); |
19 return CSSPropertyParserHelpers::consumeLength( | 19 return CSSPropertyParserHelpers::consumeLength( |
20 range, cssParserMode, ValueRangeAll, | 20 range, cssParserMode, ValueRangeAll, |
21 CSSPropertyParserHelpers::UnitlessQuirk::Allow); | 21 CSSPropertyParserHelpers::UnitlessQuirk::Allow); |
22 } | 22 } |
23 } | 23 |
| 24 } // namespace |
24 | 25 |
25 const CSSValue* CSSPropertyAPIClip::parseSingleValue( | 26 const CSSValue* CSSPropertyAPIClip::parseSingleValue( |
26 CSSParserTokenRange& range, | 27 CSSParserTokenRange& range, |
27 const CSSParserContext& context) { | 28 const CSSParserContext& context) { |
28 if (range.peek().id() == CSSValueAuto) | 29 if (range.peek().id() == CSSValueAuto) |
29 return CSSPropertyParserHelpers::consumeIdent(range); | 30 return CSSPropertyParserHelpers::consumeIdent(range); |
30 | 31 |
31 if (range.peek().functionId() != CSSValueRect) | 32 if (range.peek().functionId() != CSSValueRect) |
32 return nullptr; | 33 return nullptr; |
33 | 34 |
(...skipping 15 matching lines...) Expand all Loading... |
49 !CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(args))) | 50 !CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(args))) |
50 return nullptr; | 51 return nullptr; |
51 CSSValue* left = consumeClipComponent(args, context.mode()); | 52 CSSValue* left = consumeClipComponent(args, context.mode()); |
52 if (!left || !args.atEnd()) | 53 if (!left || !args.atEnd()) |
53 return nullptr; | 54 return nullptr; |
54 return CSSQuadValue::create(top, right, bottom, left, | 55 return CSSQuadValue::create(top, right, bottom, left, |
55 CSSQuadValue::SerializeAsRect); | 56 CSSQuadValue::SerializeAsRect); |
56 } | 57 } |
57 | 58 |
58 } // namespace blink | 59 } // namespace blink |
OLD | NEW |