Changeset 207622 in webkit
- Timestamp:
- Oct 20, 2016 10:25:01 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207621 r207622 1 2016-10-20 Dave Hyatt <hyatt@apple.com> 2 3 [CSS Parser] Fix font family parsing and add CSS region property parsing 4 https://bugs.webkit.org/show_bug.cgi?id=163741 5 6 Reviewed by Zalan Bujtas. 7 8 * css/parser/CSSParser.cpp: 9 (WebCore::isKeywordPropertyID): 10 (WebCore::parseKeywordValue): 11 (WebCore::CSSParser::parseValue): 12 Modify the old CSSParser to have its own keyword check, since keywords were 13 incorrectly added to the new parser when this check was consolidated. Column 14 and region breaks are considered keyword properties by the old parser, but 15 not by the new parser, since the new parser special cases them and maps them 16 into the generic break property. 17 18 * css/parser/CSSParserFastPaths.cpp: 19 (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 20 (WebCore::CSSParserFastPaths::isKeywordPropertyID): 21 Update for regions to make sure all the region properties are there. Remove the 22 column and region break properties, since they're not supposed to be here in the 23 new parser. 24 25 * css/parser/CSSPropertyParser.cpp: 26 (WebCore::consumeFamilyName): 27 Fix font parsing to make font family values so that fonts work. 28 29 (WebCore::consumeFlowProperty): 30 Add a function for handling -webkit-flow-from and -webkit-flow-into. 31 32 (WebCore::CSSPropertyParser::parseSingleValue): 33 Add support for the region properties. 34 35 (WebCore::mapFromRegionBreakBetween): 36 (WebCore::mapFromColumnRegionOrPageBreakInside): 37 (WebCore::mapFromLegacyBreakProperty): 38 (WebCore::CSSPropertyParser::consumeLegacyBreakProperty): 39 (WebCore::mapFromColumnOrPageBreakInside): Deleted. 40 Update to handle the region break properties in the same way that column break 41 properties are handled. 42 1 43 2016-10-20 Jer Noble <jer.noble@apple.com> 2 44 -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r207581 r207622 1150 1150 } 1151 1151 1152 static bool isKeywordPropertyID(CSSPropertyID propertyID) 1153 { 1154 switch (propertyID) { 1155 case CSSPropertyWebkitColumnBreakAfter: 1156 case CSSPropertyWebkitColumnBreakBefore: 1157 case CSSPropertyWebkitColumnBreakInside: 1158 #if ENABLE(CSS_REGIONS) 1159 case CSSPropertyWebkitRegionBreakAfter: 1160 case CSSPropertyWebkitRegionBreakBefore: 1161 case CSSPropertyWebkitRegionBreakInside: 1162 #endif 1163 return true; 1164 default: 1165 break; 1166 } 1167 1168 return CSSParserFastPaths::isKeywordPropertyID(propertyID); 1169 } 1170 1152 1171 static CSSParser::ParseResult parseKeywordValue(MutableStyleProperties& declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext, StyleSheetContents* styleSheetContents) 1153 1172 { 1154 1173 ASSERT(!string.isEmpty()); 1155 1174 1156 if (! CSSParserFastPaths::isKeywordPropertyID(propertyId)) {1175 if (!isKeywordPropertyID(propertyId)) { 1157 1176 if (!isUniversalKeyword(string)) 1158 1177 return CSSParser::ParseResult::Error; … … 1843 1862 return false; // "all" doesn't allow you to specify anything other than inherit/initial/unset. 1844 1863 1845 if ( CSSParserFastPaths::isKeywordPropertyID(propId)) {1864 if (isKeywordPropertyID(propId)) { 1846 1865 if (!isValidKeywordPropertyAndValue(propId, id, m_context, m_styleSheet)) 1847 1866 return false; -
trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp
r207567 r207622 746 746 case CSSPropertyWebkitBorderFit: 747 747 return valueID == CSSValueBorder || valueID == CSSValueLines; 748 #if ENABLE(CSS_REGIONS) 749 case CSSPropertyWebkitRegionFragment: 750 return valueID == CSSValueAuto || valueID == CSSValueBreak; 751 #endif 748 752 #if ENABLE(CSS_SCROLL_SNAP) 749 753 case CSSPropertyWebkitScrollSnapType: // none | mandatory | proximity … … 840 844 case CSSPropertyWebkitBoxPack: 841 845 case CSSPropertyWebkitColumnAxis: 842 case CSSPropertyWebkitColumnBreakAfter:843 case CSSPropertyWebkitColumnBreakBefore:844 case CSSPropertyWebkitColumnBreakInside:845 846 case CSSPropertyWebkitFontKerning: 846 847 case CSSPropertyWebkitFontSmoothing: … … 931 932 #endif 932 933 #if ENABLE(CSS_REGIONS) 933 case CSSPropertyWebkitRegionBreakAfter:934 case CSSPropertyWebkitRegionBreakBefore:935 case CSSPropertyWebkitRegionBreakInside:936 934 case CSSPropertyWebkitRegionFragment: 937 935 #endif -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r207549 r207622 707 707 { 708 708 if (range.peek().type() == StringToken) 709 return CSS PrimitiveValue::create(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitTypes::CSS_STRING);709 return CSSValuePool::singleton().createFontFamilyValue(range.consumeIncludingWhitespace().value().toString()); 710 710 if (range.peek().type() != IdentToken) 711 711 return nullptr; … … 713 713 if (familyName.isNull()) 714 714 return nullptr; 715 return CSS PrimitiveValue::create(familyName, CSSPrimitiveValue::UnitTypes::CSS_STRING);715 return CSSValuePool::singleton().createFontFamilyValue(familyName); 716 716 } 717 717 … … 3007 3007 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); 3008 3008 } 3009 3010 #if ENABLE(CSS_REGIONS) 3011 static RefPtr<CSSValue> consumeFlowProperty(CSSParserTokenRange& range) 3012 { 3013 RefPtr<CSSValue> result; 3014 if (range.peek().id() == CSSValueNone) 3015 result = consumeIdent(range); 3016 else 3017 result = consumeCustomIdent(range); 3018 return result; 3019 } 3020 #endif 3009 3021 3010 3022 RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSSPropertyID currentShorthand) … … 3369 3381 case CSSPropertyGridAutoFlow: 3370 3382 return consumeGridAutoFlow(m_range); 3383 #if ENABLE(CSS_REGIONS) 3384 case CSSPropertyWebkitFlowInto: 3385 case CSSPropertyWebkitFlowFrom: 3386 return consumeFlowProperty(m_range); 3387 #endif 3371 3388 default: 3372 3389 return nullptr; … … 4001 4018 } 4002 4019 4003 static inline CSSValueID mapFromColumnOrPageBreakInside(CSSValueID value) 4020 #if ENABLE(CSS_REGIONS) 4021 static inline CSSValueID mapFromRegionBreakBetween(CSSValueID value) 4022 { 4023 if (value == CSSValueAlways) 4024 return CSSValueRegion; 4025 if (value == CSSValueAuto || value == CSSValueAvoid) 4026 return value; 4027 return CSSValueInvalid; 4028 } 4029 #endif 4030 4031 static inline CSSValueID mapFromColumnRegionOrPageBreakInside(CSSValueID value) 4004 4032 { 4005 4033 if (value == CSSValueAuto || value == CSSValueAvoid) … … 4014 4042 if (property == CSSPropertyPageBreakBefore || property == CSSPropertyWebkitColumnBreakBefore) 4015 4043 return CSSPropertyBreakBefore; 4044 #if ENABLE(CSS_REGIONS) 4045 if (property == CSSPropertyWebkitRegionBreakAfter) 4046 return CSSPropertyBreakAfter; 4047 if (property == CSSPropertyWebkitRegionBreakBefore) 4048 return CSSPropertyBreakBefore; 4049 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebkitColumnBreakInside || property == CSSPropertyWebkitRegionBreakInside); 4050 #else 4016 4051 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebkitColumnBreakInside); 4052 #endif 4017 4053 return CSSPropertyBreakInside; 4018 4054 } … … 4038 4074 value = mapFromColumnBreakBetween(value); 4039 4075 break; 4076 #if ENABLE(CSS_REGIONS) 4077 case CSSPropertyWebkitRegionBreakAfter: 4078 case CSSPropertyWebkitRegionBreakBefore: 4079 value = mapFromRegionBreakBetween(value); 4080 break; 4081 case CSSPropertyWebkitRegionBreakInside: 4082 #endif 4040 4083 case CSSPropertyPageBreakInside: 4041 4084 case CSSPropertyWebkitColumnBreakInside: 4042 value = mapFromColumn OrPageBreakInside(value);4085 value = mapFromColumnRegionOrPageBreakInside(value); 4043 4086 break; 4044 4087 default:
Note: See TracChangeset
for help on using the changeset viewer.