Changeset 282806 in webkit
- Timestamp:
- Sep 21, 2021 1:24:36 AM (10 months ago)
- Location:
- trunk
- Files:
-
- 7 added
- 28 edited
- 3 copied
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/idlharness-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-invalid-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-invalid.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html (added)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (2 diffs)
-
Source/WebCore/Headers.cmake (modified) (2 diffs)
-
Source/WebCore/Sources.txt (modified) (3 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (8 diffs)
-
Source/WebCore/bindings/js/JSCSSRuleCustom.cpp (modified) (3 diffs)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSFontPaletteValuesOverrideColorValue.cpp (copied) (copied from trunk/Source/WebCore/css/StyleRuleType.h) (2 diffs)
-
Source/WebCore/css/CSSFontPaletteValuesOverrideColorValue.h (copied) (copied from trunk/Source/WebCore/css/StyleRuleType.h) (2 diffs)
-
Source/WebCore/css/CSSFontPaletteValuesRule.cpp (added)
-
Source/WebCore/css/CSSFontPaletteValuesRule.h (copied) (copied from trunk/Source/WebCore/css/StyleRuleType.h) (2 diffs)
-
Source/WebCore/css/CSSFontPaletteValuesRule.idl (added)
-
Source/WebCore/css/CSSProperties.json (modified) (1 diff)
-
Source/WebCore/css/CSSRule.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSRule.h (modified) (2 diffs)
-
Source/WebCore/css/CSSRule.idl (modified) (2 diffs)
-
Source/WebCore/css/CSSValue.cpp (modified) (5 diffs)
-
Source/WebCore/css/CSSValue.h (modified) (3 diffs)
-
Source/WebCore/css/StyleRule.cpp (modified) (6 diffs)
-
Source/WebCore/css/StyleRule.h (modified) (5 diffs)
-
Source/WebCore/css/StyleRuleType.h (modified) (2 diffs)
-
Source/WebCore/css/StyleSheetContents.cpp (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSAtRuleID.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSAtRuleID.h (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSParserImpl.cpp (modified) (6 diffs)
-
Source/WebCore/css/parser/CSSParserImpl.h (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSPropertyParser.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/FontPaletteValues.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r282804 r282806 1 2021-09-21 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Parsing support for font-palette-values 4 https://bugs.webkit.org/show_bug.cgi?id=230337 5 6 Reviewed by Antti Koivisto. 7 8 These are being upstreamed at https://github.com/web-platform-tests/wpt/pull/30840. 9 10 * web-platform-tests/css/css-fonts/idlharness-expected.txt: 11 * web-platform-tests/css/css-fonts/parsing/font-palette-values-invalid-expected.txt: Added. 12 * web-platform-tests/css/css-fonts/parsing/font-palette-values-invalid.html: Added. 13 * web-platform-tests/css/css-fonts/parsing/font-palette-values-valid-expected.txt: Added. 14 * web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html: Added. 15 1 16 2021-09-21 Ziran Sun <zsun@igalia.com> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/idlharness-expected.txt
r267650 r282806 17 17 PASS CSSFontFaceRule interface: cssFontFaceRule must inherit property "style" with the proper type 18 18 FAIL CSSRule interface: cssFontFaceRule must inherit property "FONT_FEATURE_VALUES_RULE" with the proper type assert_inherits: property "FONT_FEATURE_VALUES_RULE" not found in prototype chain 19 FAIL CSSRule interface: cssFontFaceRule must inherit property "FONT_PALETTE_VALUES_RULE" with the proper type assert_ inherits: property "FONT_PALETTE_VALUES_RULE" not found in prototype chain19 FAIL CSSRule interface: cssFontFaceRule must inherit property "FONT_PALETTE_VALUES_RULE" with the proper type assert_equals: expected 15 but got 19 20 20 FAIL CSSFontFeatureValuesRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSFontFeatureValuesRule" expected property "CSSFontFeatureValuesRule" missing 21 21 FAIL CSSFontFeatureValuesRule interface object length assert_own_property: self does not have own property "CSSFontFeatureValuesRule" expected property "CSSFontFeatureValuesRule" missing … … 38 38 FAIL CSSFontFeatureValuesMap interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSFontFeatureValuesMap" expected property "CSSFontFeatureValuesMap" missing 39 39 FAIL CSSFontFeatureValuesMap interface: operation set(CSSOMString, (unsigned long or sequence<unsigned long>)) assert_own_property: self does not have own property "CSSFontFeatureValuesMap" expected property "CSSFontFeatureValuesMap" missing 40 FAIL CSSFontPaletteValuesRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 41 FAIL CSSFontPaletteValuesRule interface object length assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 42 FAIL CSSFontPaletteValuesRule interface object name assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 43 FAIL CSSFontPaletteValuesRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 44 FAIL CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 45 FAIL CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing 46 FAIL CSSFontPaletteValuesRule interface: attribute fontFamily assert_ own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing47 FAIL CSSFontPaletteValuesRule interface: attribute basePalette assert_ own_property: self does not have own property "CSSFontPaletteValuesRule" expected property "CSSFontPaletteValuesRule" missing40 PASS CSSFontPaletteValuesRule interface: existence and properties of interface object 41 PASS CSSFontPaletteValuesRule interface object length 42 PASS CSSFontPaletteValuesRule interface object name 43 PASS CSSFontPaletteValuesRule interface: existence and properties of interface prototype object 44 PASS CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's "constructor" property 45 PASS CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's @@unscopables property 46 FAIL CSSFontPaletteValuesRule interface: attribute fontFamily assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" 47 FAIL CSSFontPaletteValuesRule interface: attribute basePalette assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" 48 48 FAIL CSSRule interface: constant FONT_FEATURE_VALUES_RULE on interface object assert_own_property: expected property "FONT_FEATURE_VALUES_RULE" missing 49 49 FAIL CSSRule interface: constant FONT_FEATURE_VALUES_RULE on interface prototype object assert_own_property: expected property "FONT_FEATURE_VALUES_RULE" missing 50 FAIL CSSRule interface: constant FONT_PALETTE_VALUES_RULE on interface object assert_ own_property: expected property "FONT_PALETTE_VALUES_RULE" missing51 FAIL CSSRule interface: constant FONT_PALETTE_VALUES_RULE on interface prototype object assert_ own_property: expected property "FONT_PALETTE_VALUES_RULE" missing50 FAIL CSSRule interface: constant FONT_PALETTE_VALUES_RULE on interface object assert_equals: property has wrong value expected 15 but got 19 51 FAIL CSSRule interface: constant FONT_PALETTE_VALUES_RULE on interface prototype object assert_equals: property has wrong value expected 15 but got 19 52 52 FAIL CSSRule interface: cssRule must inherit property "FONT_FEATURE_VALUES_RULE" with the proper type assert_inherits: property "FONT_FEATURE_VALUES_RULE" not found in prototype chain 53 FAIL CSSRule interface: cssRule must inherit property "FONT_PALETTE_VALUES_RULE" with the proper type assert_ inherits: property "FONT_PALETTE_VALUES_RULE" not found in prototype chain53 FAIL CSSRule interface: cssRule must inherit property "FONT_PALETTE_VALUES_RULE" with the proper type assert_equals: expected 15 but got 19 54 54 -
trunk/Source/WebCore/CMakeLists.txt
r282702 r282806 706 706 css/CSSCounterStyleRule.idl 707 707 css/CSSFontFaceRule.idl 708 css/CSSFontPaletteValuesRule.idl 708 709 css/CSSGroupingRule.idl 709 710 css/CSSImportRule.idl -
trunk/Source/WebCore/ChangeLog
r282805 r282806 1 2021-09-21 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Parsing support for font-palette-values 4 https://bugs.webkit.org/show_bug.cgi?id=230337 5 6 Reviewed by Antti Koivisto. 7 8 There's nothing particularly interesting here - it's just support for another at-rule. 9 I've implemented what's in the spec right now: 10 https://drafts.csswg.org/css-fonts-4/#font-palette-values 11 12 There are 2 new descriptors: base-palette and override-color. I've added a new CSSValue subclass 13 for each of the items in the override-color list - these items are just tuples of two 14 CSSPrimitiveValues. I could have done this with a CSSValueList which always just happens to have 15 a length of 2, but I thought that was less elegant (and has an extra pointer indirection) than 16 making a class to hold the two CSSPrimitiveValues. 17 18 The only difference with what's in the spec is that I've given a different value to 19 FONT_PALETTE_VALUES_RULE, because its current value conflicts with VIEWPORT_RULE. This is being 20 tracked at https://github.com/w3c/csswg-drafts/issues/6623. 21 22 I created a new datatype and file in platform/graphics/FontPaletteValues.h because this data will 23 eventually be passed to preparePlatformFont(), which is in platform/, so this data needs to be 24 accessible from platform/ too. 25 26 Tests: imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-invalid.html 27 imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html 28 29 * CMakeLists.txt: 30 * DerivedSources-input.xcfilelist: 31 * DerivedSources-output.xcfilelist: 32 * DerivedSources.make: 33 * Headers.cmake: 34 * Sources.txt: 35 * WebCore.xcodeproj/project.pbxproj: 36 * bindings/js/JSCSSRuleCustom.cpp: 37 (WebCore::toJSNewlyCreated): 38 * css/CSSComputedStyleDeclaration.cpp: 39 (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): 40 * css/CSSFontPaletteValuesOverrideColorValue.cpp: Copied from Source/WebCore/css/StyleRuleType.h. 41 (WebCore::CSSFontPaletteValuesOverrideColorValue::customCSSText const): 42 (WebCore::CSSFontPaletteValuesOverrideColorValue::equals const): 43 * css/CSSFontPaletteValuesOverrideColorValue.h: Copied from Source/WebCore/css/StyleRuleType.h. 44 * css/CSSFontPaletteValuesRule.cpp: Added. 45 (WebCore::CSSFontPaletteValuesRule::CSSFontPaletteValuesRule): 46 (WebCore::CSSFontPaletteValuesRule::~CSSFontPaletteValuesRule): 47 (WebCore::parseString): 48 (WebCore::CSSFontPaletteValuesRule::fontFamily const): 49 (WebCore::CSSFontPaletteValuesRule::basePalette const): 50 (WebCore::CSSFontPaletteValuesRule::setFontFamily): 51 (WebCore::CSSFontPaletteValuesRule::setBasePalette): 52 (WebCore::CSSFontPaletteValuesRule::initializeMapLike): 53 (WebCore::CSSFontPaletteValuesRule::setFromMapLike): 54 (WebCore::CSSFontPaletteValuesRule::clear): 55 (WebCore::CSSFontPaletteValuesRule::remove): 56 (WebCore::CSSFontPaletteValuesRule::cssText const): 57 (WebCore::CSSFontPaletteValuesRule::reattach): 58 * css/CSSFontPaletteValuesRule.h: Copied from Source/WebCore/css/StyleRuleType.h. 59 * css/CSSFontPaletteValuesRule.idl: Added. 60 * css/CSSProperties.json: 61 * css/CSSRule.cpp: 62 * css/CSSRule.h: 63 * css/CSSRule.idl: 64 * css/CSSValue.cpp: 65 (WebCore::CSSValue::equals const): 66 (WebCore::CSSValue::cssText const): 67 (WebCore::CSSValue::destroy): 68 * css/CSSValue.h: 69 (WebCore::CSSValue::isFontPaletteValuesOverrideColorValue const): 70 * css/StyleRule.cpp: 71 (WebCore::StyleRuleBase::destroy): 72 (WebCore::StyleRuleBase::copy const): 73 (WebCore::StyleRuleBase::createCSSOMWrapper const): 74 (WebCore::StyleRuleFontPaletteValues::StyleRuleFontPaletteValues): 75 * css/StyleRule.h: 76 (WebCore::StyleRuleBase::isFontPaletteValuesRule const): 77 (isType): 78 * css/StyleRuleType.h: 79 * css/StyleSheetContents.cpp: 80 (WebCore::traverseRulesInVector): 81 (WebCore::StyleSheetContents::traverseSubresources const): 82 * css/parser/CSSAtRuleID.cpp: 83 (WebCore::cssAtRuleID): 84 * css/parser/CSSAtRuleID.h: 85 * css/parser/CSSParserImpl.cpp: 86 (WebCore::CSSParserImpl::consumeAtRule): 87 (WebCore::CSSParserImpl::consumeFontPaletteValuesRule): 88 (WebCore::CSSParserImpl::consumeDeclaration): 89 * css/parser/CSSParserImpl.h: 90 * css/parser/CSSPropertyParser.cpp: 91 (WebCore::CSSPropertyParser::parseValue): 92 (WebCore::consumeBasePaletteDescriptor): 93 (WebCore::consumeOverrideColorDescriptor): 94 (WebCore::CSSPropertyParser::parseFontPaletteValuesDescriptor): 95 * css/parser/CSSPropertyParser.h: 96 * platform/graphics/FontPaletteValues.h: Added. 97 (WebCore::FontPaletteValues::FontPaletteValues): 98 (WebCore::FontPaletteValues::basePalette const): 99 (WebCore::FontPaletteValues::setBasePalette): 100 (WebCore::FontPaletteValues::overrideColor const): 101 (WebCore::FontPaletteValues::appendOverrideColor): 102 (WebCore::FontPaletteValues::clearOverrideColor): 103 (WebCore::FontPaletteValues::remove): 104 1 105 2021-09-21 Myles C. Maxfield <mmaxfield@apple.com> 2 106 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r282702 r282806 683 683 $(PROJECT_DIR)/css/CSSCounterStyleRule.idl 684 684 $(PROJECT_DIR)/css/CSSFontFaceRule.idl 685 $(PROJECT_DIR)/css/CSSFontPaletteValuesRule.idl 685 686 $(PROJECT_DIR)/css/CSSGroupingRule.idl 686 687 $(PROJECT_DIR)/css/CSSImportRule.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r282710 r282806 301 301 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.cpp 302 302 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontFaceRule.h 303 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontPaletteValuesRule.cpp 304 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontPaletteValuesRule.h 303 305 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.cpp 304 306 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.h -
trunk/Source/WebCore/DerivedSources.make
r282702 r282806 1 # Copyright (C) 2006-202 0Apple Inc. All rights reserved.1 # Copyright (C) 2006-2021 Apple Inc. All rights reserved. 2 2 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 3 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> … … 576 576 $(WebCore)/css/CSSCounterStyleRule.idl \ 577 577 $(WebCore)/css/CSSFontFaceRule.idl \ 578 $(WebCore)/css/CSSFontPaletteValuesRule.idl \ 578 579 $(WebCore)/css/CSSGroupingRule.idl \ 579 580 $(WebCore)/css/CSSImportRule.idl \ -
trunk/Source/WebCore/Headers.cmake
r282798 r282806 367 367 css/CSSCustomPropertyValue.h 368 368 css/CSSFontFaceRule.h 369 css/CSSFontPaletteValuesRule.h 369 370 css/CSSFontFamily.h 370 371 css/CSSGridIntegerRepeatValue.h … … 1260 1261 platform/graphics/FontGenericFamilies.h 1261 1262 platform/graphics/FontMetrics.h 1263 platform/graphics/FontPaletteValues.h 1262 1264 platform/graphics/FontPlatformData.h 1263 1265 platform/graphics/FontRanges.h -
trunk/Source/WebCore/Sources.txt
r282798 r282806 1 // Copyright (C) 2017-202 0Apple Inc. All rights reserved.1 // Copyright (C) 2017-2021 Apple Inc. All rights reserved. 2 2 // 3 3 // Redistribution and use in source and binary forms, with or without … … 659 659 css/CSSFontFaceSrcValue.cpp 660 660 css/CSSFontFeatureValue.cpp 661 css/CSSFontPaletteValuesOverrideColorValue.cpp 662 css/CSSFontPaletteValuesRule.cpp 661 663 css/CSSFontSelector.cpp 662 664 css/CSSFontStyleRangeValue.cpp … … 2825 2827 JSCSSCounterStyleRule.cpp 2826 2828 JSCSSFontFaceRule.cpp 2829 JSCSSFontPaletteValuesRule.cpp 2827 2830 JSCSSGroupingRule.cpp 2828 2831 JSCSSImportRule.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r282798 r282806 654 654 1C43DE6B22AB4B8A001527D9 /* LocalCurrentTraitCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C43DE6822AB4B8A001527D9 /* LocalCurrentTraitCollection.h */; settings = {ATTRIBUTES = (Private, ); }; }; 655 655 1C4D0DD324D9F10D003D7498 /* GlyphBufferMembers.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4D0DD124D9F0DB003D7498 /* GlyphBufferMembers.h */; settings = {ATTRIBUTES = (Private, ); }; }; 656 1C5E1DA826F94B9000E07AF1 /* FontPaletteValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5E1DA626F949B900E07AF1 /* FontPaletteValues.h */; }; 656 657 1C6626111C6E7CA600AB527C /* FontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C66260F1C6E7CA600AB527C /* FontFace.h */; }; 657 658 1C73A7132185757E004CCEA5 /* TextUnderlineOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB6B4FB217B83940093B9CD /* TextUnderlineOffset.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 668 669 1CE8D12726185C0E00FC3AEF /* DisplayListItemBufferIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CE8D12526185BD800FC3AEF /* DisplayListItemBufferIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 669 670 1CE8D12E261861C400FC3AEF /* DisplayListIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CE8D12C2618616400FC3AEF /* DisplayListIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 671 1CEAA53226F336FC00868507 /* CSSFontPaletteValuesOverrideColorValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CEAA53126F331C100868507 /* CSSFontPaletteValuesOverrideColorValue.h */; }; 670 672 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; }; 671 673 1D0026A42374D62400CA6CDF /* JSPictureInPictureWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D0026A22374D62300CA6CDF /* JSPictureInPictureWindow.h */; }; … … 7052 7054 1C4D0DD124D9F0DB003D7498 /* GlyphBufferMembers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlyphBufferMembers.h; sourceTree = "<group>"; }; 7053 7055 1C50C49522C84F2400A6E4BE /* WHLSLStandardLibraryFunctionMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLStandardLibraryFunctionMap.cpp; sourceTree = "<group>"; }; 7056 1C5E1DA626F949B900E07AF1 /* FontPaletteValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontPaletteValues.h; sourceTree = "<group>"; }; 7054 7057 1C66260E1C6E7CA600AB527C /* FontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFace.cpp; sourceTree = "<group>"; }; 7055 7058 1C66260F1C6E7CA600AB527C /* FontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontFace.h; sourceTree = "<group>"; }; … … 7084 7087 1CE8D12B2618616400FC3AEF /* DisplayListIterator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayListIterator.cpp; sourceTree = "<group>"; }; 7085 7088 1CE8D12C2618616400FC3AEF /* DisplayListIterator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayListIterator.h; sourceTree = "<group>"; }; 7089 1CEAA52C26F31A3C00868507 /* CSSFontPaletteValuesRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontPaletteValuesRule.cpp; sourceTree = "<group>"; }; 7090 1CEAA52D26F31A3C00868507 /* CSSFontPaletteValuesRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSFontPaletteValuesRule.h; sourceTree = "<group>"; }; 7091 1CEAA52F26F31AF800868507 /* CSSFontPaletteValuesRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSFontPaletteValuesRule.idl; sourceTree = "<group>"; }; 7092 1CEAA53026F331C100868507 /* CSSFontPaletteValuesOverrideColorValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontPaletteValuesOverrideColorValue.cpp; sourceTree = "<group>"; }; 7093 1CEAA53126F331C100868507 /* CSSFontPaletteValuesOverrideColorValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSFontPaletteValuesOverrideColorValue.h; sourceTree = "<group>"; }; 7086 7094 1CF0BFD42298706800ED2074 /* TextSizeAdjustment.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TextSizeAdjustment.cpp; sourceTree = "<group>"; }; 7087 7095 1CF18F3C26BB5AF2004B1722 /* LogInitialization.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LogInitialization.cpp; sourceTree = "<group>"; }; … … 27011 27019 E44EE3A717576E5500EEE8CF /* FontGenericFamilies.h */, 27012 27020 0845680712B90DA600960A9F /* FontMetrics.h */, 27021 1C5E1DA626F949B900E07AF1 /* FontPaletteValues.h */, 27013 27022 84B62684133138F90095A489 /* FontPlatformData.cpp */, 27014 27023 B5320D69122A24E9002D1440 /* FontPlatformData.h */, … … 29594 29603 4A6E9FC113C17D1D0046A7F8 /* CSSFontFeatureValue.cpp */, 29595 29604 4A6E9FC213C17D1D0046A7F8 /* CSSFontFeatureValue.h */, 29605 1CEAA53026F331C100868507 /* CSSFontPaletteValuesOverrideColorValue.cpp */, 29606 1CEAA53126F331C100868507 /* CSSFontPaletteValuesOverrideColorValue.h */, 29607 1CEAA52C26F31A3C00868507 /* CSSFontPaletteValuesRule.cpp */, 29608 1CEAA52D26F31A3C00868507 /* CSSFontPaletteValuesRule.h */, 29609 1CEAA52F26F31AF800868507 /* CSSFontPaletteValuesRule.idl */, 29596 29610 BC64B4D30CB4298A005F2B62 /* CSSFontSelector.cpp */, 29597 29611 BC64B4D40CB4298A005F2B62 /* CSSFontSelector.h */, … … 31968 31982 83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */, 31969 31983 4A6E9FC413C17D1D0046A7F8 /* CSSFontFeatureValue.h in Headers */, 31984 1CEAA53226F336FC00868507 /* CSSFontPaletteValuesOverrideColorValue.h in Headers */, 31970 31985 BC64B4DC0CB4298A005F2B62 /* CSSFontSelector.h in Headers */, 31971 31986 C2E38F021E84573500CA3ADF /* CSSFontStyleRangeValue.h in Headers */, … … 32505 32520 BC4A532F256057CD0028C592 /* FontLoadTimingOverride.h in Headers */, 32506 32521 0845680812B90DA600960A9F /* FontMetrics.h in Headers */, 32522 1C5E1DA826F94B9000E07AF1 /* FontPaletteValues.h in Headers */, 32507 32523 B5320D6B122A24E9002D1440 /* FontPlatformData.h in Headers */, 32508 32524 371F4FFC0D25E7F300ECE0D5 /* FontRanges.h in Headers */, -
trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
r276152 r282806 29 29 #include "CSSCounterStyleRule.h" 30 30 #include "CSSFontFaceRule.h" 31 #include "CSSFontPaletteValuesRule.h" 31 32 #include "CSSImportRule.h" 32 33 #include "CSSKeyframeRule.h" … … 39 40 #include "JSCSSCounterStyleRule.h" 40 41 #include "JSCSSFontFaceRule.h" 42 #include "JSCSSFontPaletteValuesRule.h" 41 43 #include "JSCSSImportRule.h" 42 44 #include "JSCSSKeyframeRule.h" … … 71 73 case CSSRule::FONT_FACE_RULE: 72 74 return createWrapper<CSSFontFaceRule>(globalObject, WTFMove(rule)); 75 case CSSRule::FONT_PALETTE_VALUES_RULE: 76 return createWrapper<CSSFontPaletteValuesRule>(globalObject, WTFMove(rule)); 73 77 case CSSRule::PAGE_RULE: 74 78 return createWrapper<CSSPageRule>(globalObject, WTFMove(rule)); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r282768 r282806 1 1 /* 2 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 3 * Copyright (C) 2004-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2004-2021 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 5 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> … … 4053 4053 break; 4054 4054 4055 // Unimplemented @font-palette-values properties 4056 case CSSPropertyBasePalette: 4057 case CSSPropertyOverrideColor: 4058 break; 4059 4055 4060 /* Other unimplemented properties */ 4056 4061 case CSSPropertyPage: // for @page -
trunk/Source/WebCore/css/CSSFontPaletteValuesOverrideColorValue.cpp
r282805 r282806 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "CSSFontPaletteValuesOverrideColorValue.h" 27 28 28 29 namespace WebCore { 29 30 30 enum class StyleRuleType : uint8_t { 31 Unknown, // Not used. 32 Style, 33 Charset, // Not used. These are internally strings owned by the style sheet. 34 Import, 35 Media, 36 FontFace, 37 Page, 38 Keyframes, 39 Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects. 40 Namespace = 10, 41 CounterStyle = 11, 42 Supports = 12, 43 Layer = 13, 44 }; 31 String CSSFontPaletteValuesOverrideColorValue::customCSSText() const 32 { 33 return makeString(m_key->cssText(), " ", m_color->cssText()); 34 } 45 35 46 } // namespace WebCore 36 bool CSSFontPaletteValuesOverrideColorValue::equals(const CSSFontPaletteValuesOverrideColorValue& other) const 37 { 38 return m_key->equals(other.key()) && m_color->equals(other.color()); 39 } 40 41 } -
trunk/Source/WebCore/css/CSSFontPaletteValuesOverrideColorValue.h
r282805 r282806 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "CSSValue.h" 29 #include "CachedResourceHandle.h" 30 #include "ResourceLoaderOptions.h" 31 #include <wtf/Function.h> 32 #include <wtf/text/WTFString.h> 33 28 34 namespace WebCore { 29 35 30 enum class StyleRuleType : uint8_t { 31 Unknown, // Not used. 32 Style, 33 Charset, // Not used. These are internally strings owned by the style sheet. 34 Import, 35 Media, 36 FontFace, 37 Page, 38 Keyframes, 39 Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects. 40 Namespace = 10, 41 CounterStyle = 11, 42 Supports = 12, 43 Layer = 13, 36 class CachedFont; 37 class FontLoadRequest; 38 class SVGFontFaceElement; 39 class ScriptExecutionContext; 40 41 class CSSFontPaletteValuesOverrideColorValue final : public CSSValue { 42 public: 43 static Ref<CSSFontPaletteValuesOverrideColorValue> create(Ref<CSSPrimitiveValue>&& key, Ref<CSSPrimitiveValue>&& color) 44 { 45 return adoptRef(*new CSSFontPaletteValuesOverrideColorValue(WTFMove(key), WTFMove(color))); 46 } 47 48 const CSSPrimitiveValue& key() const 49 { 50 return m_key.get(); 51 } 52 53 const CSSPrimitiveValue& color() const 54 { 55 return m_color.get(); 56 } 57 58 String customCSSText() const; 59 60 bool equals(const CSSFontPaletteValuesOverrideColorValue&) const; 61 62 private: 63 CSSFontPaletteValuesOverrideColorValue(Ref<CSSPrimitiveValue>&& key, Ref<CSSPrimitiveValue>&& color) 64 : CSSValue(FontPaletteValuesOverrideColorClass) 65 , m_key(WTFMove(key)) 66 , m_color(WTFMove(color)) 67 { 68 } 69 70 Ref<CSSPrimitiveValue> m_key; 71 Ref<CSSPrimitiveValue> m_color; 44 72 }; 45 73 46 74 } // namespace WebCore 75 76 SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSFontPaletteValuesOverrideColorValue, isFontPaletteValuesOverrideColorValue()) -
trunk/Source/WebCore/css/CSSFontPaletteValuesRule.h
r282805 r282806 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "CSSRule.h" 29 28 30 namespace WebCore { 29 31 30 enum class StyleRuleType : uint8_t { 31 Unknown, // Not used. 32 Style, 33 Charset, // Not used. These are internally strings owned by the style sheet. 34 Import, 35 Media, 36 FontFace, 37 Page, 38 Keyframes, 39 Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects. 40 Namespace = 10, 41 CounterStyle = 11, 42 Supports = 12, 43 Layer = 13, 32 class CSSStyleDeclaration; 33 class DOMMapAdapter; 34 class StyleRuleFontFace; 35 class StyleRuleCSSStyleDeclaration; 36 37 class CSSFontPaletteValuesRule final : public CSSRule { 38 public: 39 static Ref<CSSFontPaletteValuesRule> create(StyleRuleFontPaletteValues& rule, CSSStyleSheet* sheet) { return adoptRef(*new CSSFontPaletteValuesRule(rule, sheet)); } 40 41 virtual ~CSSFontPaletteValuesRule(); 42 43 String fontFamily() const; 44 String basePalette() const; 45 46 void initializeMapLike(DOMMapAdapter&); 47 48 private: 49 CSSFontPaletteValuesRule(StyleRuleFontPaletteValues&, CSSStyleSheet* parent); 50 51 CSSRule::Type type() const final { return FONT_PALETTE_VALUES_RULE; } 52 String cssText() const final; 53 void reattach(StyleRuleBase&) final; 54 55 Ref<StyleRuleFontPaletteValues> m_fontPaletteValuesRule; 44 56 }; 45 57 46 58 } // namespace WebCore 59 60 SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontPaletteValuesRule, CSSRule::FONT_PALETTE_VALUES_RULE) -
trunk/Source/WebCore/css/CSSProperties.json
r282750 r282806 4086 4086 } 4087 4087 }, 4088 "base-palette": { 4089 "codegen-properties": { 4090 "skip-builder": true, 4091 "descriptor-only": true 4092 }, 4093 "specification": { 4094 "category": "css-fonts", 4095 "url": "https://drafts.csswg.org/css-fonts-4/#base-palette-desc" 4096 } 4097 }, 4098 "override-color": { 4099 "codegen-properties": { 4100 "skip-builder": true, 4101 "descriptor-only": true 4102 }, 4103 "specification": { 4104 "category": "css-fonts", 4105 "url": "https://drafts.csswg.org/css-fonts-4/#override-color" 4106 } 4107 }, 4088 4108 "stop-color": { 4089 4109 "codegen-properties": { -
trunk/Source/WebCore/css/CSSRule.cpp
r276152 r282806 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002 , 2005, 2006, 2007, 2012Apple Inc. All rights reserved.4 * Copyright (C) 2002-2021 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 49 49 COMPILE_ASSERT(StyleRuleType::CounterStyle == static_cast<StyleRuleType>(CSSRule::Type::COUNTER_STYLE_RULE), enums_should_match); 50 50 COMPILE_ASSERT(StyleRuleType::Supports == static_cast<StyleRuleType>(CSSRule::Type::SUPPORTS_RULE), enums_should_match); 51 COMPILE_ASSERT(StyleRuleType::FontPaletteValues == static_cast<StyleRuleType>(CSSRule::Type::FONT_PALETTE_VALUES_RULE), enums_should_match); 51 52 52 53 ExceptionOr<void> CSSRule::setCssText(const String&) -
trunk/Source/WebCore/css/CSSRule.h
r276152 r282806 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002-202 0Apple Inc. All rights reserved.4 * Copyright (C) 2002-2021 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 6 6 * … … 39 39 // WebIDL enum 40 40 enum Type { 41 UNKNOWN_RULE, 42 STYLE_RULE, 43 CHARSET_RULE, 44 IMPORT_RULE, 45 MEDIA_RULE, 46 FONT_FACE_RULE, 47 PAGE_RULE, 48 KEYFRAMES_RULE, 49 KEYFRAME_RULE, 50 MARGIN_RULE, 51 NAMESPACE_RULE, 52 COUNTER_STYLE_RULE, 53 SUPPORTS_RULE 41 UNKNOWN_RULE = 0, 42 STYLE_RULE = 1, 43 CHARSET_RULE = 2, 44 IMPORT_RULE = 3, 45 MEDIA_RULE = 4, 46 FONT_FACE_RULE = 5, 47 PAGE_RULE = 6, 48 KEYFRAMES_RULE = 7, 49 KEYFRAME_RULE = 8, 50 MARGIN_RULE = 9, 51 NAMESPACE_RULE = 10, 52 COUNTER_STYLE_RULE = 11, 53 SUPPORTS_RULE = 12, 54 FONT_PALETTE_VALUES_RULE = 19 // https://github.com/w3c/csswg-drafts/issues/6623 54 55 }; 55 56 -
trunk/Source/WebCore/css/CSSRule.idl
r276152 r282806 1 1 /* 2 * Copyright (C) 2006-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2006-2021 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 45 45 [EnabledBySetting=CSSCounterStyleAtRules] const unsigned short COUNTER_STYLE_RULE = 11; 46 46 const unsigned short SUPPORTS_RULE = 12; 47 const unsigned short FONT_PALETTE_VALUES_RULE = 19; /* https://github.com/w3c/csswg-drafts/issues/6623 */ 47 48 48 49 // Legacy synonyms for the above, kept to avoid breaking existing content. -
trunk/Source/WebCore/css/CSSValue.cpp
r280599 r282806 2 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 3 3 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2021 Apple Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 40 41 #include "CSSFontFaceSrcValue.h" 41 42 #include "CSSFontFeatureValue.h" 43 #include "CSSFontPaletteValuesOverrideColorValue.h" 42 44 #include "CSSFontStyleRangeValue.h" 43 45 #include "CSSFontStyleValue.h" … … 165 167 case FontFaceSrcClass: 166 168 return compareCSSValues<CSSFontFaceSrcValue>(*this, other); 169 case FontPaletteValuesOverrideColorClass: 170 return compareCSSValues<CSSFontPaletteValuesOverrideColorValue>(*this, other); 167 171 case FontFeatureClass: 168 172 return compareCSSValues<CSSFontFeatureValue>(*this, other); … … 265 269 case FontFaceSrcClass: 266 270 return downcast<CSSFontFaceSrcValue>(*this).customCSSText(); 271 case FontPaletteValuesOverrideColorClass: 272 return downcast<CSSFontPaletteValuesOverrideColorValue>(*this).customCSSText(); 267 273 case FontFeatureClass: 268 274 return downcast<CSSFontFeatureValue>(*this).customCSSText(); … … 378 384 delete downcast<CSSFontFaceSrcValue>(this); 379 385 return; 386 case FontPaletteValuesOverrideColorClass: 387 delete downcast<CSSFontPaletteValuesOverrideColorValue>(this); 388 return; 380 389 case FontFeatureClass: 381 390 delete downcast<CSSFontFeatureValue>(this); -
trunk/Source/WebCore/css/CSSValue.h
r280689 r282806 1 1 /* 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004 , 2005, 2006, 2007, 2008Apple Inc. All rights reserved.3 * Copyright (C) 2004-2021 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 98 98 bool isFontVariationValue() const { return m_classType == FontVariationClass; } 99 99 bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; } 100 bool isFontPaletteValuesOverrideColorValue() const { return m_classType == FontPaletteValuesOverrideColorClass; } 100 101 bool isFontValue() const { return m_classType == FontClass; } 101 102 bool isFontStyleValue() const { return m_classType == FontStyleClass; } … … 188 189 FontStyleRangeClass, 189 190 FontFaceSrcClass, 191 FontPaletteValuesOverrideColorClass, 190 192 FunctionClass, 191 193 -
trunk/Source/WebCore/css/StyleRule.cpp
r281701 r282806 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002-202 0Apple Inc. All rights reserved.4 * Copyright (C) 2002-2021 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 26 26 #include "CSSDeferredParser.h" 27 27 #include "CSSFontFaceRule.h" 28 #include "CSSFontPaletteValuesRule.h" 28 29 #include "CSSImportRule.h" 29 30 #include "CSSKeyframeRule.h" … … 71 72 delete downcast<StyleRuleFontFace>(this); 72 73 return; 74 case StyleRuleType::FontPaletteValues: 75 delete downcast<StyleRuleFontPaletteValues>(this); 76 return; 73 77 case StyleRuleType::Media: 74 78 delete downcast<StyleRuleMedia>(this); … … 114 118 case StyleRuleType::FontFace: 115 119 return downcast<StyleRuleFontFace>(*this).copy(); 120 case StyleRuleType::FontPaletteValues: 121 return downcast<StyleRuleFontPaletteValues>(*this).copy(); 116 122 case StyleRuleType::Media: 117 123 return downcast<StyleRuleMedia>(*this).copy(); … … 150 156 rule = CSSFontFaceRule::create(downcast<StyleRuleFontFace>(self), parentSheet); 151 157 break; 158 case StyleRuleType::FontPaletteValues: 159 rule = CSSFontPaletteValuesRule::create(downcast<StyleRuleFontPaletteValues>(self), parentSheet); 160 break; 152 161 case StyleRuleType::Media: 153 162 rule = CSSMediaRule::create(downcast<StyleRuleMedia>(self), parentSheet); … … 320 329 } 321 330 331 StyleRuleFontPaletteValues::StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, const FontPaletteValues::PaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColor) 332 : StyleRuleBase(StyleRuleType::FontPaletteValues) 333 , m_name(name) 334 , m_fontFamily(fontFamily) 335 , m_fontPaletteValues(basePalette, WTFMove(overrideColor)) 336 { 337 } 338 339 StyleRuleFontPaletteValues::StyleRuleFontPaletteValues(const StyleRuleFontPaletteValues& o) 340 : StyleRuleBase(o) 341 , m_name(o.name()) 342 , m_fontFamily(o.fontFamily()) 343 , m_fontPaletteValues(o.m_fontPaletteValues) 344 { 345 } 346 347 StyleRuleFontPaletteValues::~StyleRuleFontPaletteValues() = default; 348 322 349 DeferredStyleGroupRuleList::DeferredStyleGroupRuleList(const CSSParserTokenRange& range, CSSDeferredParser& parser) 323 350 : m_parser(parser) -
trunk/Source/WebCore/css/StyleRule.h
r281701 r282806 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 4 * Copyright (C) 2002-202 0Apple Inc. All rights reserved.4 * Copyright (C) 2002-2021 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 24 24 #include "CSSSelectorList.h" 25 25 #include "CompiledSelector.h" 26 #include "FontPaletteValues.h" 26 27 #include "StyleProperties.h" 27 28 #include "StyleRuleType.h" … … 53 54 bool isCounterStyleRule() const { return type() == StyleRuleType::CounterStyle; } 54 55 bool isFontFaceRule() const { return type() == StyleRuleType::FontFace; } 56 bool isFontPaletteValuesRule() const { return type() == StyleRuleType::FontPaletteValues; } 55 57 bool isKeyframesRule() const { return type() == StyleRuleType::Keyframes; } 56 58 bool isKeyframeRule() const { return type() == StyleRuleType::Keyframe; } … … 156 158 }; 157 159 160 class StyleRuleFontPaletteValues final : public StyleRuleBase { 161 public: 162 static Ref<StyleRuleFontPaletteValues> create(const AtomString& name, const AtomString& fontFamily, const FontPaletteValues::PaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColor) { return adoptRef(*new StyleRuleFontPaletteValues(name, fontFamily, basePalette, WTFMove(overrideColor))); } 163 164 ~StyleRuleFontPaletteValues(); 165 166 const AtomString& name() const 167 { 168 return m_name; 169 } 170 171 const AtomString& fontFamily() const 172 { 173 return m_fontFamily; 174 } 175 176 const FontPaletteValues& fontPaletteValues() const 177 { 178 return m_fontPaletteValues; 179 } 180 181 const FontPaletteValues::PaletteIndex& basePalette() const 182 { 183 return m_fontPaletteValues.basePalette(); 184 } 185 186 const Vector<FontPaletteValues::OverriddenColor>& overrideColor() const 187 { 188 return m_fontPaletteValues.overrideColor(); 189 } 190 191 Ref<StyleRuleFontPaletteValues> copy() const { return adoptRef(*new StyleRuleFontPaletteValues(*this)); } 192 193 private: 194 StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, const FontPaletteValues::PaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColor); 195 StyleRuleFontPaletteValues(const StyleRuleFontPaletteValues&); 196 197 AtomString m_name; 198 AtomString m_fontFamily; 199 FontPaletteValues m_fontPaletteValues; 200 }; 201 158 202 class StyleRulePage final : public StyleRuleBase { 159 203 public: … … 358 402 SPECIALIZE_TYPE_TRAITS_END() 359 403 404 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleFontPaletteValues) 405 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isFontPaletteValuesRule(); } 406 SPECIALIZE_TYPE_TRAITS_END() 407 360 408 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleMedia) 361 409 static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isMediaRule(); } -
trunk/Source/WebCore/css/StyleRuleType.h
r281701 r282806 1 1 /* 2 * Copyright (C) 2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 30 30 enum class StyleRuleType : uint8_t { 31 Unknown, // Not used. 32 Style, 33 Charset, // Not used. These are internally strings owned by the style sheet. 34 Import, 35 Media, 36 FontFace, 37 Page, 38 Keyframes, 39 Keyframe, // Not used. These are internally non-rule StyleRuleKeyframe objects. 31 Unknown = 0, // Not used. 32 Style = 1, 33 Charset = 2, // Not used. These are internally strings owned by the style sheet. 34 Import = 3, 35 Media = 4, 36 FontFace = 5, 37 Page = 6, 38 Keyframes = 7, 39 Keyframe = 8, // Not used. These are internally non-rule StyleRuleKeyframe objects. 40 // Margin = 9, FIXME: Why is this missing? 40 41 Namespace = 10, 41 42 CounterStyle = 11, 42 43 Supports = 12, 43 Layer = 13, 44 FontPaletteValues = 19, // https://github.com/w3c/csswg-drafts/issues/6623 45 Layer = 20 44 46 }; 45 47 -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r281701 r282806 1 1 /* 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004-20 17Apple Inc. All rights reserved.3 * Copyright (C) 2004-2021 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 437 437 case StyleRuleType::Style: 438 438 case StyleRuleType::FontFace: 439 case StyleRuleType::FontPaletteValues: 439 440 case StyleRuleType::Page: 440 441 case StyleRuleType::Keyframes: … … 487 488 case StyleRuleType::Supports: 488 489 case StyleRuleType::Layer: 490 case StyleRuleType::FontPaletteValues: 489 491 return false; 490 492 }; -
trunk/Source/WebCore/css/parser/CSSAtRuleID.cpp
r281701 r282806 1 1 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Copyright (C) 2016 Apple Inc. All rights reserved.2 // Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 // 4 4 // Redistribution and use in source and binary forms, with or without … … 39 39 if (equalIgnoringASCIICase(name, "font-face")) 40 40 return CSSAtRuleFontFace; 41 if (equalIgnoringASCIICase(name, "font-palette-values")) 42 return CSSAtRuleFontPaletteValues; 41 43 if (equalIgnoringASCIICase(name, "import")) 42 44 return CSSAtRuleImport; -
trunk/Source/WebCore/css/parser/CSSAtRuleID.h
r281701 r282806 1 1 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Copyright (C) 2016 Apple Inc. All rights reserved.2 // Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 // 4 4 // Redistribution and use in source and binary forms, with or without … … 50 50 CSSAtRuleCounterStyle = 12, 51 51 CSSAtRuleLayer = 13, 52 53 CSSAtRuleFontPaletteValues = 14, 52 54 }; 53 55 -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r281928 r282806 1 1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright (C) 2016-202 0Apple Inc. All rights reserved.2 // Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 // 4 4 // Redistribution and use in source and binary forms, with or without … … 35 35 #include "CSSCustomPropertyValue.h" 36 36 #include "CSSDeferredParser.h" 37 #include "CSSFontPaletteValuesOverrideColorValue.h" 37 38 #include "CSSKeyframeRule.h" 38 39 #include "CSSKeyframesRule.h" … … 48 49 #include "Document.h" 49 50 #include "Element.h" 51 #include "FontPaletteValues.h" 50 52 #include "MediaList.h" 51 53 #include "MediaQueryParser.h" … … 446 448 case CSSAtRuleFontFace: 447 449 return consumeFontFaceRule(prelude, block); 450 case CSSAtRuleFontPaletteValues: 451 return consumeFontPaletteValuesRule(prelude, block); 448 452 case CSSAtRuleWebkitKeyframes: 449 453 return consumeKeyframesRule(true, prelude, block); … … 651 655 consumeDeclarationList(block, StyleRuleType::FontFace); 652 656 return StyleRuleFontFace::create(createStyleProperties(m_parsedProperties, m_context.mode)); 657 } 658 659 RefPtr<StyleRuleFontPaletteValues> CSSParserImpl::consumeFontPaletteValuesRule(CSSParserTokenRange prelude, CSSParserTokenRange block) 660 { 661 auto name = CSSPropertyParserHelpers::consumeCustomIdent(prelude); 662 if (!name || !prelude.atEnd()) 663 return nullptr; // Parse error; expected custom ident in @font-palette-values header 664 665 if (m_observerWrapper) { 666 unsigned endOffset = m_observerWrapper->endOffset(prelude); 667 m_observerWrapper->observer().startRuleHeader(StyleRuleType::FontPaletteValues, m_observerWrapper->startOffset(prelude)); 668 m_observerWrapper->observer().endRuleHeader(endOffset); 669 m_observerWrapper->observer().startRuleBody(endOffset); 670 m_observerWrapper->observer().endRuleBody(endOffset); 671 } 672 673 consumeDeclarationList(block, StyleRuleType::FontPaletteValues); 674 auto properties = createStyleProperties(m_parsedProperties, m_context.mode); 675 676 AtomString fontFamily; 677 if (auto fontFamilyValue = properties->getPropertyCSSValue(CSSPropertyFontFamily)) 678 fontFamily = downcast<CSSPrimitiveValue>(*fontFamilyValue).fontFamily().familyName; 679 680 FontPaletteValues::PaletteIndex basePalette(nullAtom()); 681 if (auto basePaletteValue = properties->getPropertyCSSValue(CSSPropertyBasePalette)) { 682 const auto& primitiveValue = downcast<CSSPrimitiveValue>(*basePaletteValue); 683 if (primitiveValue.isString()) 684 basePalette = primitiveValue.stringValue(); 685 else if (primitiveValue.isNumber()) 686 basePalette = primitiveValue.value<int64_t>(); 687 } 688 689 Vector<FontPaletteValues::OverriddenColor> overrideColor; 690 if (auto overrideColorValue = properties->getPropertyCSSValue(CSSPropertyOverrideColor)) { 691 const auto& list = downcast<CSSValueList>(*overrideColorValue); 692 for (const auto& item : list) { 693 FontPaletteValues::PaletteColorIndex key(nullAtom()); 694 const auto& pair = downcast<CSSFontPaletteValuesOverrideColorValue>(item.get()); 695 if (pair.key().isString()) 696 key = pair.key().stringValue(); 697 else if (pair.key().isNumber()) 698 key = pair.key().value<int64_t>(); 699 else 700 continue; 701 overrideColor.append(std::make_pair(key, pair.color().color())); 702 } 703 } 704 705 return StyleRuleFontPaletteValues::create(name->stringValue(), fontFamily, basePalette, WTFMove(overrideColor)); 653 706 } 654 707 … … 962 1015 } 963 1016 964 if (important && (ruleType == StyleRuleType::FontFace || ruleType == StyleRuleType::Keyframe || ruleType == StyleRuleType::CounterStyle ))1017 if (important && (ruleType == StyleRuleType::FontFace || ruleType == StyleRuleType::Keyframe || ruleType == StyleRuleType::CounterStyle || ruleType == StyleRuleType::FontPaletteValues)) 965 1018 return; 966 1019 -
trunk/Source/WebCore/css/parser/CSSParserImpl.h
r281701 r282806 1 1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright (C) 2016-202 0Apple Inc. All rights reserved.2 // Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 // 4 4 // Redistribution and use in source and binary forms, with or without … … 52 52 class StyleRuleCharset; 53 53 class StyleRuleFontFace; 54 class StyleRuleFontPaletteValues; 54 55 class StyleRuleImport; 55 56 class StyleRuleKeyframes; … … 134 135 RefPtr<StyleRuleViewport> consumeViewportRule(CSSParserTokenRange prelude, CSSParserTokenRange block); 135 136 RefPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserTokenRange prelude, CSSParserTokenRange block); 137 RefPtr<StyleRuleFontPaletteValues> consumeFontPaletteValuesRule(CSSParserTokenRange prelude, CSSParserTokenRange block); 136 138 RefPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitPrefixed, CSSParserTokenRange prelude, CSSParserTokenRange block); 137 139 RefPtr<StyleRulePage> consumePageRule(CSSParserTokenRange prelude, CSSParserTokenRange block); -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r282723 r282806 39 39 #include "CSSFontFaceSrcValue.h" 40 40 #include "CSSFontFeatureValue.h" 41 #include "CSSFontPaletteValuesOverrideColorValue.h" 41 42 #if ENABLE(VARIATION_FONTS) 42 43 #include "CSSFontVariationValue.h" … … 234 235 if (ruleType == StyleRuleType::FontFace) 235 236 parseSuccess = parser.parseFontFaceDescriptor(propertyID); 237 else if (ruleType == StyleRuleType::FontPaletteValues) 238 parseSuccess = parser.parseFontPaletteValuesDescriptor(propertyID); 236 239 else if (ruleType == StyleRuleType::CounterStyle) 237 240 parseSuccess = parser.parseCounterStyleDescriptor(propertyID, context); … … 4835 4838 } 4836 4839 4840 static RefPtr<CSSPrimitiveValue> consumeBasePaletteDescriptor(CSSParserTokenRange& range) 4841 { 4842 if (range.peek().type() == StringToken) 4843 return consumeString(range); 4844 return consumeInteger(range); 4845 } 4846 4847 static RefPtr<CSSValueList> consumeOverrideColorDescriptor(CSSParserTokenRange& range, const CSSParserContext& context) 4848 { 4849 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 4850 do { 4851 RefPtr<CSSPrimitiveValue> key; 4852 if (range.peek().type() == StringToken) 4853 key = consumeString(range); 4854 else 4855 key = consumeInteger(range); 4856 if (!key) 4857 return nullptr; 4858 4859 auto color = consumeColor(range, context); 4860 if (!color) 4861 return nullptr; 4862 4863 RefPtr<CSSValue> value = CSSFontPaletteValuesOverrideColorValue::create(key.releaseNonNull(), color.releaseNonNull()); 4864 list->append(value.releaseNonNull()); 4865 } while (consumeCommaIncludingWhitespace(range)); 4866 4867 if (!range.atEnd() || !list->length()) 4868 return nullptr; 4869 4870 return list; 4871 } 4872 4873 bool CSSPropertyParser::parseFontPaletteValuesDescriptor(CSSPropertyID propId) 4874 { 4875 RefPtr<CSSValue> parsedValue; 4876 switch (propId) { 4877 case CSSPropertyFontFamily: 4878 parsedValue = consumeFamilyName(m_range); 4879 break; 4880 case CSSPropertyBasePalette: 4881 parsedValue = consumeBasePaletteDescriptor(m_range); 4882 break; 4883 case CSSPropertyOverrideColor: 4884 parsedValue = consumeOverrideColorDescriptor(m_range, m_context); 4885 break; 4886 default: 4887 break; 4888 } 4889 4890 if (!parsedValue || !m_range.atEnd()) 4891 return false; 4892 4893 addProperty(propId, CSSPropertyInvalid, *parsedValue, false); 4894 return true; 4895 } 4896 4837 4897 bool CSSPropertyParser::consumeSystemFont(bool important) 4838 4898 { -
trunk/Source/WebCore/css/parser/CSSPropertyParser.h
r282397 r282806 1 1 /* 2 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004 , 2005, 2006, 2008, 2009, 2010, 2016Apple Inc. All rights reserved.3 * Copyright (C) 2004 - 2021 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. … … 74 74 bool parseViewportDescriptor(CSSPropertyID propId, bool important); 75 75 bool parseFontFaceDescriptor(CSSPropertyID); 76 bool parseFontPaletteValuesDescriptor(CSSPropertyID); 76 77 bool parseCounterStyleDescriptor(CSSPropertyID, const CSSParserContext&); 77 78
Note: See TracChangeset
for help on using the changeset viewer.