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 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1770 if (list->hasValue(ident.get())) | 1770 if (list->hasValue(ident.get())) |
1771 return nullptr; | 1771 return nullptr; |
1772 list->append(ident.release()); | 1772 list->append(ident.release()); |
1773 } | 1773 } |
1774 | 1774 |
1775 if (!list->length()) | 1775 if (!list->length()) |
1776 return nullptr; | 1776 return nullptr; |
1777 return list.release(); | 1777 return list.release(); |
1778 } | 1778 } |
1779 | 1779 |
1780 // none | strict | [ layout || style || paint ] | |
1781 static PassRefPtrWillBeRawPtr<CSSValue> consumeContain(CSSParserTokenRange& rang e) | |
1782 { | |
1783 CSSValueID id = range.peek().id(); | |
1784 if (id == CSSValueNone) | |
1785 return consumeIdent(range); | |
1786 | |
1787 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; | |
Timothy Loh
2015/12/03 05:23:45
Can we just handle strict separately? e.g.
if (id
| |
1788 RefPtrWillBeRawPtr<CSSPrimitiveValue> ident = nullptr; | |
1789 bool isStrict = id == CSSValueStrict; | |
1790 while ((ident = consumeIdent<CSSValuePaint, CSSValueLayout, CSSValueStyle, C SSValueStrict>(range))) { | |
1791 if (list->hasValue(ident.get())) | |
1792 return nullptr; | |
1793 if ((list->length() && ident->getValueID() == CSSValueStrict) | |
1794 || (isStrict && ident->getValueID() != CSSValueStrict)) { | |
1795 return nullptr; | |
1796 } | |
1797 list->append(ident.release()); | |
1798 } | |
1799 | |
1800 if (!list->length()) | |
1801 return nullptr; | |
1802 return list.release(); | |
1803 } | |
1804 | |
1780 static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionPath(CSSParserTokenRange& r ange) | 1805 static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionPath(CSSParserTokenRange& r ange) |
1781 { | 1806 { |
1782 CSSValueID id = range.peek().id(); | 1807 CSSValueID id = range.peek().id(); |
1783 if (id == CSSValueNone) | 1808 if (id == CSSValueNone) |
1784 return consumeIdent(range); | 1809 return consumeIdent(range); |
1785 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | 1810 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. |
1786 if (range.peek().functionId() != CSSValuePath) | 1811 if (range.peek().functionId() != CSSValuePath) |
1787 return nullptr; | 1812 return nullptr; |
1788 | 1813 |
1789 // FIXME: Add support for <fill-rule>. | 1814 // FIXME: Add support for <fill-rule>. |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2346 case CSSPropertyStrokeWidth: | 2371 case CSSPropertyStrokeWidth: |
2347 case CSSPropertyStrokeDashoffset: | 2372 case CSSPropertyStrokeDashoffset: |
2348 case CSSPropertyCx: | 2373 case CSSPropertyCx: |
2349 case CSSPropertyCy: | 2374 case CSSPropertyCy: |
2350 case CSSPropertyX: | 2375 case CSSPropertyX: |
2351 case CSSPropertyY: | 2376 case CSSPropertyY: |
2352 case CSSPropertyR: | 2377 case CSSPropertyR: |
2353 case CSSPropertyRx: | 2378 case CSSPropertyRx: |
2354 case CSSPropertyRy: | 2379 case CSSPropertyRy: |
2355 return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll, UnitlessQuirk::Forbid); | 2380 return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll, UnitlessQuirk::Forbid); |
2381 case CSSPropertyContain: | |
2382 return consumeContain(m_range); | |
2356 default: | 2383 default: |
2357 return nullptr; | 2384 return nullptr; |
2358 } | 2385 } |
2359 } | 2386 } |
2360 | 2387 |
2361 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) | 2388 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) |
2362 { | 2389 { |
2363 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); | 2390 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); |
2364 | 2391 |
2365 do { | 2392 do { |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2943 return consumeShorthandGreedily(flexFlowShorthand(), important); | 2970 return consumeShorthandGreedily(flexFlowShorthand(), important); |
2944 case CSSPropertyWebkitColumnRule: | 2971 case CSSPropertyWebkitColumnRule: |
2945 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); | 2972 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); |
2946 default: | 2973 default: |
2947 m_currentShorthand = oldShorthand; | 2974 m_currentShorthand = oldShorthand; |
2948 return false; | 2975 return false; |
2949 } | 2976 } |
2950 } | 2977 } |
2951 | 2978 |
2952 } // namespace blink | 2979 } // namespace blink |
OLD | NEW |