Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 912 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 912 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 913 case CSSPropertyWebkitOverflowScrolling: | 913 case CSSPropertyWebkitOverflowScrolling: |
| 914 if (valueID == CSSValueAuto || valueID == CSSValueTouch) | 914 if (valueID == CSSValueAuto || valueID == CSSValueTouch) |
| 915 return true; | 915 return true; |
| 916 break; | 916 break; |
| 917 #endif | 917 #endif |
| 918 case CSSPropertyWebkitPrintColorAdjust: | 918 case CSSPropertyWebkitPrintColorAdjust: |
| 919 if (valueID == CSSValueExact || valueID == CSSValueEconomy) | 919 if (valueID == CSSValueExact || valueID == CSSValueEconomy) |
| 920 return true; | 920 return true; |
| 921 break; | 921 break; |
| 922 #if ENABLE(CSS_REGIONS) | |
| 923 case CSSPropertyWebkitRegionBreakAfter: | 922 case CSSPropertyWebkitRegionBreakAfter: |
| 924 case CSSPropertyWebkitRegionBreakBefore: | 923 case CSSPropertyWebkitRegionBreakBefore: |
| 925 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSValueLeft || valueID == CSSValueRight)) | 924 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSValueLeft || valueID == CSSValueRight)) |
| 926 return true; | 925 return true; |
| 927 break; | 926 break; |
| 928 case CSSPropertyWebkitRegionBreakInside: | 927 case CSSPropertyWebkitRegionBreakInside: |
| 929 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueAvoid)) | 928 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueAvoid)) |
| 930 return true; | 929 return true; |
| 931 break; | 930 break; |
| 932 case CSSPropertyWebkitRegionOverflow: | 931 case CSSPropertyWebkitRegionOverflow: |
| 933 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueBreak)) | 932 if (parserContext.isCSSRegionsEnabled && (valueID == CSSValueAuto || val ueID == CSSValueBreak)) |
| 934 return true; | 933 return true; |
| 935 break; | 934 break; |
| 936 #endif | |
| 937 case CSSPropertyWebkitRtlOrdering: | 935 case CSSPropertyWebkitRtlOrdering: |
| 938 if (valueID == CSSValueLogical || valueID == CSSValueVisual) | 936 if (valueID == CSSValueLogical || valueID == CSSValueVisual) |
| 939 return true; | 937 return true; |
| 940 break; | 938 break; |
| 941 | 939 |
| 942 case CSSPropertyWebkitRubyPosition: | 940 case CSSPropertyWebkitRubyPosition: |
| 943 if (valueID == CSSValueBefore || valueID == CSSValueAfter) | 941 if (valueID == CSSValueBefore || valueID == CSSValueAfter) |
| 944 return true; | 942 return true; |
| 945 break; | 943 break; |
| 946 | 944 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 case CSSPropertyWebkitMarginAfterCollapse: | 1089 case CSSPropertyWebkitMarginAfterCollapse: |
| 1092 case CSSPropertyWebkitMarginBeforeCollapse: | 1090 case CSSPropertyWebkitMarginBeforeCollapse: |
| 1093 case CSSPropertyWebkitMarginBottomCollapse: | 1091 case CSSPropertyWebkitMarginBottomCollapse: |
| 1094 case CSSPropertyWebkitMarginTopCollapse: | 1092 case CSSPropertyWebkitMarginTopCollapse: |
| 1095 case CSSPropertyWebkitMarqueeDirection: | 1093 case CSSPropertyWebkitMarqueeDirection: |
| 1096 case CSSPropertyWebkitMarqueeStyle: | 1094 case CSSPropertyWebkitMarqueeStyle: |
| 1097 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 1095 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 1098 case CSSPropertyWebkitOverflowScrolling: | 1096 case CSSPropertyWebkitOverflowScrolling: |
| 1099 #endif | 1097 #endif |
| 1100 case CSSPropertyWebkitPrintColorAdjust: | 1098 case CSSPropertyWebkitPrintColorAdjust: |
| 1101 #if ENABLE(CSS_REGIONS) | |
| 1102 case CSSPropertyWebkitRegionBreakAfter: | 1099 case CSSPropertyWebkitRegionBreakAfter: |
| 1103 case CSSPropertyWebkitRegionBreakBefore: | 1100 case CSSPropertyWebkitRegionBreakBefore: |
| 1104 case CSSPropertyWebkitRegionBreakInside: | 1101 case CSSPropertyWebkitRegionBreakInside: |
| 1105 case CSSPropertyWebkitRegionOverflow: | 1102 case CSSPropertyWebkitRegionOverflow: |
| 1106 #endif | |
| 1107 case CSSPropertyWebkitRtlOrdering: | 1103 case CSSPropertyWebkitRtlOrdering: |
| 1108 case CSSPropertyWebkitRubyPosition: | 1104 case CSSPropertyWebkitRubyPosition: |
| 1109 #if ENABLE(CSS3_TEXT) | 1105 #if ENABLE(CSS3_TEXT) |
| 1110 case CSSPropertyWebkitTextAlignLast: | 1106 case CSSPropertyWebkitTextAlignLast: |
| 1111 #endif // CSS3_TEXT | 1107 #endif // CSS3_TEXT |
| 1112 case CSSPropertyWebkitTextCombine: | 1108 case CSSPropertyWebkitTextCombine: |
| 1113 case CSSPropertyWebkitTextEmphasisPosition: | 1109 case CSSPropertyWebkitTextEmphasisPosition: |
| 1114 case CSSPropertyWebkitTextSecurity: | 1110 case CSSPropertyWebkitTextSecurity: |
| 1115 case CSSPropertyWebkitTransformStyle: | 1111 case CSSPropertyWebkitTransformStyle: |
| 1116 case CSSPropertyWebkitUserDrag: | 1112 case CSSPropertyWebkitUserDrag: |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2424 validPrimitive = true; | 2420 validPrimitive = true; |
| 2425 else | 2421 else |
| 2426 validPrimitive = validUnit(value, FInteger | FNonNeg); | 2422 validPrimitive = validUnit(value, FInteger | FNonNeg); |
| 2427 break; | 2423 break; |
| 2428 case CSSPropertyWebkitMarqueeSpeed: | 2424 case CSSPropertyWebkitMarqueeSpeed: |
| 2429 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) | 2425 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) |
| 2430 validPrimitive = true; | 2426 validPrimitive = true; |
| 2431 else | 2427 else |
| 2432 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); | 2428 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); |
| 2433 break; | 2429 break; |
| 2434 #if ENABLE(CSS_REGIONS) | |
| 2435 case CSSPropertyWebkitFlowInto: | 2430 case CSSPropertyWebkitFlowInto: |
| 2436 if (!cssRegionsEnabled()) | 2431 if (!cssRegionsEnabled()) |
| 2437 return false; | 2432 return false; |
| 2438 return parseFlowThread(propId, important); | 2433 return parseFlowThread(propId, important); |
| 2439 case CSSPropertyWebkitFlowFrom: | 2434 case CSSPropertyWebkitFlowFrom: |
| 2440 if (!cssRegionsEnabled()) | 2435 if (!cssRegionsEnabled()) |
| 2441 return false; | 2436 return false; |
| 2442 return parseRegionThread(propId, important); | 2437 return parseRegionThread(propId, important); |
| 2443 #endif | |
| 2444 case CSSPropertyWebkitTransform: | 2438 case CSSPropertyWebkitTransform: |
| 2445 if (id == CSSValueNone) | 2439 if (id == CSSValueNone) |
| 2446 validPrimitive = true; | 2440 validPrimitive = true; |
| 2447 else { | 2441 else { |
| 2448 RefPtr<CSSValue> transformValue = parseTransform(); | 2442 RefPtr<CSSValue> transformValue = parseTransform(); |
| 2449 if (transformValue) { | 2443 if (transformValue) { |
| 2450 addProperty(propId, transformValue.release(), important); | 2444 addProperty(propId, transformValue.release(), important); |
| 2451 return true; | 2445 return true; |
| 2452 } | 2446 } |
| 2453 return false; | 2447 return false; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2920 case CSSPropertyWebkitMarginAfterCollapse: | 2914 case CSSPropertyWebkitMarginAfterCollapse: |
| 2921 case CSSPropertyWebkitMarginBeforeCollapse: | 2915 case CSSPropertyWebkitMarginBeforeCollapse: |
| 2922 case CSSPropertyWebkitMarginBottomCollapse: | 2916 case CSSPropertyWebkitMarginBottomCollapse: |
| 2923 case CSSPropertyWebkitMarginTopCollapse: | 2917 case CSSPropertyWebkitMarginTopCollapse: |
| 2924 case CSSPropertyWebkitMarqueeDirection: | 2918 case CSSPropertyWebkitMarqueeDirection: |
| 2925 case CSSPropertyWebkitMarqueeStyle: | 2919 case CSSPropertyWebkitMarqueeStyle: |
| 2926 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 2920 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 2927 case CSSPropertyWebkitOverflowScrolling: | 2921 case CSSPropertyWebkitOverflowScrolling: |
| 2928 #endif | 2922 #endif |
| 2929 case CSSPropertyWebkitPrintColorAdjust: | 2923 case CSSPropertyWebkitPrintColorAdjust: |
| 2930 #if ENABLE(CSS_REGIONS) | |
| 2931 case CSSPropertyWebkitRegionBreakAfter: | 2924 case CSSPropertyWebkitRegionBreakAfter: |
| 2932 case CSSPropertyWebkitRegionBreakBefore: | 2925 case CSSPropertyWebkitRegionBreakBefore: |
| 2933 case CSSPropertyWebkitRegionBreakInside: | 2926 case CSSPropertyWebkitRegionBreakInside: |
| 2934 case CSSPropertyWebkitRegionOverflow: | 2927 case CSSPropertyWebkitRegionOverflow: |
| 2935 #endif | |
| 2936 case CSSPropertyWebkitRtlOrdering: | 2928 case CSSPropertyWebkitRtlOrdering: |
| 2937 case CSSPropertyWebkitRubyPosition: | 2929 case CSSPropertyWebkitRubyPosition: |
| 2938 #if ENABLE(CSS3_TEXT) | 2930 #if ENABLE(CSS3_TEXT) |
| 2939 case CSSPropertyWebkitTextAlignLast: | 2931 case CSSPropertyWebkitTextAlignLast: |
| 2940 #endif // CSS3_TEXT | 2932 #endif // CSS3_TEXT |
| 2941 case CSSPropertyWebkitTextCombine: | 2933 case CSSPropertyWebkitTextCombine: |
| 2942 case CSSPropertyWebkitTextEmphasisPosition: | 2934 case CSSPropertyWebkitTextEmphasisPosition: |
| 2943 case CSSPropertyWebkitTextSecurity: | 2935 case CSSPropertyWebkitTextSecurity: |
| 2944 case CSSPropertyWebkitTransformStyle: | 2936 case CSSPropertyWebkitTransformStyle: |
| 2945 case CSSPropertyWebkitUserDrag: | 2937 case CSSPropertyWebkitUserDrag: |
| (...skipping 5728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8674 if (!filterValue) | 8666 if (!filterValue) |
| 8675 return 0; | 8667 return 0; |
| 8676 | 8668 |
| 8677 list->append(filterValue); | 8669 list->append(filterValue); |
| 8678 } | 8670 } |
| 8679 } | 8671 } |
| 8680 | 8672 |
| 8681 return list.release(); | 8673 return list.release(); |
| 8682 } | 8674 } |
| 8683 | 8675 |
| 8684 #if ENABLE(CSS_REGIONS) | |
| 8685 static bool validFlowName(const String& flowName) | 8676 static bool validFlowName(const String& flowName) |
| 8686 { | 8677 { |
| 8687 return !(equalIgnoringCase(flowName, "auto") | 8678 return !(equalIgnoringCase(flowName, "auto") |
| 8688 || equalIgnoringCase(flowName, "default") | 8679 || equalIgnoringCase(flowName, "default") |
| 8689 || equalIgnoringCase(flowName, "inherit") | 8680 || equalIgnoringCase(flowName, "inherit") |
| 8690 || equalIgnoringCase(flowName, "initial") | 8681 || equalIgnoringCase(flowName, "initial") |
| 8691 || equalIgnoringCase(flowName, "none")); | 8682 || equalIgnoringCase(flowName, "none")); |
| 8692 } | 8683 } |
| 8693 #endif | |
| 8694 | 8684 |
| 8695 bool CSSParser::cssRegionsEnabled() const | 8685 bool CSSParser::cssRegionsEnabled() const |
|
eseidel
2013/04/27 03:40:50
What is this for? Doesn't RuntimeEnabledFeatures
| |
| 8696 { | 8686 { |
| 8697 return m_context.isCSSRegionsEnabled; | 8687 return m_context.isCSSRegionsEnabled; |
| 8698 } | 8688 } |
| 8699 | 8689 |
| 8700 bool CSSParser::cssCompositingEnabled() const | 8690 bool CSSParser::cssCompositingEnabled() const |
| 8701 { | 8691 { |
| 8702 return m_context.isCSSCompositingEnabled; | 8692 return m_context.isCSSCompositingEnabled; |
| 8703 } | 8693 } |
| 8704 | 8694 |
| 8705 bool CSSParser::cssGridLayoutEnabled() const | 8695 bool CSSParser::cssGridLayoutEnabled() const |
| 8706 { | 8696 { |
| 8707 return m_context.isCSSGridLayoutEnabled; | 8697 return m_context.isCSSGridLayoutEnabled; |
| 8708 } | 8698 } |
| 8709 | 8699 |
| 8710 #if ENABLE(CSS_REGIONS) | |
| 8711 bool CSSParser::parseFlowThread(const String& flowName) | 8700 bool CSSParser::parseFlowThread(const String& flowName) |
| 8712 { | 8701 { |
| 8713 setupParser("@-internal-decls{-webkit-flow-into:", flowName, "}"); | 8702 setupParser("@-internal-decls{-webkit-flow-into:", flowName, "}"); |
| 8714 cssyyparse(this); | 8703 cssyyparse(this); |
| 8715 | 8704 |
| 8716 m_rule = 0; | 8705 m_rule = 0; |
| 8717 | 8706 |
| 8718 return ((m_parsedProperties.size() == 1) && (m_parsedProperties.first().id() == CSSPropertyWebkitFlowInto)); | 8707 return ((m_parsedProperties.size() == 1) && (m_parsedProperties.first().id() == CSSPropertyWebkitFlowInto)); |
| 8719 } | 8708 } |
| 8720 | 8709 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8773 if (!inputProperty.isEmpty()) { | 8762 if (!inputProperty.isEmpty()) { |
| 8774 if (!validFlowName(inputProperty)) | 8763 if (!validFlowName(inputProperty)) |
| 8775 return false; | 8764 return false; |
| 8776 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPri mitiveValue::CSS_STRING), important); | 8765 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPri mitiveValue::CSS_STRING), important); |
| 8777 } else | 8766 } else |
| 8778 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNon e), important); | 8767 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNon e), important); |
| 8779 } | 8768 } |
| 8780 | 8769 |
| 8781 return true; | 8770 return true; |
| 8782 } | 8771 } |
| 8783 #endif | |
| 8784 | 8772 |
| 8785 bool CSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId 1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefP tr<CSSValue>& value2, RefPtr<CSSValue>& value3) | 8773 bool CSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId 1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefP tr<CSSValue>& value2, RefPtr<CSSValue>& value3) |
| 8786 { | 8774 { |
| 8787 propId1 = propId; | 8775 propId1 = propId; |
| 8788 propId2 = propId; | 8776 propId2 = propId; |
| 8789 propId3 = propId; | 8777 propId3 = propId; |
| 8790 if (propId == CSSPropertyWebkitTransformOrigin) { | 8778 if (propId == CSSPropertyWebkitTransformOrigin) { |
| 8791 propId1 = CSSPropertyWebkitTransformOriginX; | 8779 propId1 = CSSPropertyWebkitTransformOriginX; |
| 8792 propId2 = CSSPropertyWebkitTransformOriginY; | 8780 propId2 = CSSPropertyWebkitTransformOriginY; |
| 8793 propId3 = CSSPropertyWebkitTransformOriginZ; | 8781 propId3 = CSSPropertyWebkitTransformOriginZ; |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10234 switch (length) { | 10222 switch (length) { |
| 10235 case 15: | 10223 case 15: |
| 10236 if (hasEscape) | 10224 if (hasEscape) |
| 10237 return; | 10225 return; |
| 10238 | 10226 |
| 10239 if (isEqualToCSSIdentifier(name + 2, "internal-rule")) { | 10227 if (isEqualToCSSIdentifier(name + 2, "internal-rule")) { |
| 10240 m_token = INTERNAL_RULE_SYM; | 10228 m_token = INTERNAL_RULE_SYM; |
| 10241 return; | 10229 return; |
| 10242 } | 10230 } |
| 10243 | 10231 |
| 10244 #if ENABLE(CSS_REGIONS) | |
| 10245 if (isASCIIAlphaCaselessEqual(name[14], 'n') && isEqualToCSSIdentifi er(name + 2, "webkit-regio")) { | 10232 if (isASCIIAlphaCaselessEqual(name[14], 'n') && isEqualToCSSIdentifi er(name + 2, "webkit-regio")) { |
| 10246 m_token = WEBKIT_REGION_RULE_SYM; | 10233 m_token = WEBKIT_REGION_RULE_SYM; |
| 10247 return; | 10234 return; |
| 10248 } | 10235 } |
| 10249 #endif | 10236 |
| 10250 if (isASCIIAlphaCaselessEqual(name[14], 'r') && isEqualToCSSIdentifi er(name + 2, "webkit-filte")) { | 10237 if (isASCIIAlphaCaselessEqual(name[14], 'r') && isEqualToCSSIdentifi er(name + 2, "webkit-filte")) { |
| 10251 m_token = WEBKIT_FILTER_RULE_SYM; | 10238 m_token = WEBKIT_FILTER_RULE_SYM; |
| 10252 return; | 10239 return; |
| 10253 } | 10240 } |
| 10254 return; | 10241 return; |
| 10255 | 10242 |
| 10256 case 16: | 10243 case 16: |
| 10257 if (hasEscape) | 10244 if (hasEscape) |
| 10258 return; | 10245 return; |
| 10259 | 10246 |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11725 { | 11712 { |
| 11726 // The tokenizer checks for the construct of an+b. | 11713 // The tokenizer checks for the construct of an+b. |
| 11727 // However, since the {ident} rule precedes the {nth} rule, some of those | 11714 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11728 // tokens are identified as string literal. Furthermore we need to accept | 11715 // tokens are identified as string literal. Furthermore we need to accept |
| 11729 // "odd" and "even" which does not match to an+b. | 11716 // "odd" and "even" which does not match to an+b. |
| 11730 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11717 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11731 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11718 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11732 } | 11719 } |
| 11733 | 11720 |
| 11734 } | 11721 } |
| OLD | NEW |