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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSCrossfadeValue.h" | 10 #include "core/css/CSSCrossfadeValue.h" |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 if (list->hasValue(ident.get())) | 1919 if (list->hasValue(ident.get())) |
1920 return nullptr; | 1920 return nullptr; |
1921 list->append(ident.release()); | 1921 list->append(ident.release()); |
1922 } | 1922 } |
1923 | 1923 |
1924 if (!list->length()) | 1924 if (!list->length()) |
1925 return nullptr; | 1925 return nullptr; |
1926 return list.release(); | 1926 return list.release(); |
1927 } | 1927 } |
1928 | 1928 |
1929 static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionPath(CSSParserTokenRange& r
ange) | 1929 static PassRefPtrWillBeRawPtr<CSSValue> consumePath(CSSParserTokenRange& range) |
1930 { | 1930 { |
1931 CSSValueID id = range.peek().id(); | |
1932 if (id == CSSValueNone) | |
1933 return consumeIdent(range); | |
1934 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | 1931 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. |
1935 if (range.peek().functionId() != CSSValuePath) | 1932 if (range.peek().functionId() != CSSValuePath) |
1936 return nullptr; | 1933 return nullptr; |
1937 | 1934 |
1938 // FIXME: Add support for <fill-rule>. | 1935 // FIXME: Add support for <fill-rule>. |
1939 CSSParserTokenRange functionRange = range; | 1936 CSSParserTokenRange functionRange = range; |
1940 CSSParserTokenRange functionArgs = consumeFunction(functionRange); | 1937 CSSParserTokenRange functionArgs = consumeFunction(functionRange); |
1941 | 1938 |
1942 if (functionArgs.peek().type() != StringToken) | 1939 if (functionArgs.peek().type() != StringToken) |
1943 return nullptr; | 1940 return nullptr; |
1944 String pathString = functionArgs.consumeIncludingWhitespace().value(); | 1941 String pathString = functionArgs.consumeIncludingWhitespace().value(); |
1945 Path path; | 1942 |
1946 if (!buildPathFromString(pathString, path) || !functionArgs.atEnd()) | 1943 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
| 1944 if (!buildByteStreamFromString(pathString, *byteStream) || !functionArgs.atE
nd()) |
1947 return nullptr; | 1945 return nullptr; |
1948 | 1946 |
1949 range = functionRange; | 1947 range = functionRange; |
1950 return CSSPathValue::create(pathString); | 1948 return CSSPathValue::create(byteStream.release()); |
| 1949 } |
| 1950 |
| 1951 static PassRefPtrWillBeRawPtr<CSSValue> consumePathOrNone(CSSParserTokenRange& r
ange) |
| 1952 { |
| 1953 CSSValueID id = range.peek().id(); |
| 1954 if (id == CSSValueNone) |
| 1955 return consumeIdent(range); |
| 1956 |
| 1957 return consumePath(range); |
1951 } | 1958 } |
1952 | 1959 |
1953 static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionRotation(CSSParserTokenRang
e& range, CSSParserMode cssParserMode) | 1960 static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionRotation(CSSParserTokenRang
e& range, CSSParserMode cssParserMode) |
1954 { | 1961 { |
1955 RefPtrWillBeRawPtr<CSSValue> angle = consumeAngle(range, cssParserMode); | 1962 RefPtrWillBeRawPtr<CSSValue> angle = consumeAngle(range, cssParserMode); |
1956 RefPtrWillBeRawPtr<CSSValue> keyword = consumeIdent<CSSValueAuto, CSSValueRe
verse>(range); | 1963 RefPtrWillBeRawPtr<CSSValue> keyword = consumeIdent<CSSValueAuto, CSSValueRe
verse>(range); |
1957 if (!angle && !keyword) | 1964 if (!angle && !keyword) |
1958 return nullptr; | 1965 return nullptr; |
1959 | 1966 |
1960 if (!angle) | 1967 if (!angle) |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 return consumeZIndex(m_range); | 2786 return consumeZIndex(m_range); |
2780 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 | 2787 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 |
2781 case CSSPropertyBoxShadow: | 2788 case CSSPropertyBoxShadow: |
2782 return consumeShadow(m_range, m_context.mode(), property == CSSPropertyB
oxShadow); | 2789 return consumeShadow(m_range, m_context.mode(), property == CSSPropertyB
oxShadow); |
2783 case CSSPropertyWebkitFilter: | 2790 case CSSPropertyWebkitFilter: |
2784 case CSSPropertyBackdropFilter: | 2791 case CSSPropertyBackdropFilter: |
2785 return consumeFilter(m_range, m_context.mode()); | 2792 return consumeFilter(m_range, m_context.mode()); |
2786 case CSSPropertyWebkitTextDecorationsInEffect: | 2793 case CSSPropertyWebkitTextDecorationsInEffect: |
2787 case CSSPropertyTextDecorationLine: | 2794 case CSSPropertyTextDecorationLine: |
2788 return consumeTextDecorationLine(m_range); | 2795 return consumeTextDecorationLine(m_range); |
| 2796 case CSSPropertyD: |
| 2797 return consumePath(m_range); |
2789 case CSSPropertyMotionPath: | 2798 case CSSPropertyMotionPath: |
2790 return consumeMotionPath(m_range); | 2799 return consumePathOrNone(m_range); |
2791 case CSSPropertyMotionOffset: | 2800 case CSSPropertyMotionOffset: |
2792 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll); | 2801 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll); |
2793 case CSSPropertyMotionRotation: | 2802 case CSSPropertyMotionRotation: |
2794 return consumeMotionRotation(m_range, m_context.mode()); | 2803 return consumeMotionRotation(m_range, m_context.mode()); |
2795 case CSSPropertyWebkitTextEmphasisStyle: | 2804 case CSSPropertyWebkitTextEmphasisStyle: |
2796 return consumeTextEmphasisStyle(m_range); | 2805 return consumeTextEmphasisStyle(m_range); |
2797 case CSSPropertyOutlineColor: | 2806 case CSSPropertyOutlineColor: |
2798 return consumeOutlineColor(m_range, m_context.mode()); | 2807 return consumeOutlineColor(m_range, m_context.mode()); |
2799 case CSSPropertyOutlineOffset: | 2808 case CSSPropertyOutlineOffset: |
2800 return consumeLength(m_range, m_context.mode(), ValueRangeAll); | 2809 return consumeLength(m_range, m_context.mode(), ValueRangeAll); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 return consumeShorthandGreedily(flexFlowShorthand(), important); | 3455 return consumeShorthandGreedily(flexFlowShorthand(), important); |
3447 case CSSPropertyWebkitColumnRule: | 3456 case CSSPropertyWebkitColumnRule: |
3448 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); | 3457 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); |
3449 default: | 3458 default: |
3450 m_currentShorthand = oldShorthand; | 3459 m_currentShorthand = oldShorthand; |
3451 return false; | 3460 return false; |
3452 } | 3461 } |
3453 } | 3462 } |
3454 | 3463 |
3455 } // namespace blink | 3464 } // namespace blink |
OLD | NEW |