| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 return true; | 738 return true; |
| 739 break; | 739 break; |
| 740 case CSSPropertyInternalMarqueeStyle: | 740 case CSSPropertyInternalMarqueeStyle: |
| 741 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS
SValueScroll || valueID == CSSValueAlternate) | 741 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS
SValueScroll || valueID == CSSValueAlternate) |
| 742 return true; | 742 return true; |
| 743 break; | 743 break; |
| 744 case CSSPropertyWebkitPrintColorAdjust: | 744 case CSSPropertyWebkitPrintColorAdjust: |
| 745 if (valueID == CSSValueExact || valueID == CSSValueEconomy) | 745 if (valueID == CSSValueExact || valueID == CSSValueEconomy) |
| 746 return true; | 746 return true; |
| 747 break; | 747 break; |
| 748 case CSSPropertyWebkitRegionBreakAfter: | |
| 749 case CSSPropertyWebkitRegionBreakBefore: | |
| 750 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSVa
lueLeft || valueID == CSSValueRight)) | |
| 751 return true; | |
| 752 break; | |
| 753 case CSSPropertyWebkitRegionBreakInside: | |
| 754 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueAvoid)) | |
| 755 return true; | |
| 756 break; | |
| 757 case CSSPropertyWebkitRegionFragment: | |
| 758 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA
uto || valueID == CSSValueBreak)) | |
| 759 return true; | |
| 760 break; | |
| 761 case CSSPropertyWebkitRtlOrdering: | 748 case CSSPropertyWebkitRtlOrdering: |
| 762 if (valueID == CSSValueLogical || valueID == CSSValueVisual) | 749 if (valueID == CSSValueLogical || valueID == CSSValueVisual) |
| 763 return true; | 750 return true; |
| 764 break; | 751 break; |
| 765 | 752 |
| 766 case CSSPropertyWebkitRubyPosition: | 753 case CSSPropertyWebkitRubyPosition: |
| 767 if (valueID == CSSValueBefore || valueID == CSSValueAfter) | 754 if (valueID == CSSValueBefore || valueID == CSSValueAfter) |
| 768 return true; | 755 return true; |
| 769 break; | 756 break; |
| 770 | 757 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 case CSSPropertyWebkitFontSmoothing: | 890 case CSSPropertyWebkitFontSmoothing: |
| 904 case CSSPropertyGridAutoFlow: | 891 case CSSPropertyGridAutoFlow: |
| 905 case CSSPropertyWebkitLineBreak: | 892 case CSSPropertyWebkitLineBreak: |
| 906 case CSSPropertyWebkitMarginAfterCollapse: | 893 case CSSPropertyWebkitMarginAfterCollapse: |
| 907 case CSSPropertyWebkitMarginBeforeCollapse: | 894 case CSSPropertyWebkitMarginBeforeCollapse: |
| 908 case CSSPropertyWebkitMarginBottomCollapse: | 895 case CSSPropertyWebkitMarginBottomCollapse: |
| 909 case CSSPropertyWebkitMarginTopCollapse: | 896 case CSSPropertyWebkitMarginTopCollapse: |
| 910 case CSSPropertyInternalMarqueeDirection: | 897 case CSSPropertyInternalMarqueeDirection: |
| 911 case CSSPropertyInternalMarqueeStyle: | 898 case CSSPropertyInternalMarqueeStyle: |
| 912 case CSSPropertyWebkitPrintColorAdjust: | 899 case CSSPropertyWebkitPrintColorAdjust: |
| 913 case CSSPropertyWebkitRegionBreakAfter: | |
| 914 case CSSPropertyWebkitRegionBreakBefore: | |
| 915 case CSSPropertyWebkitRegionBreakInside: | |
| 916 case CSSPropertyWebkitRegionFragment: | |
| 917 case CSSPropertyWebkitRtlOrdering: | 900 case CSSPropertyWebkitRtlOrdering: |
| 918 case CSSPropertyWebkitRubyPosition: | 901 case CSSPropertyWebkitRubyPosition: |
| 919 case CSSPropertyWebkitTextCombine: | 902 case CSSPropertyWebkitTextCombine: |
| 920 case CSSPropertyWebkitTextEmphasisPosition: | 903 case CSSPropertyWebkitTextEmphasisPosition: |
| 921 case CSSPropertyWebkitTextSecurity: | 904 case CSSPropertyWebkitTextSecurity: |
| 922 case CSSPropertyWebkitTransformStyle: | 905 case CSSPropertyWebkitTransformStyle: |
| 923 case CSSPropertyWebkitUserDrag: | 906 case CSSPropertyWebkitUserDrag: |
| 924 case CSSPropertyWebkitUserModify: | 907 case CSSPropertyWebkitUserModify: |
| 925 case CSSPropertyWebkitUserSelect: | 908 case CSSPropertyWebkitUserSelect: |
| 926 case CSSPropertyWebkitWrapFlow: | 909 case CSSPropertyWebkitWrapFlow: |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 validPrimitive = true; | 2267 validPrimitive = true; |
| 2285 else | 2268 else |
| 2286 validPrimitive = validUnit(value, FInteger | FNonNeg); | 2269 validPrimitive = validUnit(value, FInteger | FNonNeg); |
| 2287 break; | 2270 break; |
| 2288 case CSSPropertyInternalMarqueeSpeed: | 2271 case CSSPropertyInternalMarqueeSpeed: |
| 2289 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) | 2272 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) |
| 2290 validPrimitive = true; | 2273 validPrimitive = true; |
| 2291 else | 2274 else |
| 2292 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); | 2275 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); |
| 2293 break; | 2276 break; |
| 2294 case CSSPropertyWebkitFlowInto: | |
| 2295 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
| 2296 return false; | |
| 2297 return parseFlowThread(propId, important); | |
| 2298 case CSSPropertyWebkitFlowFrom: | |
| 2299 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
| 2300 return false; | |
| 2301 return parseRegionThread(propId, important); | |
| 2302 case CSSPropertyWebkitTransform: | 2277 case CSSPropertyWebkitTransform: |
| 2303 if (id == CSSValueNone) | 2278 if (id == CSSValueNone) |
| 2304 validPrimitive = true; | 2279 validPrimitive = true; |
| 2305 else { | 2280 else { |
| 2306 RefPtr<CSSValue> transformValue = parseTransform(); | 2281 RefPtr<CSSValue> transformValue = parseTransform(); |
| 2307 if (transformValue) { | 2282 if (transformValue) { |
| 2308 addProperty(propId, transformValue.release(), important); | 2283 addProperty(propId, transformValue.release(), important); |
| 2309 return true; | 2284 return true; |
| 2310 } | 2285 } |
| 2311 return false; | 2286 return false; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 case CSSPropertyWebkitFontSmoothing: | 2742 case CSSPropertyWebkitFontSmoothing: |
| 2768 case CSSPropertyGridAutoFlow: | 2743 case CSSPropertyGridAutoFlow: |
| 2769 case CSSPropertyWebkitLineBreak: | 2744 case CSSPropertyWebkitLineBreak: |
| 2770 case CSSPropertyWebkitMarginAfterCollapse: | 2745 case CSSPropertyWebkitMarginAfterCollapse: |
| 2771 case CSSPropertyWebkitMarginBeforeCollapse: | 2746 case CSSPropertyWebkitMarginBeforeCollapse: |
| 2772 case CSSPropertyWebkitMarginBottomCollapse: | 2747 case CSSPropertyWebkitMarginBottomCollapse: |
| 2773 case CSSPropertyWebkitMarginTopCollapse: | 2748 case CSSPropertyWebkitMarginTopCollapse: |
| 2774 case CSSPropertyInternalMarqueeDirection: | 2749 case CSSPropertyInternalMarqueeDirection: |
| 2775 case CSSPropertyInternalMarqueeStyle: | 2750 case CSSPropertyInternalMarqueeStyle: |
| 2776 case CSSPropertyWebkitPrintColorAdjust: | 2751 case CSSPropertyWebkitPrintColorAdjust: |
| 2777 case CSSPropertyWebkitRegionBreakAfter: | |
| 2778 case CSSPropertyWebkitRegionBreakBefore: | |
| 2779 case CSSPropertyWebkitRegionBreakInside: | |
| 2780 case CSSPropertyWebkitRegionFragment: | |
| 2781 case CSSPropertyWebkitRtlOrdering: | 2752 case CSSPropertyWebkitRtlOrdering: |
| 2782 case CSSPropertyWebkitRubyPosition: | 2753 case CSSPropertyWebkitRubyPosition: |
| 2783 case CSSPropertyWebkitTextCombine: | 2754 case CSSPropertyWebkitTextCombine: |
| 2784 case CSSPropertyWebkitTextEmphasisPosition: | 2755 case CSSPropertyWebkitTextEmphasisPosition: |
| 2785 case CSSPropertyWebkitTextSecurity: | 2756 case CSSPropertyWebkitTextSecurity: |
| 2786 case CSSPropertyWebkitTransformStyle: | 2757 case CSSPropertyWebkitTransformStyle: |
| 2787 case CSSPropertyWebkitUserDrag: | 2758 case CSSPropertyWebkitUserDrag: |
| 2788 case CSSPropertyWebkitUserModify: | 2759 case CSSPropertyWebkitUserModify: |
| 2789 case CSSPropertyWebkitUserSelect: | 2760 case CSSPropertyWebkitUserSelect: |
| 2790 case CSSPropertyWebkitWrapFlow: | 2761 case CSSPropertyWebkitWrapFlow: |
| (...skipping 5986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8777 if (!filterValue) | 8748 if (!filterValue) |
| 8778 return 0; | 8749 return 0; |
| 8779 | 8750 |
| 8780 list->append(filterValue); | 8751 list->append(filterValue); |
| 8781 } | 8752 } |
| 8782 } | 8753 } |
| 8783 | 8754 |
| 8784 return list.release(); | 8755 return list.release(); |
| 8785 } | 8756 } |
| 8786 | 8757 |
| 8787 static bool validFlowName(const String& flowName) | |
| 8788 { | |
| 8789 return !(equalIgnoringCase(flowName, "auto") | |
| 8790 || equalIgnoringCase(flowName, "default") | |
| 8791 || equalIgnoringCase(flowName, "inherit") | |
| 8792 || equalIgnoringCase(flowName, "initial") | |
| 8793 || equalIgnoringCase(flowName, "none")); | |
| 8794 } | |
| 8795 | |
| 8796 // none | <ident> | |
| 8797 bool BisonCSSParser::parseFlowThread(CSSPropertyID propId, bool important) | |
| 8798 { | |
| 8799 ASSERT(propId == CSSPropertyWebkitFlowInto); | |
| 8800 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
| 8801 | |
| 8802 if (m_valueList->size() != 1) | |
| 8803 return false; | |
| 8804 | |
| 8805 CSSParserValue* value = m_valueList->current(); | |
| 8806 if (!value) | |
| 8807 return false; | |
| 8808 | |
| 8809 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | |
| 8810 return false; | |
| 8811 | |
| 8812 if (value->id == CSSValueNone) { | |
| 8813 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | |
| 8814 return true; | |
| 8815 } | |
| 8816 | |
| 8817 String inputProperty = String(value->string); | |
| 8818 if (!inputProperty.isEmpty()) { | |
| 8819 if (!validFlowName(inputProperty)) | |
| 8820 return false; | |
| 8821 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimiti
veValue::CSS_STRING), important); | |
| 8822 } else | |
| 8823 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone),
important); | |
| 8824 | |
| 8825 return true; | |
| 8826 } | |
| 8827 | |
| 8828 // -webkit-flow-from: none | <ident> | |
| 8829 bool BisonCSSParser::parseRegionThread(CSSPropertyID propId, bool important) | |
| 8830 { | |
| 8831 ASSERT(propId == CSSPropertyWebkitFlowFrom); | |
| 8832 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
| 8833 | |
| 8834 if (m_valueList->size() != 1) | |
| 8835 return false; | |
| 8836 | |
| 8837 CSSParserValue* value = m_valueList->current(); | |
| 8838 if (!value) | |
| 8839 return false; | |
| 8840 | |
| 8841 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | |
| 8842 return false; | |
| 8843 | |
| 8844 if (value->id == CSSValueNone) | |
| 8845 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | |
| 8846 else { | |
| 8847 String inputProperty = String(value->string); | |
| 8848 if (!inputProperty.isEmpty()) { | |
| 8849 if (!validFlowName(inputProperty)) | |
| 8850 return false; | |
| 8851 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPri
mitiveValue::CSS_STRING), important); | |
| 8852 } else | |
| 8853 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNon
e), important); | |
| 8854 } | |
| 8855 | |
| 8856 return true; | |
| 8857 } | |
| 8858 | |
| 8859 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p
ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value,
RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) | 8758 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p
ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value,
RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) |
| 8860 { | 8759 { |
| 8861 propId1 = propId; | 8760 propId1 = propId; |
| 8862 propId2 = propId; | 8761 propId2 = propId; |
| 8863 propId3 = propId; | 8762 propId3 = propId; |
| 8864 if (propId == CSSPropertyWebkitTransformOrigin) { | 8763 if (propId == CSSPropertyWebkitTransformOrigin) { |
| 8865 propId1 = CSSPropertyWebkitTransformOriginX; | 8764 propId1 = CSSPropertyWebkitTransformOriginX; |
| 8866 propId2 = CSSPropertyWebkitTransformOriginY; | 8765 propId2 = CSSPropertyWebkitTransformOriginY; |
| 8867 propId3 = CSSPropertyWebkitTransformOriginZ; | 8766 propId3 = CSSPropertyWebkitTransformOriginZ; |
| 8868 } | 8767 } |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9878 selectorVector.append(pageSelector); | 9777 selectorVector.append(pageSelector); |
| 9879 rule->parserAdoptSelectorVector(selectorVector); | 9778 rule->parserAdoptSelectorVector(selectorVector); |
| 9880 rule->setProperties(createStylePropertySet()); | 9779 rule->setProperties(createStylePropertySet()); |
| 9881 pageRule = rule.get(); | 9780 pageRule = rule.get(); |
| 9882 m_parsedRules.append(rule.release()); | 9781 m_parsedRules.append(rule.release()); |
| 9883 } | 9782 } |
| 9884 clearProperties(); | 9783 clearProperties(); |
| 9885 return pageRule; | 9784 return pageRule; |
| 9886 } | 9785 } |
| 9887 | 9786 |
| 9888 void BisonCSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSele
ctor> >* selectors) | |
| 9889 { | |
| 9890 if (selectors) | |
| 9891 m_reusableRegionSelectorVector.swap(*selectors); | |
| 9892 } | |
| 9893 | |
| 9894 StyleRuleBase* BisonCSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector>
>* regionSelector, RuleList* rules) | |
| 9895 { | |
| 9896 if (m_context.useCounter()) | |
| 9897 m_context.useCounter()->count(UseCounter::CSSWebkitRegionAtRule); | |
| 9898 | |
| 9899 if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rule
s) | |
| 9900 return 0; | |
| 9901 | |
| 9902 m_allowImportRules = m_allowNamespaceDeclarations = false; | |
| 9903 | |
| 9904 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); | |
| 9905 | |
| 9906 StyleRuleRegion* result = regionRule.get(); | |
| 9907 m_parsedRules.append(regionRule.release()); | |
| 9908 if (m_observer) | |
| 9909 m_observer->startEndUnknownRule(); | |
| 9910 | |
| 9911 return result; | |
| 9912 } | |
| 9913 | |
| 9914 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /*
marginBox */) | 9787 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /*
marginBox */) |
| 9915 { | 9788 { |
| 9916 // FIXME: Implement margin at-rule here, using: | 9789 // FIXME: Implement margin at-rule here, using: |
| 9917 // - marginBox: margin box | 9790 // - marginBox: margin box |
| 9918 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa
rginBox, m_parsedProperties.size()] are for this at-rule. | 9791 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa
rginBox, m_parsedProperties.size()] are for this at-rule. |
| 9919 // 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. | 9792 // 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. |
| 9920 | 9793 |
| 9921 endDeclarationsForMarginBox(); | 9794 endDeclarationsForMarginBox(); |
| 9922 return 0; // until this method is implemented. | 9795 return 0; // until this method is implemented. |
| 9923 } | 9796 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10223 { | 10096 { |
| 10224 // The tokenizer checks for the construct of an+b. | 10097 // The tokenizer checks for the construct of an+b. |
| 10225 // However, since the {ident} rule precedes the {nth} rule, some of those | 10098 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 10226 // tokens are identified as string literal. Furthermore we need to accept | 10099 // tokens are identified as string literal. Furthermore we need to accept |
| 10227 // "odd" and "even" which does not match to an+b. | 10100 // "odd" and "even" which does not match to an+b. |
| 10228 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10101 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 10229 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10102 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 10230 } | 10103 } |
| 10231 | 10104 |
| 10232 } | 10105 } |
| OLD | NEW |