Chromium Code Reviews| 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/CSSCustomIdentValue.h" | 10 #include "core/css/CSSCustomIdentValue.h" |
| (...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1940 RefPtrWillBeRawPtr<CSSValueList> dashes = CSSValueList::createCommaSeparated (); | 1940 RefPtrWillBeRawPtr<CSSValueList> dashes = CSSValueList::createCommaSeparated (); |
| 1941 do { | 1941 do { |
| 1942 RefPtrWillBeRawPtr<CSSPrimitiveValue> dash = consumeLengthOrPercent(rang e, SVGAttributeMode, ValueRangeNonNegative, UnitlessQuirk::Allow); | 1942 RefPtrWillBeRawPtr<CSSPrimitiveValue> dash = consumeLengthOrPercent(rang e, SVGAttributeMode, ValueRangeNonNegative, UnitlessQuirk::Allow); |
| 1943 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) | 1943 if (!dash || (consumeCommaIncludingWhitespace(range) && range.atEnd())) |
| 1944 return nullptr; | 1944 return nullptr; |
| 1945 dashes->append(dash.release()); | 1945 dashes->append(dash.release()); |
| 1946 } while (!range.atEnd()); | 1946 } while (!range.atEnd()); |
| 1947 return dashes.release(); | 1947 return dashes.release(); |
| 1948 } | 1948 } |
| 1949 | 1949 |
| 1950 static PassRefPtrWillBeRawPtr<CSSValue> consumeSVGDPath(CSSParserTokenRange& ran ge) | |
|
fs
2015/11/26 12:51:39
Shouldn't the syntax for this be the same as for m
Eric Willigers
2015/12/10 23:52:52
Done. Should we have None or path('') if the eleme
fs
2015/12/11 13:01:58
The way you've done it in the latest PS seems ok t
| |
| 1951 { | |
| 1952 if (range.peek().type() != StringToken) | |
| 1953 return nullptr; | |
| 1954 | |
| 1955 String pathString = range.consumeIncludingWhitespace().value(); | |
| 1956 Path path; | |
| 1957 if (!buildPathFromString(pathString, path) || !range.atEnd()) | |
|
fs
2015/11/26 12:51:39
Here we build a Path (not entirely free) just to t
fs
2015/12/11 13:01:58
Just noting: We should probably make sure this is
Eric Willigers
2015/12/14 05:36:46
The implemented approach is conservative, and cons
| |
| 1958 return nullptr; | |
| 1959 return CSSStringValue::create(pathString); | |
| 1960 } | |
| 1961 | |
| 1950 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) | 1962 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) |
| 1951 { | 1963 { |
| 1952 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 1964 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 1953 switch (property) { | 1965 switch (property) { |
| 1954 case CSSPropertyWillChange: | 1966 case CSSPropertyWillChange: |
| 1955 return consumeWillChange(m_range); | 1967 return consumeWillChange(m_range); |
| 1956 case CSSPropertyPage: | 1968 case CSSPropertyPage: |
| 1957 return consumePage(m_range); | 1969 return consumePage(m_range); |
| 1958 case CSSPropertyQuotes: | 1970 case CSSPropertyQuotes: |
| 1959 return consumeQuotes(m_range); | 1971 return consumeQuotes(m_range); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2123 case CSSPropertyMarkerMid: | 2135 case CSSPropertyMarkerMid: |
| 2124 case CSSPropertyMarkerEnd: | 2136 case CSSPropertyMarkerEnd: |
| 2125 return consumeNoneOrURI(m_range); | 2137 return consumeNoneOrURI(m_range); |
| 2126 case CSSPropertyFlexBasis: | 2138 case CSSPropertyFlexBasis: |
| 2127 return consumeFlexBasis(m_range, m_context.mode()); | 2139 return consumeFlexBasis(m_range, m_context.mode()); |
| 2128 case CSSPropertyFlexGrow: | 2140 case CSSPropertyFlexGrow: |
| 2129 case CSSPropertyFlexShrink: | 2141 case CSSPropertyFlexShrink: |
| 2130 return consumeNumber(m_range, ValueRangeNonNegative); | 2142 return consumeNumber(m_range, ValueRangeNonNegative); |
| 2131 case CSSPropertyStrokeDasharray: | 2143 case CSSPropertyStrokeDasharray: |
| 2132 return consumeStrokeDasharray(m_range); | 2144 return consumeStrokeDasharray(m_range); |
| 2145 case CSSPropertyD: | |
| 2146 return consumeSVGDPath(m_range); | |
| 2133 default: | 2147 default: |
| 2134 return nullptr; | 2148 return nullptr; |
| 2135 } | 2149 } |
| 2136 } | 2150 } |
| 2137 | 2151 |
| 2138 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) | 2152 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) |
| 2139 { | 2153 { |
| 2140 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); | 2154 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); |
| 2141 | 2155 |
| 2142 do { | 2156 do { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2718 return consumeFlex(important); | 2732 return consumeFlex(important); |
| 2719 case CSSPropertyFlexFlow: | 2733 case CSSPropertyFlexFlow: |
| 2720 return consumeShorthandGreedily(flexFlowShorthand(), important); | 2734 return consumeShorthandGreedily(flexFlowShorthand(), important); |
| 2721 default: | 2735 default: |
| 2722 m_currentShorthand = oldShorthand; | 2736 m_currentShorthand = oldShorthand; |
| 2723 return false; | 2737 return false; |
| 2724 } | 2738 } |
| 2725 } | 2739 } |
| 2726 | 2740 |
| 2727 } // namespace blink | 2741 } // namespace blink |
| OLD | NEW |