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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 return true; | 748 return true; |
749 break; | 749 break; |
750 case CSSPropertyInternalMarqueeStyle: | 750 case CSSPropertyInternalMarqueeStyle: |
751 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS
SValueScroll || valueID == CSSValueAlternate) | 751 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS
SValueScroll || valueID == CSSValueAlternate) |
752 return true; | 752 return true; |
753 break; | 753 break; |
754 case CSSPropertyWebkitPrintColorAdjust: | 754 case CSSPropertyWebkitPrintColorAdjust: |
755 if (valueID == CSSValueExact || valueID == CSSValueEconomy) | 755 if (valueID == CSSValueExact || valueID == CSSValueEconomy) |
756 return true; | 756 return true; |
757 break; | 757 break; |
758 case CSSPropertyWebkitRegionBreakAfter: | |
759 case CSSPropertyWebkitRegionBreakBefore: | |
760 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSVa
lueLeft || valueID == CSSValueRight)) | |
761 return true; | |
762 break; | |
763 case CSSPropertyWebkitRegionBreakInside: | |
764 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueAvoid)) | |
765 return true; | |
766 break; | |
767 case CSSPropertyWebkitRegionFragment: | |
768 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueBreak)) | |
769 return true; | |
770 break; | |
771 case CSSPropertyWebkitRtlOrdering: | 758 case CSSPropertyWebkitRtlOrdering: |
772 if (valueID == CSSValueLogical || valueID == CSSValueVisual) | 759 if (valueID == CSSValueLogical || valueID == CSSValueVisual) |
773 return true; | 760 return true; |
774 break; | 761 break; |
775 | 762 |
776 case CSSPropertyWebkitRubyPosition: | 763 case CSSPropertyWebkitRubyPosition: |
777 if (valueID == CSSValueBefore || valueID == CSSValueAfter) | 764 if (valueID == CSSValueBefore || valueID == CSSValueAfter) |
778 return true; | 765 return true; |
779 break; | 766 break; |
780 | 767 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 case CSSPropertyWebkitLineAlign: | 902 case CSSPropertyWebkitLineAlign: |
916 case CSSPropertyWebkitLineBreak: | 903 case CSSPropertyWebkitLineBreak: |
917 case CSSPropertyWebkitLineSnap: | 904 case CSSPropertyWebkitLineSnap: |
918 case CSSPropertyWebkitMarginAfterCollapse: | 905 case CSSPropertyWebkitMarginAfterCollapse: |
919 case CSSPropertyWebkitMarginBeforeCollapse: | 906 case CSSPropertyWebkitMarginBeforeCollapse: |
920 case CSSPropertyWebkitMarginBottomCollapse: | 907 case CSSPropertyWebkitMarginBottomCollapse: |
921 case CSSPropertyWebkitMarginTopCollapse: | 908 case CSSPropertyWebkitMarginTopCollapse: |
922 case CSSPropertyInternalMarqueeDirection: | 909 case CSSPropertyInternalMarqueeDirection: |
923 case CSSPropertyInternalMarqueeStyle: | 910 case CSSPropertyInternalMarqueeStyle: |
924 case CSSPropertyWebkitPrintColorAdjust: | 911 case CSSPropertyWebkitPrintColorAdjust: |
925 case CSSPropertyWebkitRegionBreakAfter: | |
926 case CSSPropertyWebkitRegionBreakBefore: | |
927 case CSSPropertyWebkitRegionBreakInside: | |
928 case CSSPropertyWebkitRegionFragment: | |
929 case CSSPropertyWebkitRtlOrdering: | 912 case CSSPropertyWebkitRtlOrdering: |
930 case CSSPropertyWebkitRubyPosition: | 913 case CSSPropertyWebkitRubyPosition: |
931 case CSSPropertyWebkitTextCombine: | 914 case CSSPropertyWebkitTextCombine: |
932 case CSSPropertyWebkitTextEmphasisPosition: | 915 case CSSPropertyWebkitTextEmphasisPosition: |
933 case CSSPropertyWebkitTextSecurity: | 916 case CSSPropertyWebkitTextSecurity: |
934 case CSSPropertyWebkitTransformStyle: | 917 case CSSPropertyWebkitTransformStyle: |
935 case CSSPropertyWebkitUserDrag: | 918 case CSSPropertyWebkitUserDrag: |
936 case CSSPropertyWebkitUserModify: | 919 case CSSPropertyWebkitUserModify: |
937 case CSSPropertyWebkitUserSelect: | 920 case CSSPropertyWebkitUserSelect: |
938 case CSSPropertyWebkitWrapFlow: | 921 case CSSPropertyWebkitWrapFlow: |
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 validPrimitive = true; | 2318 validPrimitive = true; |
2336 else | 2319 else |
2337 validPrimitive = validUnit(value, FInteger | FNonNeg); | 2320 validPrimitive = validUnit(value, FInteger | FNonNeg); |
2338 break; | 2321 break; |
2339 case CSSPropertyInternalMarqueeSpeed: | 2322 case CSSPropertyInternalMarqueeSpeed: |
2340 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) | 2323 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) |
2341 validPrimitive = true; | 2324 validPrimitive = true; |
2342 else | 2325 else |
2343 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); | 2326 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); |
2344 break; | 2327 break; |
2345 case CSSPropertyWebkitFlowInto: | |
2346 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
2347 return false; | |
2348 return parseFlowThread(propId, important); | |
2349 case CSSPropertyWebkitFlowFrom: | |
2350 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
2351 return false; | |
2352 return parseRegionThread(propId, important); | |
2353 case CSSPropertyWebkitTransform: | 2328 case CSSPropertyWebkitTransform: |
2354 if (id == CSSValueNone) | 2329 if (id == CSSValueNone) |
2355 validPrimitive = true; | 2330 validPrimitive = true; |
2356 else { | 2331 else { |
2357 RefPtr<CSSValue> transformValue = parseTransform(); | 2332 RefPtr<CSSValue> transformValue = parseTransform(); |
2358 if (transformValue) { | 2333 if (transformValue) { |
2359 addProperty(propId, transformValue.release(), important); | 2334 addProperty(propId, transformValue.release(), important); |
2360 return true; | 2335 return true; |
2361 } | 2336 } |
2362 return false; | 2337 return false; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 case CSSPropertyWebkitLineAlign: | 2807 case CSSPropertyWebkitLineAlign: |
2833 case CSSPropertyWebkitLineBreak: | 2808 case CSSPropertyWebkitLineBreak: |
2834 case CSSPropertyWebkitLineSnap: | 2809 case CSSPropertyWebkitLineSnap: |
2835 case CSSPropertyWebkitMarginAfterCollapse: | 2810 case CSSPropertyWebkitMarginAfterCollapse: |
2836 case CSSPropertyWebkitMarginBeforeCollapse: | 2811 case CSSPropertyWebkitMarginBeforeCollapse: |
2837 case CSSPropertyWebkitMarginBottomCollapse: | 2812 case CSSPropertyWebkitMarginBottomCollapse: |
2838 case CSSPropertyWebkitMarginTopCollapse: | 2813 case CSSPropertyWebkitMarginTopCollapse: |
2839 case CSSPropertyInternalMarqueeDirection: | 2814 case CSSPropertyInternalMarqueeDirection: |
2840 case CSSPropertyInternalMarqueeStyle: | 2815 case CSSPropertyInternalMarqueeStyle: |
2841 case CSSPropertyWebkitPrintColorAdjust: | 2816 case CSSPropertyWebkitPrintColorAdjust: |
2842 case CSSPropertyWebkitRegionBreakAfter: | |
2843 case CSSPropertyWebkitRegionBreakBefore: | |
2844 case CSSPropertyWebkitRegionBreakInside: | |
2845 case CSSPropertyWebkitRegionFragment: | |
2846 case CSSPropertyWebkitRtlOrdering: | 2817 case CSSPropertyWebkitRtlOrdering: |
2847 case CSSPropertyWebkitRubyPosition: | 2818 case CSSPropertyWebkitRubyPosition: |
2848 case CSSPropertyWebkitTextCombine: | 2819 case CSSPropertyWebkitTextCombine: |
2849 case CSSPropertyWebkitTextEmphasisPosition: | 2820 case CSSPropertyWebkitTextEmphasisPosition: |
2850 case CSSPropertyWebkitTextSecurity: | 2821 case CSSPropertyWebkitTextSecurity: |
2851 case CSSPropertyWebkitTransformStyle: | 2822 case CSSPropertyWebkitTransformStyle: |
2852 case CSSPropertyWebkitUserDrag: | 2823 case CSSPropertyWebkitUserDrag: |
2853 case CSSPropertyWebkitUserModify: | 2824 case CSSPropertyWebkitUserModify: |
2854 case CSSPropertyWebkitUserSelect: | 2825 case CSSPropertyWebkitUserSelect: |
2855 case CSSPropertyWebkitWrapFlow: | 2826 case CSSPropertyWebkitWrapFlow: |
(...skipping 5983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8839 if (!filterValue) | 8810 if (!filterValue) |
8840 return 0; | 8811 return 0; |
8841 | 8812 |
8842 list->append(filterValue); | 8813 list->append(filterValue); |
8843 } | 8814 } |
8844 } | 8815 } |
8845 | 8816 |
8846 return list.release(); | 8817 return list.release(); |
8847 } | 8818 } |
8848 | 8819 |
8849 static bool validFlowName(const String& flowName) | |
8850 { | |
8851 return !(equalIgnoringCase(flowName, "auto") | |
8852 || equalIgnoringCase(flowName, "default") | |
8853 || equalIgnoringCase(flowName, "inherit") | |
8854 || equalIgnoringCase(flowName, "initial") | |
8855 || equalIgnoringCase(flowName, "none")); | |
8856 } | |
8857 | |
8858 // none | <ident> | |
8859 bool BisonCSSParser::parseFlowThread(CSSPropertyID propId, bool important) | |
8860 { | |
8861 ASSERT(propId == CSSPropertyWebkitFlowInto); | |
8862 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
8863 | |
8864 if (m_valueList->size() != 1) | |
8865 return false; | |
8866 | |
8867 CSSParserValue* value = m_valueList->current(); | |
8868 if (!value) | |
8869 return false; | |
8870 | |
8871 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | |
8872 return false; | |
8873 | |
8874 if (value->id == CSSValueNone) { | |
8875 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | |
8876 return true; | |
8877 } | |
8878 | |
8879 String inputProperty = String(value->string); | |
8880 if (!inputProperty.isEmpty()) { | |
8881 if (!validFlowName(inputProperty)) | |
8882 return false; | |
8883 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimiti
veValue::CSS_STRING), important); | |
8884 } else | |
8885 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone),
important); | |
8886 | |
8887 return true; | |
8888 } | |
8889 | |
8890 // -webkit-flow-from: none | <ident> | |
8891 bool BisonCSSParser::parseRegionThread(CSSPropertyID propId, bool important) | |
8892 { | |
8893 ASSERT(propId == CSSPropertyWebkitFlowFrom); | |
8894 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
8895 | |
8896 if (m_valueList->size() != 1) | |
8897 return false; | |
8898 | |
8899 CSSParserValue* value = m_valueList->current(); | |
8900 if (!value) | |
8901 return false; | |
8902 | |
8903 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | |
8904 return false; | |
8905 | |
8906 if (value->id == CSSValueNone) | |
8907 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | |
8908 else { | |
8909 String inputProperty = String(value->string); | |
8910 if (!inputProperty.isEmpty()) { | |
8911 if (!validFlowName(inputProperty)) | |
8912 return false; | |
8913 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPri
mitiveValue::CSS_STRING), important); | |
8914 } else | |
8915 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNon
e), important); | |
8916 } | |
8917 | |
8918 return true; | |
8919 } | |
8920 | |
8921 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p
ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value,
RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) | 8820 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p
ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value,
RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) |
8922 { | 8821 { |
8923 propId1 = propId; | 8822 propId1 = propId; |
8924 propId2 = propId; | 8823 propId2 = propId; |
8925 propId3 = propId; | 8824 propId3 = propId; |
8926 if (propId == CSSPropertyWebkitTransformOrigin) { | 8825 if (propId == CSSPropertyWebkitTransformOrigin) { |
8927 propId1 = CSSPropertyWebkitTransformOriginX; | 8826 propId1 = CSSPropertyWebkitTransformOriginX; |
8928 propId2 = CSSPropertyWebkitTransformOriginY; | 8827 propId2 = CSSPropertyWebkitTransformOriginY; |
8929 propId3 = CSSPropertyWebkitTransformOriginZ; | 8828 propId3 = CSSPropertyWebkitTransformOriginZ; |
8930 } | 8829 } |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9940 selectorVector.append(pageSelector); | 9839 selectorVector.append(pageSelector); |
9941 rule->parserAdoptSelectorVector(selectorVector); | 9840 rule->parserAdoptSelectorVector(selectorVector); |
9942 rule->setProperties(createStylePropertySet()); | 9841 rule->setProperties(createStylePropertySet()); |
9943 pageRule = rule.get(); | 9842 pageRule = rule.get(); |
9944 m_parsedRules.append(rule.release()); | 9843 m_parsedRules.append(rule.release()); |
9945 } | 9844 } |
9946 clearProperties(); | 9845 clearProperties(); |
9947 return pageRule; | 9846 return pageRule; |
9948 } | 9847 } |
9949 | 9848 |
9950 void BisonCSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSele
ctor> >* selectors) | |
9951 { | |
9952 if (selectors) | |
9953 m_reusableRegionSelectorVector.swap(*selectors); | |
9954 } | |
9955 | |
9956 StyleRuleBase* BisonCSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector>
>* regionSelector, RuleList* rules) | |
9957 { | |
9958 if (m_useCounter) | |
9959 m_useCounter->count(UseCounter::CSSWebkitRegionAtRule); | |
9960 | |
9961 if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rule
s) | |
9962 return 0; | |
9963 | |
9964 m_allowImportRules = m_allowNamespaceDeclarations = false; | |
9965 | |
9966 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); | |
9967 | |
9968 StyleRuleRegion* result = regionRule.get(); | |
9969 m_parsedRules.append(regionRule.release()); | |
9970 if (m_observer) | |
9971 m_observer->startEndUnknownRule(); | |
9972 | |
9973 return result; | |
9974 } | |
9975 | |
9976 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /*
marginBox */) | 9849 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /*
marginBox */) |
9977 { | 9850 { |
9978 // FIXME: Implement margin at-rule here, using: | 9851 // FIXME: Implement margin at-rule here, using: |
9979 // - marginBox: margin box | 9852 // - marginBox: margin box |
9980 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa
rginBox, m_parsedProperties.size()] are for this at-rule. | 9853 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa
rginBox, m_parsedProperties.size()] are for this at-rule. |
9981 // Don't forget to also update the action for page symbol in CSSGrammar.y su
ch that margin at-rule data is cleared if page_selector is invalid. | 9854 // Don't forget to also update the action for page symbol in CSSGrammar.y su
ch that margin at-rule data is cleared if page_selector is invalid. |
9982 | 9855 |
9983 endDeclarationsForMarginBox(); | 9856 endDeclarationsForMarginBox(); |
9984 return 0; // until this method is implemented. | 9857 return 0; // until this method is implemented. |
9985 } | 9858 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10285 { | 10158 { |
10286 // The tokenizer checks for the construct of an+b. | 10159 // The tokenizer checks for the construct of an+b. |
10287 // However, since the {ident} rule precedes the {nth} rule, some of those | 10160 // However, since the {ident} rule precedes the {nth} rule, some of those |
10288 // tokens are identified as string literal. Furthermore we need to accept | 10161 // tokens are identified as string literal. Furthermore we need to accept |
10289 // "odd" and "even" which does not match to an+b. | 10162 // "odd" and "even" which does not match to an+b. |
10290 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10163 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10291 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10164 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10292 } | 10165 } |
10293 | 10166 |
10294 } | 10167 } |
OLD | NEW |