Changeset 283279 in webkit
- Timestamp:
- Sep 29, 2021, 4:31:34 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 37 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/fast/css/CSSPrimitiveValue-ic-expected.txt (added)
-
LayoutTests/fast/css/CSSPrimitiveValue-ic.html (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-001-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-001.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-002-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-002.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-003-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-003.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-004-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-004.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-008-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-008.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-009-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-009.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-010-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-010.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-011-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-011.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-012-expected.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-012.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-013-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-013.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-014-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-014.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/resources/IcTestFullWidth.woff2 (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/resources/IcTestHalfWidth.woff2 (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/resources/IcTestZeroWidth.woff2 (added)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/unicode/CharacterNames.h (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValue.cpp (modified) (9 diffs)
-
Source/WebCore/css/CSSPrimitiveValue.h (modified) (2 diffs)
-
Source/WebCore/css/CSSPrimitiveValueMappings.h (modified) (1 diff)
-
Source/WebCore/css/CSSUnits.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSUnits.h (modified) (1 diff)
-
Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcCategoryMapping.cpp (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSParserToken.cpp (modified) (1 diff)
-
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (modified) (1 diff)
-
Source/WebCore/css/parser/SizesAttributeParser.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/Font.cpp (modified) (2 diffs)
-
Source/WebCore/platform/graphics/Font.h (modified) (3 diffs)
-
Source/WebCore/platform/graphics/FontMetrics.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r283274 r283279 1 2021-09-29 Kiet Ho <tho22@apple.com> 2 3 Implement the 'ic' unit from CSS Values 4 4 https://bugs.webkit.org/show_bug.cgi?id=204276 5 <rdar://problem/57256127> 6 7 Reviewed by Myles C. Maxfield. 8 9 Added tests for behavior of CSSPrimitiveValue on ic unit. 10 11 * TestExpectations: remove ImageOnlyFailure expectations for ic-unit-* tests, now that they should pass. 12 * fast/css/CSSPrimitiveValue-ic-expected.txt: Added. 13 * fast/css/CSSPrimitiveValue-ic.html: Added. 14 1 15 2021-09-29 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/TestExpectations
r283223 r283279 3274 3274 webkit.org/b/203333 imported/w3c/web-platform-tests/css/css-values/ch-unit-003.html [ ImageOnlyFailure ] 3275 3275 webkit.org/b/203333 imported/w3c/web-platform-tests/css/css-values/ch-unit-010.html [ ImageOnlyFailure ] 3276 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-001.html [ ImageOnlyFailure ]3277 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-002.html [ ImageOnlyFailure ]3278 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-003.html [ ImageOnlyFailure ]3279 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-004.html [ ImageOnlyFailure ]3280 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-008.html [ ImageOnlyFailure ]3281 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-009.html [ ImageOnlyFailure ]3282 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-010.html [ ImageOnlyFailure ]3283 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-011.html [ ImageOnlyFailure ]3284 webkit.org/b/203334 imported/w3c/web-platform-tests/css/css-values/ic-unit-012.html [ ImageOnlyFailure ]3285 3276 webkit.org/b/203336 imported/w3c/web-platform-tests/css/css-values/lh-unit-001.html [ Pass ] 3286 3277 webkit.org/b/203336 imported/w3c/web-platform-tests/css/css-values/lh-unit-002.html [ Pass ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r283274 r283279 1 2021-09-29 Kiet Ho <tho22@apple.com> 2 3 Implement the 'ic' unit from CSS Values 4 4 https://bugs.webkit.org/show_bug.cgi?id=204276 5 <rdar://problem/57256127> 6 7 Reviewed by Myles C. Maxfield. 8 9 Fix ic-unit-{001..012} tests and references to use the IcTestFullWidth font, 10 which includes the CJK water glyph as a full width character. This avoids an 11 issue on macOS Catalina where the chosen fallback font renders the glyph 12 outside of the em box. 13 14 Fix ic-unit-{001..004} references to not use the ic unit. 15 16 Add two new tests where the CJK water glyph is half-width (ic-unit-013) and zero-width 17 (ic-unit-014). 18 19 * web-platform-tests/css/css-values/ic-unit-001-expected.html: 20 * web-platform-tests/css/css-values/ic-unit-001.html: 21 * web-platform-tests/css/css-values/ic-unit-002-expected.html: 22 * web-platform-tests/css/css-values/ic-unit-002.html: 23 * web-platform-tests/css/css-values/ic-unit-003-expected.html: 24 * web-platform-tests/css/css-values/ic-unit-003.html: 25 * web-platform-tests/css/css-values/ic-unit-004-expected.html: 26 * web-platform-tests/css/css-values/ic-unit-004.html: 27 * web-platform-tests/css/css-values/ic-unit-008-expected.html: 28 * web-platform-tests/css/css-values/ic-unit-008.html: 29 * web-platform-tests/css/css-values/ic-unit-009-expected.html: 30 * web-platform-tests/css/css-values/ic-unit-009.html: 31 * web-platform-tests/css/css-values/ic-unit-010-expected.html: 32 * web-platform-tests/css/css-values/ic-unit-010.html: 33 * web-platform-tests/css/css-values/ic-unit-011-expected.html: 34 * web-platform-tests/css/css-values/ic-unit-011.html: 35 * web-platform-tests/css/css-values/ic-unit-012-expected.html: 36 * web-platform-tests/css/css-values/ic-unit-012.html: 37 * web-platform-tests/css/css-values/ic-unit-013-expected.html: Added. 38 * web-platform-tests/css/css-values/ic-unit-013.html: Added. 39 * web-platform-tests/css/css-values/ic-unit-014-expected.html: Added. 40 * web-platform-tests/css/css-values/ic-unit-014.html: Added. 41 * web-platform-tests/css/css-values/resources/IcTestFullWidth.woff2: Added. 42 * web-platform-tests/css/css-values/resources/IcTestHalfWidth.woff2: Added. 43 * web-platform-tests/css/css-values/resources/IcTestZeroWidth.woff2: Added. 44 1 45 2021-09-29 Chris Dumez <cdumez@apple.com> 2 46 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-001-expected.html
r251521 r283279 4 4 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 5 5 <style> 6 svg { width: 10ic; } 6 .ref { 7 width: 200px; 8 height: 200px; 9 background: green; 10 } 7 11 </style> 8 12 <body> 9 13 <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p> 10 < svg viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="green"></svg>14 <div class="ref"></div> 11 15 </body> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-001.html
r251521 r283279 7 7 <meta name="assert" content="The ic unit is equal to the used advance measure of the 水 (CJK water ideograph, U+6C34) glyph found in the font used to render it."> 8 8 <style> 9 @font-face { 10 font-family: IcTestFullWidth; 11 src: url(resources/IcTestFullWidth.woff2); 12 } 13 9 14 span { 15 font: 20px IcTestFullWidth; 10 16 background: green; 11 17 color: green; … … 14 20 } 15 21 div { 22 font: 20px IcTestFullWidth; 16 23 background: red; 17 24 color: red; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-002-expected.html
r251521 r283279 4 4 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 5 5 <style> 6 svg{7 width: 10ic;8 writing-mode: vertical-rl;9 text-orientation: upright;6 .ref { 7 width: 200px; 8 height: 200px; 9 background: green; 10 10 } 11 11 </style> 12 12 <body> 13 13 <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p> 14 < svg viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="green"></svg>14 <div class="ref"></div> 15 15 </body> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-002.html
r251521 r283279 9 9 <meta name="assert" content="In vertical upright, the ic unit is equal to the used vertical advance measure of the 水 (CJK water ideograph, U+6C34) glyph found in the font used to render it."> 10 10 <style> 11 @font-face { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 11 16 span { 17 font: 20px IcTestFullWidth; 12 18 background: green; 13 19 color: green; … … 15 21 position: absolute; 16 22 } 23 17 24 div { 25 font: 20px IcTestFullWidth; 18 26 background: red; 19 27 color: red; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-003-expected.html
r251521 r283279 4 4 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 5 5 <style> 6 svg{7 width: 10ic;8 writing-mode: vertical-rl;9 text-orientation: upright;6 .ref { 7 width: 200px; 8 height: 200px; 9 background: green; 10 10 } 11 11 </style> 12 12 <body> 13 13 <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p> 14 < svg viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="green"></svg>14 <div class="ref"></div> 15 15 </body> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-003.html
r251521 r283279 9 9 <meta name="assert" content="In vertical mixed, the ic unit is equal to the used vertical advance measure of the 水 (CJK water ideograph, U+6C34) glyph found in the font used to render it."> 10 10 <style> 11 @font-face { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 11 16 span { 17 font: 20px IcTestFullWidth; 12 18 background: green; 13 19 color: green; … … 15 21 position: absolute; 16 22 } 23 17 24 div { 25 font: 20px IcTestFullWidth; 18 26 background: red; 19 27 color: red; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-004-expected.html
r251521 r283279 4 4 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 5 5 <style> 6 svg { width: 10ic; } 6 .ref { 7 width: 200px; 8 height: 200px; 9 background: green; 10 } 7 11 </style> 8 12 <body> 9 13 <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p> 10 < svg viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="green"></svg>14 <div class="ref"></div> 11 15 </body> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-004.html
r251521 r283279 9 9 <meta name="assert" content="In vertical sideways, the ic unit is equal to the used horizontal advance measure of the 水 (CJK water ideograph, U+6C34) glyph found in the font used to render it."> 10 10 <style> 11 @font-face { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 11 16 span { 17 font: 20px IcTestFullWidth; 12 18 background: green; 13 19 color: green; … … 15 21 position: absolute; 16 22 } 23 17 24 div { 25 font: 20px IcTestFullWidth; 18 26 background: red; 19 27 color: red; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-008-expected.html
r251521 r283279 8 8 9 9 <style> 10 @font-face 11 { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 10 16 div 11 17 { 12 18 float: left; 19 font-family: IcTestFullWidth; 13 20 font-size: 80px; /* arbitrary font size */ 14 21 line-height: 1.8; /* arbitrary line-height */ -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-008.html
r251521 r283279 13 13 14 14 <style> 15 @font-face 16 { 17 font-family: IcTestFullWidth; 18 src: url(resources/IcTestFullWidth.woff2); 19 } 20 15 21 div 16 22 { 17 23 float: left; 24 font-family: IcTestFullWidth; 18 25 font-size: 80px; /* arbitrary font size */ 19 26 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-009-expected.html
r251521 r283279 8 8 9 9 <style> 10 @font-face 11 { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 10 16 div 11 17 { 12 18 float: left; 19 font-family: IcTestFullWidth; 13 20 font-size: 80px; /* arbitrary font size */ 14 21 line-height: 1.8; /* arbitrary line-height */ -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-009.html
r251521 r283279 13 13 14 14 <style> 15 @font-face 16 { 17 font-family: IcTestFullWidth; 18 src: url(resources/IcTestFullWidth.woff2); 19 } 20 15 21 div 16 22 { 17 23 float: left; 24 font-family: IcTestFullWidth; 18 25 font-size: 80px; /* arbitrary font size */ 19 26 writing-mode: vertical-rl; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-010-expected.html
r251521 r283279 8 8 9 9 <style> 10 @font-face 11 { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 10 16 div 11 17 { 12 18 float: left; 19 font-family: IcTestFullWidth; 13 20 font-size: 80px; /* arbitrary font size */ 14 21 line-height: 1.8; /* arbitrary line-height */ -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-010.html
r251521 r283279 13 13 14 14 <style> 15 @font-face 16 { 17 font-family: IcTestFullWidth; 18 src: url(resources/IcTestFullWidth.woff2); 19 } 20 15 21 div 16 22 { 17 23 float: left; 24 font-family: IcTestFullWidth; 18 25 font-size: 80px; /* arbitrary font size */ 19 26 text-orientation: mixed; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-011-expected.html
r251521 r283279 8 8 9 9 <style> 10 @font-face 11 { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 10 16 div 11 17 { 12 18 float: left; 19 font-family: IcTestFullWidth; 13 20 font-size: 80px; /* arbitrary font size */ 14 21 line-height: 1.8; /* arbitrary line-height */ -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-011.html
r251521 r283279 13 13 14 14 <style> 15 @font-face 16 { 17 font-family: IcTestFullWidth; 18 src: url(resources/IcTestFullWidth.woff2); 19 } 20 15 21 div 16 22 { 17 23 float: left; 24 font-family: IcTestFullWidth; 18 25 font-size: 80px; /* arbitrary font size */ 19 26 text-orientation: upright; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-012-expected.html
r251521 r283279 8 8 9 9 <style> 10 @font-face 11 { 12 font-family: IcTestFullWidth; 13 src: url(resources/IcTestFullWidth.woff2); 14 } 15 10 16 div 11 17 { 12 18 float: left; 19 font-family: IcTestFullWidth; 13 20 font-size: 80px; /* arbitrary font size */ 14 21 line-height: 1.8; /* arbitrary line-height */ -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/ic-unit-012.html
r251521 r283279 13 13 14 14 <style> 15 @font-face 16 { 17 font-family: IcTestFullWidth; 18 src: url(resources/IcTestFullWidth.woff2); 19 } 20 15 21 div 16 22 { 17 23 float: left; 24 font-family: IcTestFullWidth; 18 25 font-size: 80px; /* arbitrary font size */ 19 26 text-orientation: sideways; -
trunk/Source/WTF/ChangeLog
r283218 r283279 1 2021-09-29 Kiet Ho <tho22@apple.com> 2 3 Implement the 'ic' unit from CSS Values 4 4 https://bugs.webkit.org/show_bug.cgi?id=204276 5 <rdar://problem/57256127> 6 7 Reviewed by Myles C. Maxfield. 8 9 * wtf/unicode/CharacterNames.h: add CJK water glyph (U+6C34) constant. 10 1 11 2021-09-29 Antti Koivisto <antti@apple.com> 2 12 -
trunk/Source/WTF/wtf/unicode/CharacterNames.h
r282415 r283279 51 51 constexpr UChar byteOrderMark = 0xFEFF; 52 52 constexpr UChar carriageReturn = 0x000D; 53 constexpr UChar cjkWater = 0x6C34; 53 54 constexpr UChar combiningEnclosingKeycap = 0x20E3; 54 55 constexpr UChar deleteCharacter = 0x007F; … … 130 131 using WTF::Unicode::byteOrderMark; 131 132 using WTF::Unicode::carriageReturn; 133 using WTF::Unicode::cjkWater; 132 134 using WTF::Unicode::combiningEnclosingKeycap; 133 135 using WTF::Unicode::deleteCharacter; -
trunk/Source/WebCore/ChangeLog
r283276 r283279 1 2021-09-29 Kiet Ho <tho22@apple.com> 2 3 Implement the 'ic' unit from CSS Values 4 4 https://bugs.webkit.org/show_bug.cgi?id=204276 5 <rdar://problem/57256127> 6 7 Reviewed by Myles C. Maxfield. 8 9 Tests: fast/css/CSSPrimitiveValue-ic.html 10 imported/w3c/web-platform-tests/css/css-values/ic-unit-013.html 11 imported/w3c/web-platform-tests/css/css-values/ic-unit-014.html 12 13 * css/CSSPrimitiveValue.cpp: 14 (WebCore::isValidCSSUnitTypeForDoubleConversion): 15 (WebCore::isStringType): 16 (WebCore::CSSPrimitiveValue::cleanup): 17 (WebCore::CSSPrimitiveValue::computeUnzoomedNonCalcLengthDouble): 18 (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble): 19 (WebCore::CSSPrimitiveValue::unitTypeString): 20 (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): 21 (WebCore::CSSPrimitiveValue::equals const): 22 (WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const): 23 * css/CSSPrimitiveValue.h: 24 (WebCore::CSSPrimitiveValue::isFontRelativeLength): 25 (WebCore::CSSPrimitiveValue::isLength): 26 * css/CSSPrimitiveValueMappings.h: 27 (WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const): 28 * css/CSSUnits.cpp: 29 (WebCore::unitCategory): 30 (WebCore::operator<<): 31 * css/CSSUnits.h: 32 * css/DeprecatedCSSOMPrimitiveValue.cpp: 33 (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): 34 * css/calc/CSSCalcCategoryMapping.cpp: 35 (WebCore::calcUnitCategory): 36 (WebCore::calculationCategoryForCombination): 37 (WebCore::hasDoubleValue): 38 * css/parser/CSSParserToken.cpp: 39 (WebCore::cssPrimitiveValueUnitFromTrie): 40 * css/parser/CSSPropertyParserHelpers.cpp: 41 (WebCore::CSSPropertyParserHelpers::consumeLengthRawWithKnownTokenTypeDimension): 42 * css/parser/SizesAttributeParser.cpp: 43 (WebCore::SizesAttributeParser::computeLength): 44 * platform/graphics/Font.cpp: 45 (WebCore::Font::platformGlyphInit): simplyfy logic, reorder misplaced comment. 46 * platform/graphics/Font.h: remove property `m_zeroGlyph` only used once in 47 WebCore::Font::platformGlyphInit. Remove unused getters adjustedSpaceWidth(), 48 setSpaceWidths(), setSpaceGlyph(), setZeroWidthSpaceGlyph(), zeroGlyph(), setZeroGlyph(). 49 (WebCore::Font::spaceWidth const): 50 (WebCore::Font::spaceGlyph const): 51 (WebCore::Font::zeroWidthSpaceGlyph const): 52 (WebCore::Font::isZeroWidthSpaceGlyph const): 53 * platform/graphics/FontMetrics.h: 54 (WebCore::FontMetrics::ideogramWidth const): add metric containing the width of an ideogram 55 glyph in the font. This width is approximated from the width of the CJK water glyph (U+6C34). 56 (WebCore::FontMetrics::setIdeogramWidth): 57 (WebCore::FontMetrics::reset): 58 1 59 2021-09-29 BJ Burg <bburg@apple.com> 2 60 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r282396 r283279 57 57 case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER: 58 58 case CSSUnitType::CSS_CHS: 59 case CSSUnitType::CSS_IC: 59 60 case CSSUnitType::CSS_CM: 60 61 case CSSUnitType::CSS_DEG: … … 131 132 case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER: 132 133 case CSSUnitType::CSS_CHS: 134 case CSSUnitType::CSS_IC: 133 135 case CSSUnitType::CSS_CM: 134 136 case CSSUnitType::CSS_COUNTER: … … 494 496 case CSSUnitType::CSS_REMS: 495 497 case CSSUnitType::CSS_CHS: 498 case CSSUnitType::CSS_IC: 496 499 case CSSUnitType::CSS_PX: 497 500 case CSSUnitType::CSS_CM: … … 614 617 ASSERT(fontMetrics); 615 618 return fontMetrics->zeroWidth() * value; 619 case CSSUnitType::CSS_IC: 620 ASSERT(fontMetrics); 621 return fontMetrics->ideogramWidth() * value; 616 622 case CSSUnitType::CSS_PX: 617 623 return value; … … 681 687 682 688 case CSSUnitType::CSS_CHS: 689 case CSSUnitType::CSS_IC: 683 690 ASSERT(conversionData.style()); 684 691 value = computeUnzoomedNonCalcLengthDouble(primitiveType, value, conversionData.propertyToCompute(), &conversionData.style()->fontMetrics()); … … 983 990 case CSSUnitType::CSS_REMS: return "rem"; 984 991 case CSSUnitType::CSS_CHS: return "ch"; 992 case CSSUnitType::CSS_IC: return "ic"; 985 993 986 994 case CSSUnitType::CSS_UNKNOWN: … … 1031 1039 case CSSUnitType::CSS_CHS: 1032 1040 return formatNumberValue("ch"); 1041 case CSSUnitType::CSS_IC: 1042 return formatNumberValue("ic"); 1033 1043 case CSSUnitType::CSS_PX: 1034 1044 return formatNumberValue("px"); … … 1175 1185 case CSSUnitType::CSS_REMS: 1176 1186 case CSSUnitType::CSS_CHS: 1187 case CSSUnitType::CSS_IC: 1177 1188 case CSSUnitType::CSS_PX: 1178 1189 case CSSUnitType::CSS_CM: … … 1253 1264 case CSSUnitType::CSS_EXS: 1254 1265 case CSSUnitType::CSS_CHS: 1266 case CSSUnitType::CSS_IC: 1255 1267 values.add(CSSPropertyFontSize); 1256 1268 break; -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r282396 r283279 283 283 || type == CSSUnitType::CSS_REMS 284 284 || type == CSSUnitType::CSS_CHS 285 || type == CSSUnitType::CSS_IC 285 286 || type == CSSUnitType::CSS_QUIRKY_EMS; 286 287 } … … 298 299 || type == CSSUnitType::CSS_REMS 299 300 || type == CSSUnitType::CSS_CHS 301 || type == CSSUnitType::CSS_IC 300 302 || type == CSSUnitType::CSS_Q 301 303 || type == CSSUnitType::CSS_LHS -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r282920 r283279 4409 4409 case CSSUnitType::CSS_EXS: 4410 4410 case CSSUnitType::CSS_CHS: 4411 case CSSUnitType::CSS_IC: 4411 4412 case CSSUnitType::CSS_LHS: 4412 4413 return lengthConversion & (FixedIntegerConversion | FixedFloatConversion); -
trunk/Source/WebCore/css/CSSUnits.cpp
r282396 r283279 40 40 case CSSUnitType::CSS_PC: 41 41 case CSSUnitType::CSS_Q: 42 case CSSUnitType::CSS_IC: 42 43 return CSSUnitCategory::Length; 43 44 case CSSUnitType::CSS_MS: … … 151 152 case CSSUnitType::CSS_REMS: ts << "rems"; break; 152 153 case CSSUnitType::CSS_CHS: ts << "chs"; break; 154 case CSSUnitType::CSS_IC: ts << "ics"; break; 153 155 case CSSUnitType::CSS_COUNTER_NAME: ts << "counter_name"; break; 154 156 case CSSUnitType::CSS_SHAPE: ts << "shape"; break; -
trunk/Source/WebCore/css/CSSUnits.h
r282396 r283279 76 76 CSS_REMS, 77 77 CSS_CHS, 78 CSS_IC, 78 79 79 80 CSS_COUNTER_NAME, -
trunk/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp
r282396 r283279 44 44 case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER: return 114; 45 45 case CSSUnitType::CSS_CHS: return 109; 46 case CSSUnitType::CSS_IC: return CSS_UNKNOWN; 46 47 case CSSUnitType::CSS_CM: return CSS_CM; 47 48 case CSSUnitType::CSS_COUNTER: return CSS_COUNTER; -
trunk/Source/WebCore/css/calc/CSSCalcCategoryMapping.cpp
r282396 r283279 50 50 case CSSUnitType::CSS_REMS: 51 51 case CSSUnitType::CSS_CHS: 52 case CSSUnitType::CSS_IC: 52 53 case CSSUnitType::CSS_VW: 53 54 case CSSUnitType::CSS_VH: … … 105 106 case CSSUnitType::CSS_RLHS: 106 107 case CSSUnitType::CSS_CHS: 108 case CSSUnitType::CSS_IC: 107 109 case CSSUnitType::CSS_VW: 108 110 case CSSUnitType::CSS_VH: … … 140 142 case CSSUnitType::CSS_EXS: 141 143 case CSSUnitType::CSS_CHS: 144 case CSSUnitType::CSS_IC: 142 145 case CSSUnitType::CSS_REMS: 143 146 case CSSUnitType::CSS_PX: -
trunk/Source/WebCore/css/parser/CSSParserToken.cpp
r282396 r283279 84 84 break; 85 85 case 'i': 86 if (toASCIILower(data[1]) == 'n') 86 switch (toASCIILower(data[1])) { 87 case 'c': 88 return CSSUnitType::CSS_IC; 89 case 'n': 87 90 return CSSUnitType::CSS_IN; 91 } 88 92 break; 89 93 case 'l': -
trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
r283221 r283279 474 474 case CSSUnitType::CSS_RLHS: 475 475 case CSSUnitType::CSS_CHS: 476 case CSSUnitType::CSS_IC: 476 477 case CSSUnitType::CSS_EXS: 477 478 case CSSUnitType::CSS_PX: -
trunk/Source/WebCore/css/parser/SizesAttributeParser.cpp
r259703 r283279 58 58 // RenderView, which has its font information hardcoded in resolveForDocument() to be -webkit-standard, whose operations 59 59 // don't require a font selector. 60 if (type == CSSUnitType::CSS_EXS || type == CSSUnitType::CSS_CHS ) {60 if (type == CSSUnitType::CSS_EXS || type == CSSUnitType::CSS_CHS || type == CSSUnitType::CSS_IC) { 61 61 RefPtr<FontSelector> fontSelector = style.fontCascade().fontSelector(); 62 62 style.fontCascade().update(nullptr); -
trunk/Source/WebCore/platform/graphics/Font.cpp
r282863 r283279 140 140 UChar32 zeroWidthSpaceCharacter = 0; 141 141 #endif 142 auto* glyphPageCharacterZero = glyphPage(GlyphPage::pageNumberForCodePoint('0'));143 auto* glyphPageSpace = glyphPage(GlyphPage::pageNumberForCodePoint(space));144 142 145 143 if (glyphPageZeroWidthSpace) 146 144 m_zeroWidthSpaceGlyph = glyphPageZeroWidthSpace->glyphDataForCharacter(zeroWidthSpaceCharacter).glyph; 147 145 148 // Nasty hack to determine if we should round or ceil space widths. 149 // If the font is monospace or fake monospace we ceil to ensure that 150 // every character and the space are the same width. Otherwise we round. 151 if (glyphPageSpace) 152 m_spaceGlyph = glyphPageSpace->glyphDataForCharacter(space).glyph; 153 if (glyphPageCharacterZero) 154 m_zeroGlyph = glyphPageCharacterZero->glyphDataForCharacter('0').glyph; 146 if (auto* page = glyphPage(GlyphPage::pageNumberForCodePoint(space))) 147 m_spaceGlyph = page->glyphDataForCharacter(space).glyph; 155 148 156 149 // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE. … … 160 153 m_zeroWidthSpaceGlyph = 0; 161 154 162 float width = widthForGlyph(m_spaceGlyph); 163 m_spaceWidth = width; 164 m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph)); 155 // widthForGlyph depends on m_zeroWidthSpaceGlyph having the correct value. 156 // Therefore all calls to widthForGlyph must happen after this point. 157 158 Glyph zeroGlyph = { 0 }; 159 if (auto* page = glyphPage(GlyphPage::pageNumberForCodePoint('0'))) 160 zeroGlyph = page->glyphDataForCharacter('0').glyph; 161 m_fontMetrics.setZeroWidth(widthForGlyph(zeroGlyph)); 162 163 // Use the width of the CJK water ideogram (U+6C34) as the 164 // approximated width of ideograms in the font, as mentioned in 165 // https://www.w3.org/TR/css-values-4/#ic. This is currently only used 166 // to support the ic unit. If the width is not available, falls back to 167 // 1em as specified. 168 if (auto* page = glyphPage(GlyphPage::pageNumberForCodePoint(cjkWater))) { 169 auto glyph = page->glyphDataForCharacter(cjkWater).glyph; 170 m_fontMetrics.setIdeogramWidth(widthForGlyph(glyph)); 171 } else 172 m_fontMetrics.setIdeogramWidth(platformData().size()); 173 174 m_spaceWidth = widthForGlyph(m_spaceGlyph); 165 175 auto amountToAdjustLineGap = std::min(m_fontMetrics.floatLineGap(), 0.0f); 166 176 m_fontMetrics.setLineGap(m_fontMetrics.floatLineGap() - amountToAdjustLineGap); 167 177 m_fontMetrics.setLineSpacing(m_fontMetrics.floatLineSpacing() - amountToAdjustLineGap); 168 178 determinePitch(); 169 m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(width) : roundf(width); 179 // Nasty hack to determine if we should round or ceil space widths. 180 // If the font is monospace or fake monospace we ceil to ensure that 181 // every character and the space are the same width. Otherwise we round. 182 m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(m_spaceWidth) : roundf(m_spaceWidth); 170 183 } 171 184 -
trunk/Source/WebCore/platform/graphics/Font.h
r281687 r283279 136 136 bool isTextOrientationFallback() const { return m_isTextOrientationFallback; } 137 137 138 FontMetrics& fontMetrics() { return m_fontMetrics; }139 138 const FontMetrics& fontMetrics() const { return m_fontMetrics; } 140 139 float sizePerUnit() const { return platformData().size() / (fontMetrics().unitsPerEm() ? fontMetrics().unitsPerEm() : 1); } … … 154 153 155 154 float spaceWidth() const { return m_spaceWidth; } 156 float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; }157 void setSpaceWidths(float spaceWidth)158 {159 m_spaceWidth = spaceWidth;160 m_adjustedSpaceWidth = spaceWidth;161 }162 155 163 156 float syntheticBoldOffset() const { return m_syntheticBoldOffset; } 164 157 165 158 Glyph spaceGlyph() const { return m_spaceGlyph; } 166 void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; }167 159 Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; } 168 void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spaceGlyph; }169 160 bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthSpaceGlyph && glyph; } 170 Glyph zeroGlyph() const { return m_zeroGlyph; }171 void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; }172 161 173 162 GlyphData glyphDataForCharacter(UChar32) const; … … 328 317 329 318 Glyph m_spaceGlyph { 0 }; 330 Glyph m_zeroGlyph { 0 };331 319 Glyph m_zeroWidthSpaceGlyph { 0 }; 332 320 -
trunk/Source/WebCore/platform/graphics/FontMetrics.h
r252927 r283279 123 123 void setZeroWidth(float zeroWidth) { m_zeroWidth = zeroWidth; } 124 124 125 float ideogramWidth() const { return m_ideogramWidth; } 126 void setIdeogramWidth(float ideogramWidth) { m_ideogramWidth = ideogramWidth; } 127 125 128 float underlinePosition() const { return m_underlinePosition; } 126 129 void setUnderlinePosition(float underlinePosition) { m_underlinePosition = underlinePosition; } … … 147 150 m_xHeight = 0; 148 151 m_zeroWidth = 0; 152 m_ideogramWidth = 0; 149 153 m_underlinePosition = 0; 150 154 m_underlineThickness = 0; … … 167 171 168 172 float m_zeroWidth { 0 }; 173 float m_ideogramWidth { 0 }; 169 174 float m_xHeight { 0 }; 170 175 float m_underlinePosition { 0 };
Note:
See TracChangeset
for help on using the changeset viewer.