Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 134473008: Remove CSS regions support, keeping a bare minimum to support "region-based" multicol. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review: Revert changes in Source/devtools/Inspector-1.1.json Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 return true; 746 return true;
747 break; 747 break;
748 case CSSPropertyInternalMarqueeStyle: 748 case CSSPropertyInternalMarqueeStyle:
749 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS SValueScroll || valueID == CSSValueAlternate) 749 if (valueID == CSSValueNone || valueID == CSSValueSlide || valueID == CS SValueScroll || valueID == CSSValueAlternate)
750 return true; 750 return true;
751 break; 751 break;
752 case CSSPropertyWebkitPrintColorAdjust: 752 case CSSPropertyWebkitPrintColorAdjust:
753 if (valueID == CSSValueExact || valueID == CSSValueEconomy) 753 if (valueID == CSSValueExact || valueID == CSSValueEconomy)
754 return true; 754 return true;
755 break; 755 break;
756 case CSSPropertyWebkitRegionBreakAfter:
757 case CSSPropertyWebkitRegionBreakBefore:
758 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA uto || valueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSVa lueLeft || valueID == CSSValueRight))
759 return true;
760 break;
761 case CSSPropertyWebkitRegionBreakInside:
762 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA uto || valueID == CSSValueAvoid))
763 return true;
764 break;
765 case CSSPropertyWebkitRegionFragment:
766 if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueA uto || valueID == CSSValueBreak))
767 return true;
768 break;
769 case CSSPropertyWebkitRtlOrdering: 756 case CSSPropertyWebkitRtlOrdering:
770 if (valueID == CSSValueLogical || valueID == CSSValueVisual) 757 if (valueID == CSSValueLogical || valueID == CSSValueVisual)
771 return true; 758 return true;
772 break; 759 break;
773 760
774 case CSSPropertyWebkitRubyPosition: 761 case CSSPropertyWebkitRubyPosition:
775 if (valueID == CSSValueBefore || valueID == CSSValueAfter) 762 if (valueID == CSSValueBefore || valueID == CSSValueAfter)
776 return true; 763 return true;
777 break; 764 break;
778 765
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 case CSSPropertyWebkitLineAlign: 900 case CSSPropertyWebkitLineAlign:
914 case CSSPropertyWebkitLineBreak: 901 case CSSPropertyWebkitLineBreak:
915 case CSSPropertyWebkitLineSnap: 902 case CSSPropertyWebkitLineSnap:
916 case CSSPropertyWebkitMarginAfterCollapse: 903 case CSSPropertyWebkitMarginAfterCollapse:
917 case CSSPropertyWebkitMarginBeforeCollapse: 904 case CSSPropertyWebkitMarginBeforeCollapse:
918 case CSSPropertyWebkitMarginBottomCollapse: 905 case CSSPropertyWebkitMarginBottomCollapse:
919 case CSSPropertyWebkitMarginTopCollapse: 906 case CSSPropertyWebkitMarginTopCollapse:
920 case CSSPropertyInternalMarqueeDirection: 907 case CSSPropertyInternalMarqueeDirection:
921 case CSSPropertyInternalMarqueeStyle: 908 case CSSPropertyInternalMarqueeStyle:
922 case CSSPropertyWebkitPrintColorAdjust: 909 case CSSPropertyWebkitPrintColorAdjust:
923 case CSSPropertyWebkitRegionBreakAfter:
924 case CSSPropertyWebkitRegionBreakBefore:
925 case CSSPropertyWebkitRegionBreakInside:
926 case CSSPropertyWebkitRegionFragment:
927 case CSSPropertyWebkitRtlOrdering: 910 case CSSPropertyWebkitRtlOrdering:
928 case CSSPropertyWebkitRubyPosition: 911 case CSSPropertyWebkitRubyPosition:
929 case CSSPropertyWebkitTextCombine: 912 case CSSPropertyWebkitTextCombine:
930 case CSSPropertyWebkitTextEmphasisPosition: 913 case CSSPropertyWebkitTextEmphasisPosition:
931 case CSSPropertyWebkitTextSecurity: 914 case CSSPropertyWebkitTextSecurity:
932 case CSSPropertyWebkitTransformStyle: 915 case CSSPropertyWebkitTransformStyle:
933 case CSSPropertyWebkitUserDrag: 916 case CSSPropertyWebkitUserDrag:
934 case CSSPropertyWebkitUserModify: 917 case CSSPropertyWebkitUserModify:
935 case CSSPropertyWebkitUserSelect: 918 case CSSPropertyWebkitUserSelect:
936 case CSSPropertyWebkitWrapFlow: 919 case CSSPropertyWebkitWrapFlow:
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 validPrimitive = true; 2277 validPrimitive = true;
2295 else 2278 else
2296 validPrimitive = validUnit(value, FInteger | FNonNeg); 2279 validPrimitive = validUnit(value, FInteger | FNonNeg);
2297 break; 2280 break;
2298 case CSSPropertyInternalMarqueeSpeed: 2281 case CSSPropertyInternalMarqueeSpeed:
2299 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) 2282 if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast)
2300 validPrimitive = true; 2283 validPrimitive = true;
2301 else 2284 else
2302 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); 2285 validPrimitive = validUnit(value, FTime | FInteger | FNonNeg);
2303 break; 2286 break;
2304 case CSSPropertyWebkitFlowInto:
2305 if (!RuntimeEnabledFeatures::cssRegionsEnabled())
2306 return false;
2307 return parseFlowThread(propId, important);
2308 case CSSPropertyWebkitFlowFrom:
2309 if (!RuntimeEnabledFeatures::cssRegionsEnabled())
2310 return false;
2311 return parseRegionThread(propId, important);
2312 case CSSPropertyWebkitTransform: 2287 case CSSPropertyWebkitTransform:
2313 if (id == CSSValueNone) 2288 if (id == CSSValueNone)
2314 validPrimitive = true; 2289 validPrimitive = true;
2315 else { 2290 else {
2316 RefPtr<CSSValue> transformValue = parseTransform(); 2291 RefPtr<CSSValue> transformValue = parseTransform();
2317 if (transformValue) { 2292 if (transformValue) {
2318 addProperty(propId, transformValue.release(), important); 2293 addProperty(propId, transformValue.release(), important);
2319 return true; 2294 return true;
2320 } 2295 }
2321 return false; 2296 return false;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 case CSSPropertyWebkitLineAlign: 2765 case CSSPropertyWebkitLineAlign:
2791 case CSSPropertyWebkitLineBreak: 2766 case CSSPropertyWebkitLineBreak:
2792 case CSSPropertyWebkitLineSnap: 2767 case CSSPropertyWebkitLineSnap:
2793 case CSSPropertyWebkitMarginAfterCollapse: 2768 case CSSPropertyWebkitMarginAfterCollapse:
2794 case CSSPropertyWebkitMarginBeforeCollapse: 2769 case CSSPropertyWebkitMarginBeforeCollapse:
2795 case CSSPropertyWebkitMarginBottomCollapse: 2770 case CSSPropertyWebkitMarginBottomCollapse:
2796 case CSSPropertyWebkitMarginTopCollapse: 2771 case CSSPropertyWebkitMarginTopCollapse:
2797 case CSSPropertyInternalMarqueeDirection: 2772 case CSSPropertyInternalMarqueeDirection:
2798 case CSSPropertyInternalMarqueeStyle: 2773 case CSSPropertyInternalMarqueeStyle:
2799 case CSSPropertyWebkitPrintColorAdjust: 2774 case CSSPropertyWebkitPrintColorAdjust:
2800 case CSSPropertyWebkitRegionBreakAfter:
2801 case CSSPropertyWebkitRegionBreakBefore:
2802 case CSSPropertyWebkitRegionBreakInside:
2803 case CSSPropertyWebkitRegionFragment:
2804 case CSSPropertyWebkitRtlOrdering: 2775 case CSSPropertyWebkitRtlOrdering:
2805 case CSSPropertyWebkitRubyPosition: 2776 case CSSPropertyWebkitRubyPosition:
2806 case CSSPropertyWebkitTextCombine: 2777 case CSSPropertyWebkitTextCombine:
2807 case CSSPropertyWebkitTextEmphasisPosition: 2778 case CSSPropertyWebkitTextEmphasisPosition:
2808 case CSSPropertyWebkitTextSecurity: 2779 case CSSPropertyWebkitTextSecurity:
2809 case CSSPropertyWebkitTransformStyle: 2780 case CSSPropertyWebkitTransformStyle:
2810 case CSSPropertyWebkitUserDrag: 2781 case CSSPropertyWebkitUserDrag:
2811 case CSSPropertyWebkitUserModify: 2782 case CSSPropertyWebkitUserModify:
2812 case CSSPropertyWebkitUserSelect: 2783 case CSSPropertyWebkitUserSelect:
2813 case CSSPropertyWebkitWrapFlow: 2784 case CSSPropertyWebkitWrapFlow:
(...skipping 5986 matching lines...) Expand 10 before | Expand all | Expand 10 after
8800 if (!filterValue) 8771 if (!filterValue)
8801 return 0; 8772 return 0;
8802 8773
8803 list->append(filterValue); 8774 list->append(filterValue);
8804 } 8775 }
8805 } 8776 }
8806 8777
8807 return list.release(); 8778 return list.release();
8808 } 8779 }
8809 8780
8810 static bool validFlowName(const String& flowName)
8811 {
8812 return !(equalIgnoringCase(flowName, "auto")
8813 || equalIgnoringCase(flowName, "default")
8814 || equalIgnoringCase(flowName, "inherit")
8815 || equalIgnoringCase(flowName, "initial")
8816 || equalIgnoringCase(flowName, "none"));
8817 }
8818
8819 // none | <ident>
8820 bool BisonCSSParser::parseFlowThread(CSSPropertyID propId, bool important)
8821 {
8822 ASSERT(propId == CSSPropertyWebkitFlowInto);
8823 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
8824
8825 if (m_valueList->size() != 1)
8826 return false;
8827
8828 CSSParserValue* value = m_valueList->current();
8829 if (!value)
8830 return false;
8831
8832 if (value->unit != CSSPrimitiveValue::CSS_IDENT)
8833 return false;
8834
8835 if (value->id == CSSValueNone) {
8836 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
8837 return true;
8838 }
8839
8840 String inputProperty = String(value->string);
8841 if (!inputProperty.isEmpty()) {
8842 if (!validFlowName(inputProperty))
8843 return false;
8844 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimiti veValue::CSS_STRING), important);
8845 } else
8846 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important);
8847
8848 return true;
8849 }
8850
8851 // -webkit-flow-from: none | <ident>
8852 bool BisonCSSParser::parseRegionThread(CSSPropertyID propId, bool important)
8853 {
8854 ASSERT(propId == CSSPropertyWebkitFlowFrom);
8855 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
8856
8857 if (m_valueList->size() != 1)
8858 return false;
8859
8860 CSSParserValue* value = m_valueList->current();
8861 if (!value)
8862 return false;
8863
8864 if (value->unit != CSSPrimitiveValue::CSS_IDENT)
8865 return false;
8866
8867 if (value->id == CSSValueNone)
8868 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
8869 else {
8870 String inputProperty = String(value->string);
8871 if (!inputProperty.isEmpty()) {
8872 if (!validFlowName(inputProperty))
8873 return false;
8874 addProperty(propId, cssValuePool().createValue(inputProperty, CSSPri mitiveValue::CSS_STRING), important);
8875 } else
8876 addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNon e), important);
8877 }
8878
8879 return true;
8880 }
8881
8882 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) 8781 bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& p ropId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
8883 { 8782 {
8884 propId1 = propId; 8783 propId1 = propId;
8885 propId2 = propId; 8784 propId2 = propId;
8886 propId3 = propId; 8785 propId3 = propId;
8887 if (propId == CSSPropertyWebkitTransformOrigin) { 8786 if (propId == CSSPropertyWebkitTransformOrigin) {
8888 propId1 = CSSPropertyWebkitTransformOriginX; 8787 propId1 = CSSPropertyWebkitTransformOriginX;
8889 propId2 = CSSPropertyWebkitTransformOriginY; 8788 propId2 = CSSPropertyWebkitTransformOriginY;
8890 propId3 = CSSPropertyWebkitTransformOriginZ; 8789 propId3 = CSSPropertyWebkitTransformOriginZ;
8891 } 8790 }
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
9901 selectorVector.append(pageSelector); 9800 selectorVector.append(pageSelector);
9902 rule->parserAdoptSelectorVector(selectorVector); 9801 rule->parserAdoptSelectorVector(selectorVector);
9903 rule->setProperties(createStylePropertySet()); 9802 rule->setProperties(createStylePropertySet());
9904 pageRule = rule.get(); 9803 pageRule = rule.get();
9905 m_parsedRules.append(rule.release()); 9804 m_parsedRules.append(rule.release());
9906 } 9805 }
9907 clearProperties(); 9806 clearProperties();
9908 return pageRule; 9807 return pageRule;
9909 } 9808 }
9910 9809
9911 void BisonCSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSele ctor> >* selectors)
9912 {
9913 if (selectors)
9914 m_reusableRegionSelectorVector.swap(*selectors);
9915 }
9916
9917 StyleRuleBase* BisonCSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* regionSelector, RuleList* rules)
9918 {
9919 if (m_context.useCounter())
9920 m_context.useCounter()->count(UseCounter::CSSWebkitRegionAtRule);
9921
9922 if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rule s)
9923 return 0;
9924
9925 m_allowImportRules = m_allowNamespaceDeclarations = false;
9926
9927 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector, *rules);
9928
9929 StyleRuleRegion* result = regionRule.get();
9930 m_parsedRules.append(regionRule.release());
9931 if (m_observer)
9932 m_observer->startEndUnknownRule();
9933
9934 return result;
9935 }
9936
9937 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */) 9810 StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */)
9938 { 9811 {
9939 // FIXME: Implement margin at-rule here, using: 9812 // FIXME: Implement margin at-rule here, using:
9940 // - marginBox: margin box 9813 // - marginBox: margin box
9941 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa rginBox, m_parsedProperties.size()] are for this at-rule. 9814 // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMa rginBox, m_parsedProperties.size()] are for this at-rule.
9942 // 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. 9815 // 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.
9943 9816
9944 endDeclarationsForMarginBox(); 9817 endDeclarationsForMarginBox();
9945 return 0; // until this method is implemented. 9818 return 0; // until this method is implemented.
9946 } 9819 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
10246 { 10119 {
10247 // The tokenizer checks for the construct of an+b. 10120 // The tokenizer checks for the construct of an+b.
10248 // However, since the {ident} rule precedes the {nth} rule, some of those 10121 // However, since the {ident} rule precedes the {nth} rule, some of those
10249 // tokens are identified as string literal. Furthermore we need to accept 10122 // tokens are identified as string literal. Furthermore we need to accept
10250 // "odd" and "even" which does not match to an+b. 10123 // "odd" and "even" which does not match to an+b.
10251 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10124 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10252 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10125 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10253 } 10126 }
10254 10127
10255 } 10128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698