Changeset 214546 in webkit
- Timestamp:
- Mar 29, 2017 10:40:21 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r214545 r214546 1 2017-03-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Variation fonts: Make sure that feature detection and preprocessor macros are right 4 https://bugs.webkit.org/show_bug.cgi?id=169518 5 6 Reviewed by Simon Fraser. 7 8 Create platform-specific results for mac-elcapitan which doesn't support variation fonts. 9 10 * fast/text/font-variations-feature-detection-expected.html: Added. 11 * fast/text/font-variations-feature-detection.html: Added. 12 * platform/ios-simulator/TestExpectations: 13 * platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt: 14 * platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt: Added. 15 * platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt: Added. 16 * platform/mac-elcapitan/fast/text/font-style-parse-expected.txt: Added. 17 * platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt: Added. 18 * platform/mac/TestExpectations: 19 1 20 2017-03-29 Antoine Quint <graouts@apple.com> 2 21 -
trunk/LayoutTests/platform/ios/TestExpectations
r214506 r214546 2743 2743 webkit.org/b/163093 fast/text/variations/outofbounds.html [ ImageOnlyFailure ] 2744 2744 webkit.org/b/163093 fast/text/variations/default-value.html [ ImageOnlyFailure ] 2745 webkit.org/b/169518 fast/text/font-variations-feature-detection.html [ ImageOnlyFailure ] 2745 2746 2746 2747 webkit.org/b/162647 http/tests/xmlhttprequest/onabort-response-getters.html [ Pass Failure ] -
trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt
r214507 r214546 1 PASS weightTestSheet.cssRules[0].style.fontWeight is "1" 1 FAIL weightTestSheet.cssRules[0].style.fontWeight should be 1. Was . 2 2 PASS weightTestSheet.cssRules[1].style.fontWeight is "100" 3 3 PASS weightTestSheet.cssRules[2].style.fontWeight is "200" … … 14 14 PASS weightTestSheet.cssRules[13].style.fontWeight is "" 15 15 PASS weightTestSheet.cssRules[14].style.fontWeight is "" 16 PASS weightTestSheet.cssRules[15].style.fontWeight is "7" 16 FAIL weightTestSheet.cssRules[15].style.fontWeight should be 7. Was . 17 17 PASS weightTestSheet.cssRules[16].style.fontWeight is "300" 18 18 PASS weightTestSheet.cssRules[17].style.fontWeight is "200" … … 30 30 FAIL weightTestSheet.cssRules[29].style.fontWeight should be 7 8. Was . 31 31 FAIL weightTestSheet.cssRules[30].style.fontWeight should be 2 7. Was . 32 PASS stretchTestSheet.cssRules[0].style.fontStretch is "1%" 32 FAIL stretchTestSheet.cssRules[0].style.fontStretch should be 1%. Was . 33 33 PASS stretchTestSheet.cssRules[1].style.fontStretch is "" 34 34 PASS stretchTestSheet.cssRules[2].style.fontStretch is "ultra-condensed" … … 72 72 FAIL stretchTestSheet.cssRules[40].style.fontStretch should be calc(7%) 8%. Was . 73 73 FAIL stretchTestSheet.cssRules[41].style.fontStretch should be 2% calc(7%). Was . 74 PASS styleTestSheet.cssRules[0].style.fontStyle is "oblique 1deg" 75 PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 20grad" 76 PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 0.28318rad" 77 PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 0.04turn" 74 FAIL styleTestSheet.cssRules[0].style.fontStyle should be oblique 1deg. Was . 75 FAIL styleTestSheet.cssRules[1].style.fontStyle should be oblique 20grad. Was . 76 FAIL styleTestSheet.cssRules[2].style.fontStyle should be oblique 0.28318rad. Was . 77 FAIL styleTestSheet.cssRules[3].style.fontStyle should be oblique 0.04turn. Was . 78 78 PASS styleTestSheet.cssRules[4].style.fontStyle is "" 79 79 PASS styleTestSheet.cssRules[5].style.fontStyle is "" … … 84 84 PASS styleTestSheet.cssRules[10].style.fontStyle is "" 85 85 PASS styleTestSheet.cssRules[11].style.fontStyle is "" 86 PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(15.4deg)" 86 FAIL styleTestSheet.cssRules[12].style.fontStyle should be oblique calc(15.4deg). Was . 87 87 PASS styleTestSheet.cssRules[13].style.fontStyle is "" 88 88 PASS styleTestSheet.cssRules[14].style.fontStyle is "" -
trunk/LayoutTests/platform/mac/TestExpectations
r214539 r214546 1432 1432 [ ElCapitan Yosemite ] animations/font-variations [ Pass Failure ImageOnlyFailure ] 1433 1433 1434 # This test makes sure that variation fonts are disabled on OSes which don't support them. So, 1435 # the test should be skipped on OSes which do support them. As soon as all OSes support them, 1436 # we should delete the test. 1437 [ Sierra+ ] fast/text/font-variations-feature-detection.html [ ImageOnlyFailure ] 1438 1434 1439 [ Debug ] fast/selectors/slow-style-sharing-with-long-cousin-list.html [ Skip ] 1435 1440 -
trunk/Source/WebCore/ChangeLog
r214545 r214546 1 2017-03-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Variation fonts: Make sure that feature detection and preprocessor macros are right 4 https://bugs.webkit.org/show_bug.cgi?id=169518 5 6 Reviewed by Simon Fraser. 7 8 When I added variable fonts support, I made all OSes parse the newly accepted values, 9 instead of just the OSes which support variable fonts. 10 11 Test: fast/text/font-variations-feature-detection.html 12 13 * css/parser/CSSPropertyParser.cpp: 14 (WebCore::consumeFontStretch): 15 (WebCore::consumeFontStyle): 16 * css/parser/CSSPropertyParserHelpers.cpp: 17 (WebCore::CSSPropertyParserHelpers::divisibleBy100): 18 (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber): 19 1 20 2017-03-29 Antoine Quint <graouts@apple.com> 2 21 -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r214507 r214546 904 904 } 905 905 906 #if ENABLE(VARIATION_FONTS) 906 907 static bool fontStretchIsWithinRange(float stretch) 907 908 { 908 909 return stretch > 0; 909 910 } 911 #endif 910 912 911 913 static RefPtr<CSSPrimitiveValue> consumeFontStretch(CSSParserTokenRange& range) … … 913 915 if (auto result = consumeFontStretchKeywordValue(range)) 914 916 return result; 917 #if ENABLE(VARIATION_FONTS) 915 918 if (auto percent = consumePercent(range, ValueRangeNonNegative)) 916 919 return fontStretchIsWithinRange(percent->value<float>()) ? percent : nullptr; 920 #endif 917 921 return nullptr; 918 922 } … … 943 947 } 944 948 949 #if ENABLE(VARIATION_FONTS) 945 950 static bool fontStyleIsWithinRange(float oblique) 946 951 { 947 952 return oblique > -90 && oblique < 90; 948 953 } 954 #endif 949 955 950 956 static RefPtr<CSSFontStyleValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode) … … 954 960 return nullptr; 955 961 956 if (result->valueID() == CSSValueNormal) 957 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal)); 958 if (result->valueID() == CSSValueItalic) 959 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueItalic)); 962 auto valueID = result->valueID(); 963 if (valueID == CSSValueNormal || valueID == CSSValueItalic) 964 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(valueID)); 960 965 ASSERT(result->valueID() == CSSValueOblique); 961 if (range.atEnd()) 962 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique)); 963 if (auto angle = consumeAngle(range, cssParserMode)) { 964 if (fontStyleIsWithinRange(angle->value<float>(CSSPrimitiveValue::CSS_DEG))) 965 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle)); 966 return nullptr; 967 } 966 #if ENABLE(VARIATION_FONTS) 967 if (!range.atEnd()) { 968 if (auto angle = consumeAngle(range, cssParserMode)) { 969 if (fontStyleIsWithinRange(angle->value<float>(CSSPrimitiveValue::CSS_DEG))) 970 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle)); 971 return nullptr; 972 } 973 } 974 #else 975 UNUSED_PARAM(cssParserMode); 976 #endif 968 977 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique)); 969 978 } -
trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
r214324 r214546 198 198 } 199 199 200 #if !ENABLE(VARIATION_FONTS) 201 static inline bool divisibleBy100(double value) 202 { 203 return static_cast<int>(value / 100) * 100 == value; 204 } 205 #endif 206 200 207 RefPtr<CSSPrimitiveValue> consumeFontWeightNumber(CSSParserTokenRange& range) 201 208 { 202 209 // Values less than or equal to 0 or greater than or equal to 1000 are parse errors. 203 210 auto& token = range.peek(); 204 if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000) 211 if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000 212 #if !ENABLE(VARIATION_FONTS) 213 && token.numericValueType() == IntegerValueType && divisibleBy100(token.numericValue()) 214 #endif 215 ) 205 216 return consumeNumber(range, ValueRangeAll); 206 217 … … 208 219 CalcParser calcParser(range, ValueRangeAll); 209 220 double result; 210 if (calcParser.consumeNumberRaw(result)) { 221 if (calcParser.consumeNumberRaw(result) 222 #if !ENABLE(VARIATION_FONTS) 223 && result > 0 && result < 1000 && divisibleBy100(result) 224 #endif 225 ) { 211 226 result = std::min(std::max(result, std::nextafter(0., 1.)), std::nextafter(1000., 0.)); 212 227 return CSSValuePool::singleton().createValue(result, CSSPrimitiveValue::UnitType::CSS_NUMBER);
Note: See TracChangeset
for help on using the changeset viewer.