diff --git a/devtools/server/actors/animation-type-longhand.js b/devtools/server/actors/animation-type-longhand.js index 1b9aea5536f9..798b169be101 100644 --- a/devtools/server/actors/animation-type-longhand.js +++ b/devtools/server/actors/animation-type-longhand.js @@ -63,7 +63,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [ "font-feature-settings", "font-kerning", "font-language-override", - "font-palette", "font-style", "font-synthesis", "font-variant-alternates", diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index 5907f7e1eb83..d4c3073ec75a 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -3037,7 +3037,6 @@ exports.CSS_PROPERTIES = { "font-variation-settings", "font-language-override", "font-optical-sizing", - "font-palette", "math-depth", "math-style", "-moz-osx-font-smoothing", @@ -6682,8 +6681,7 @@ exports.CSS_PROPERTIES = { "font-variant-position", "font-language-override", "font-feature-settings", - "font-variation-settings", - "font-palette" + "font-variation-settings" ], "supports": [], "values": [ @@ -6817,20 +6815,6 @@ exports.CSS_PROPERTIES = { "unset" ] }, - "font-palette": { - "isInherited": true, - "subproperties": [ - "font-palette" - ], - "supports": [], - "values": [ - "inherit", - "initial", - "revert", - "revert-layer", - "unset" - ] - }, "font-size": { "isInherited": true, "subproperties": [ @@ -11934,10 +11918,6 @@ exports.PREFERENCES = [ "d", "layout.css.d-property.enabled" ], - [ - "font-palette", - "layout.css.font-palette.enabled" - ], [ "font-variation-settings", "layout.css.font-variations.enabled" diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 213dcdb7a8d4..7d3293dc19d6 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -7184,7 +7184,6 @@ void Document::ApplicableStylesChanged() { pc->MarkCounterStylesDirty(); pc->MarkFontFeatureValuesDirty(); - pc->MarkFontPaletteValuesDirty(); pc->RestyleManager()->NextRestyleIsForCSSRuleChanges(); } diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index c12dd2fa988f..eab4e14d18fb 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -283,8 +283,6 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "CSSFontFeatureValuesRule", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "CSSFontPaletteValuesRule", insecureContext: true, nightly: true }, - // IMPORTANT: Do not change this list without review from a DOM peer! { name: "CSSGroupingRule", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "CSSImportRule", insecureContext: true }, diff --git a/dom/webidl/CSSFontPaletteValuesRule.webidl b/dom/webidl/CSSFontPaletteValuesRule.webidl deleted file mode 100644 index 4ec58c8a15c6..000000000000 --- a/dom/webidl/CSSFontPaletteValuesRule.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://drafts.csswg.org/css-fonts/#om-fontpalettevalues - */ - -[Exposed=Window, Pref="layout.css.font-palette.enabled"] -interface CSSFontPaletteValuesRule : CSSRule { - readonly attribute UTF8String name; - readonly attribute UTF8String fontFamily; - readonly attribute UTF8String basePalette; - readonly attribute UTF8String overrideColors; -}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 76ba0339bf12..c71e33f293b9 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -481,7 +481,6 @@ WEBIDL_FILES = [ "CSSCounterStyleRule.webidl", "CSSFontFaceRule.webidl", "CSSFontFeatureValuesRule.webidl", - "CSSFontPaletteValuesRule.webidl", "CSSGroupingRule.webidl", "CSSImportRule.webidl", "CSSKeyframeRule.webidl", diff --git a/gfx/tests/fuzz/TestCOLRv1.cpp b/gfx/tests/fuzz/TestCOLRv1.cpp index 7efe4613ed2e..0811fc4f6d32 100644 --- a/gfx/tests/fuzz/TestCOLRv1.cpp +++ b/gfx/tests/fuzz/TestCOLRv1.cpp @@ -43,9 +43,6 @@ static int FuzzingRunCOLRv1(const uint8_t* data, size_t size) { RefPtr sf = new MockScaledFont(uf, hb_data_font); Float f2p = kPixelSize / hb_face_get_upem(hb_data_face); - UniquePtr> colorPalette = - COLRFonts::SetupColorPalette(hb_data_face, nullptr, nullptr, "dummy"_ns); - for (unsigned i = 0; i <= glyph_count; ++i) { if (COLRFonts::GetColrTableVersion(colr) == 1) { Rect bounds = @@ -54,16 +51,15 @@ static int FuzzingRunCOLRv1(const uint8_t* data, size_t size) { if (paintGraph) { dt->PushClipRect(bounds); COLRFonts::PaintGlyphGraph(colr, hb_data_font, paintGraph, dt, nullptr, - sf, DrawOptions(), sRGBColor(), colorPalette, - Point(), i, f2p); + sf, DrawOptions(), sRGBColor(), Point(), i, + f2p); dt->PopClip(); } } const auto* layers = COLRFonts::GetGlyphLayers(colr, i); if (layers) { COLRFonts::PaintGlyphLayers(colr, hb_data_face, layers, dt, nullptr, sf, - DrawOptions(), sRGBColor(), colorPalette, - Point()); + DrawOptions(), sRGBColor(), Point()); } } diff --git a/gfx/thebes/COLRFonts.cpp b/gfx/thebes/COLRFonts.cpp index 1bbd38016c56..cb7b4fb30d3e 100644 --- a/gfx/thebes/COLRFonts.cpp +++ b/gfx/thebes/COLRFonts.cpp @@ -146,7 +146,7 @@ struct PaintState { const COLRHeader* v0; const COLRv1Header* v1; } mHeader; - const sRGBColor* mPalette; + const hb_color_t* mPalette; DrawTarget* mDrawTarget; ScaledFont* mScaledFont; const int* mCoords; @@ -174,13 +174,16 @@ struct PaintState { DeviceColor PaintState::GetColor(uint16_t aPaletteIndex, float aAlpha) const { sRGBColor color; if (aPaletteIndex < mNumColors) { - color = mPalette[uint16_t(aPaletteIndex)]; + const hb_color_t& c = mPalette[uint16_t(aPaletteIndex)]; + color = sRGBColor( + hb_color_get_red(c) / 255.0, hb_color_get_green(c) / 255.0, + hb_color_get_blue(c) / 255.0, hb_color_get_alpha(c) / 255.0 * aAlpha); } else if (aPaletteIndex == 0xffff) { color = mCurrentColor; + color.a *= aAlpha; } else { // Palette index out of range! Return transparent black. color = sRGBColor(); } - color.a *= aAlpha; return ToDeviceColor(color); } @@ -2363,8 +2366,8 @@ const COLRFonts::GlyphLayers* COLRFonts::GetGlyphLayers(hb_blob_t* aCOLR, bool COLRFonts::PaintGlyphLayers( hb_blob_t* aCOLR, hb_face_t* aFace, const GlyphLayers* aLayers, DrawTarget* aDrawTarget, layout::TextDrawTarget* aTextDrawer, - ScaledFont* aScaledFont, DrawOptions aDrawOptions, const Point& aPoint, - const sRGBColor& aCurrentColor, const nsTArray* aColors) { + ScaledFont* aScaledFont, DrawOptions aDrawOptions, + const sRGBColor& aCurrentColor, const Point& aPoint) { const auto* glyphRecord = reinterpret_cast(aLayers); // Default to opaque rendering (non-webrender applies alpha with a layer) float alpha = 1.0; @@ -2389,11 +2392,19 @@ bool COLRFonts::PaintGlyphLayers( alpha = aCurrentColor.a; } + // Get the default palette (TODO: hook up CSS font-palette support) + unsigned int colorCount = 0; + AutoTArray colors; + colors.SetLength(hb_ot_color_palette_get_colors(aFace, /* paletteIndex */ 0, + 0, &colorCount, nullptr)); + colorCount = colors.Length(); + hb_ot_color_palette_get_colors(aFace, 0, 0, &colorCount, colors.Elements()); + unsigned int length; const COLRHeader* colr = reinterpret_cast(hb_blob_get_data(aCOLR, &length)); PaintState state{{colr}, - aColors->Elements(), + colors.Elements(), aDrawTarget, aScaledFont, nullptr, // variations not needed @@ -2401,7 +2412,7 @@ bool COLRFonts::PaintGlyphLayers( length, aCurrentColor, 0.0, // fontUnitsToPixels not needed - uint16_t(aColors->Length()), + uint16_t(colors.Length()), 0, nullptr}; return glyphRecord->Paint(state, alpha, aPoint); @@ -2432,21 +2443,29 @@ const COLRFonts::GlyphPaintGraph* COLRFonts::GetGlyphPaintGraph( bool COLRFonts::PaintGlyphGraph( hb_blob_t* aCOLR, hb_font_t* aFont, const GlyphPaintGraph* aPaintGraph, DrawTarget* aDrawTarget, layout::TextDrawTarget* aTextDrawer, - ScaledFont* aScaledFont, DrawOptions aDrawOptions, const Point& aPoint, - const sRGBColor& aCurrentColor, const nsTArray* aColors, - uint32_t aGlyphId, float aFontUnitsToPixels) { + ScaledFont* aScaledFont, DrawOptions aDrawOptions, + const sRGBColor& aCurrentColor, const Point& aPoint, uint32_t aGlyphId, + float aFontUnitsToPixels) { if (aTextDrawer) { // Currently we always punt to a blob for COLRv1 glyphs. aTextDrawer->FoundUnsupportedFeature(); return true; } + unsigned int colorCount = 0; + AutoTArray colors; + hb_face_t* face = hb_font_get_face(aFont); + colors.SetLength(hb_ot_color_palette_get_colors(face, /* paletteIndex */ 0, 0, + &colorCount, nullptr)); + colorCount = colors.Length(); + hb_ot_color_palette_get_colors(face, 0, 0, &colorCount, colors.Elements()); + unsigned int coordCount; const int* coords = hb_font_get_var_coords_normalized(aFont, &coordCount); AutoTArray visitedOffsets; PaintState state{{nullptr}, - aColors->Elements(), + colors.Elements(), aDrawTarget, aScaledFont, coords, @@ -2454,7 +2473,7 @@ bool COLRFonts::PaintGlyphGraph( hb_blob_get_length(aCOLR), aCurrentColor, aFontUnitsToPixels, - uint16_t(aColors->Length()), + uint16_t(colors.Length()), uint16_t(coordCount), &visitedOffsets}; state.mHeader.v1 = @@ -2515,98 +2534,4 @@ uint16_t COLRFonts::GetColrTableVersion(hb_blob_t* aCOLR) { return colr->version; } -UniquePtr> COLRFonts::SetupColorPalette( - hb_face_t* aFace, const FontPaletteValueSet* aPaletteValueSet, - nsAtom* aFontPalette, const nsACString& aFamilyName) { - // Find the base color palette to use, if there are multiple available; - // default to first in the font, if nothing matches what is requested. - unsigned int paletteIndex = 0; - unsigned int count = hb_ot_color_palette_get_count(aFace); - MOZ_ASSERT(count > 0, "No palettes? Font should have been rejected!"); - - const FontPaletteValueSet::PaletteValues* fpv = nullptr; - if (aFontPalette && aFontPalette != nsGkAtoms::normal && - (count > 1 || aPaletteValueSet)) { - auto findPalette = [&](hb_ot_color_palette_flags_t flag) -> unsigned int { - MOZ_ASSERT(flag != HB_OT_COLOR_PALETTE_FLAG_DEFAULT); - for (unsigned int i = 0; i < count; ++i) { - if (hb_ot_color_palette_get_flags(aFace, i) & flag) { - return i; - } - } - return 0; - }; - - if (aFontPalette == nsGkAtoms::light) { - paletteIndex = - findPalette(HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND); - } else if (aFontPalette == nsGkAtoms::dark) { - paletteIndex = - findPalette(HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND); - } else { - if (aPaletteValueSet) { - if ((fpv = aPaletteValueSet->Lookup(aFontPalette, aFamilyName))) { - if (fpv->mBasePalette >= 0 && fpv->mBasePalette < int32_t(count)) { - paletteIndex = fpv->mBasePalette; - } else if (fpv->mBasePalette == - FontPaletteValueSet::PaletteValues::kLight) { - paletteIndex = findPalette( - HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND); - } else if (fpv->mBasePalette == - FontPaletteValueSet::PaletteValues::kDark) { - paletteIndex = findPalette( - HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND); - } - } - } - } - } - - // Collect the palette colors and convert them to sRGBColor values. - count = - hb_ot_color_palette_get_colors(aFace, paletteIndex, 0, nullptr, nullptr); - nsTArray colors; - colors.SetLength(count); - hb_ot_color_palette_get_colors(aFace, paletteIndex, 0, &count, - colors.Elements()); - - auto palette = MakeUnique>(); - palette->SetCapacity(count); - for (const auto c : colors) { - palette->AppendElement( - sRGBColor(hb_color_get_red(c) / 255.0, hb_color_get_green(c) / 255.0, - hb_color_get_blue(c) / 255.0, hb_color_get_alpha(c) / 255.0)); - } - - // Apply @font-palette-values overrides, if present. - if (fpv) { - for (const auto overrideColor : fpv->mOverrides) { - if (overrideColor.mIndex < palette->Length()) { - (*palette)[overrideColor.mIndex] = overrideColor.mColor; - } - } - } - - return palette; -} - -const FontPaletteValueSet::PaletteValues* FontPaletteValueSet::Lookup( - nsAtom* aName, const nsACString& aFamily) const { - nsAutoCString family(aFamily); - ToLowerCase(family); - if (const HashEntry* entry = - mValues.GetEntry(PaletteHashKey(aName, family))) { - return &entry->mValue; - } - return nullptr; -} - -FontPaletteValueSet::PaletteValues* FontPaletteValueSet::Insert( - nsAtom* aName, const nsACString& aFamily) { - nsAutoCString family(aFamily); - ToLowerCase(family); - HashEntry* entry = mValues.PutEntry(PaletteHashKey(aName, family)); - return &entry->mValue; -} - } // end namespace mozilla::gfx diff --git a/gfx/thebes/COLRFonts.h b/gfx/thebes/COLRFonts.h index a073bb416462..6a7175c2c0bf 100644 --- a/gfx/thebes/COLRFonts.h +++ b/gfx/thebes/COLRFonts.h @@ -7,10 +7,6 @@ #define COLR_FONTS_H #include "mozilla/gfx/2D.h" -#include "mozilla/UniquePtr.h" -#include "nsAtom.h" -#include "nsTArray.h" -#include "nsTHashtable.h" struct hb_blob_t; struct hb_face_t; @@ -24,70 +20,6 @@ class TextDrawTarget; namespace gfx { -class FontPaletteValueSet { - public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FontPaletteValueSet) - - struct OverrideColor { - uint32_t mIndex = 0; - sRGBColor mColor; - }; - - struct PaletteValues { - enum { kLight = -1, kDark = -2 }; - int32_t mBasePalette = 0; // 0-based index, or kLight/kDark constants - nsTArray mOverrides; - }; - - const PaletteValues* Lookup(nsAtom* aName, const nsACString& aFamily) const; - - PaletteValues* Insert(nsAtom* aName, const nsACString& aFamily); - - private: - ~FontPaletteValueSet() = default; - - struct PaletteHashKey { - RefPtr mName; - nsCString mFamily; - - PaletteHashKey() = delete; - PaletteHashKey(nsAtom* aName, const nsACString& aFamily) - : mName(aName), mFamily(aFamily) {} - PaletteHashKey(const PaletteHashKey& aKey) = default; - }; - - class HashEntry : public PLDHashEntryHdr { - public: - using KeyType = const PaletteHashKey&; - using KeyTypePointer = const PaletteHashKey*; - - HashEntry() = delete; - explicit HashEntry(KeyTypePointer aKey) : mKey(*aKey) {} - HashEntry(HashEntry&& other) noexcept - : PLDHashEntryHdr(std::move(other)), - mKey(other.mKey), - mValue(std::move(other.mValue)) { - NS_ERROR("Should not be called"); - } - ~HashEntry() = default; - - bool KeyEquals(const KeyTypePointer aKey) const { - return mKey.mName == aKey->mName && mKey.mFamily.Equals(aKey->mFamily); - } - static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } - static PLDHashNumber HashKey(const KeyTypePointer aKey) { - return aKey->mName->hash() + - HashString(aKey->mFamily.get(), aKey->mFamily.Length()); - } - enum { ALLOW_MEMMOVE = true }; - - PaletteHashKey mKey; - PaletteValues mValue; - }; - - nsTHashtable mValues; -}; - class COLRFonts { public: static bool ValidateColorGlyphs(hb_blob_t* aCOLR, hb_blob_t* aCPAL); @@ -101,8 +33,8 @@ class COLRFonts { static bool PaintGlyphLayers( hb_blob_t* aCOLR, hb_face_t* aFace, const GlyphLayers* aLayers, DrawTarget* aDrawTarget, layout::TextDrawTarget* aTextDrawer, - ScaledFont* aScaledFont, DrawOptions aDrawOptions, const Point& aPoint, - const sRGBColor& aCurrentColor, const nsTArray* aColors); + ScaledFont* aScaledFont, DrawOptions aDrawOptions, + const sRGBColor& aCurrentColor, const Point& aPoint); // COLRv1 support: color glyph is represented by a directed acyclic graph of // paint records. @@ -112,12 +44,14 @@ class COLRFonts { static const GlyphPaintGraph* GetGlyphPaintGraph(hb_blob_t* aCOLR, uint32_t aGlyphId); - static bool PaintGlyphGraph( - hb_blob_t* aCOLR, hb_font_t* aFont, const GlyphPaintGraph* aPaintGraph, - DrawTarget* aDrawTarget, layout::TextDrawTarget* aTextDrawer, - ScaledFont* aScaledFont, DrawOptions aDrawOptions, const Point& aPoint, - const sRGBColor& aCurrentColor, const nsTArray* aColors, - uint32_t aGlyphId, float aFontUnitsToPixels); + static bool PaintGlyphGraph(hb_blob_t* aCOLR, hb_font_t* aFont, + const GlyphPaintGraph* aPaintGraph, + DrawTarget* aDrawTarget, + layout::TextDrawTarget* aTextDrawer, + ScaledFont* aScaledFont, DrawOptions aDrawOptions, + const sRGBColor& aCurrentColor, + const Point& aPoint, uint32_t aGlyphId, + float aFontUnitsToPixels); static Rect GetColorGlyphBounds(hb_blob_t* aCOLR, hb_font_t* aFont, uint32_t aGlyphId, DrawTarget* aDrawTarget, @@ -125,10 +59,6 @@ class COLRFonts { float aFontUnitsToPixels); static uint16_t GetColrTableVersion(hb_blob_t* aCOLR); - - static UniquePtr> SetupColorPalette( - hb_face_t* aFace, const FontPaletteValueSet* aPaletteValueSet, - nsAtom* aFontPalette, const nsACString& aFamilyName); }; } // namespace gfx diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index a2e7a61f3c64..4652399a74b2 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2035,7 +2035,8 @@ void gfxFont::DrawOneGlyph(uint32_t aGlyphID, const gfx::Point& aPt, if (fontParams.haveColorGlyphs && !UseNativeColrFontSupport() && RenderColorGlyph(runParams.dt, runParams.context, textDrawer, - fontParams, devPt, aGlyphID)) { + fontParams.scaledFont, fontParams.drawOptions, devPt, + aGlyphID)) { return; } @@ -2186,17 +2187,6 @@ void gfxFont::Draw(const gfxTextRun* aTextRun, uint32_t aStart, uint32_t aEnd, fontParams.haveColorGlyphs = GetFontEntry()->TryGetColorGlyphs(); fontParams.contextPaint = aRunParams.runContextPaint; - if (fontParams.haveColorGlyphs && !UseNativeColrFontSupport()) { - DeviceColor ctxColor; - fontParams.currentColor = aRunParams.context->GetDeviceColor(ctxColor) - ? sRGBColor::FromABGR(ctxColor.ToABGR()) - : sRGBColor::OpaqueBlack(); - gfxFontEntry::AutoHBFace face = GetFontEntry()->GetHBFace(); - fontParams.palette = COLRFonts::SetupColorPalette( - face, aRunParams.paletteValueSet, aRunParams.fontPalette, - GetFontEntry()->FamilyName()); - } - if (textDrawer) { fontParams.isVerticalFont = aRunParams.isVerticalRun; } else { @@ -2478,17 +2468,24 @@ bool gfxFont::RenderSVGGlyph(gfxContext* aContext, bool gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget, gfxContext* aContext, layout::TextDrawTarget* aTextDrawer, - const FontDrawParams& aFontParams, - const Point& aPoint, uint32_t aGlyphId) { + ScaledFont* aScaledFont, + DrawOptions aDrawOptions, const Point& aPoint, + uint32_t aGlyphId) { + auto currentColor = [=]() { + DeviceColor ctxColor; + return aContext->GetDeviceColor(ctxColor) + ? sRGBColor::FromABGR(ctxColor.ToABGR()) + : sRGBColor::OpaqueBlack(); + }; + if (const auto* paintGraph = COLRFonts::GetGlyphPaintGraph(GetFontEntry()->GetCOLR(), aGlyphId)) { const auto* hbShaper = GetHarfBuzzShaper(); if (hbShaper && hbShaper->IsInitialized()) { return COLRFonts::PaintGlyphGraph( GetFontEntry()->GetCOLR(), hbShaper->GetHBFont(), paintGraph, - aDrawTarget, aTextDrawer, aFontParams.scaledFont, - aFontParams.drawOptions, aPoint, aFontParams.currentColor, - aFontParams.palette.get(), aGlyphId, mFUnitsConvFactor); + aDrawTarget, aTextDrawer, aScaledFont, aDrawOptions, currentColor(), + aPoint, aGlyphId, mFUnitsConvFactor); } } @@ -2497,8 +2494,7 @@ bool gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget, gfxContext* aContext, auto face(GetFontEntry()->GetHBFace()); bool ok = COLRFonts::PaintGlyphLayers( GetFontEntry()->GetCOLR(), face, layers, aDrawTarget, aTextDrawer, - aFontParams.scaledFont, aFontParams.drawOptions, aPoint, - aFontParams.currentColor, aFontParams.palette.get()); + aScaledFont, aDrawOptions, currentColor(), aPoint); return ok; } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 6c9d304ea55c..4f357a6f158e 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -2263,12 +2263,10 @@ class gfxFont { bool RenderColorGlyph(DrawTarget* aDrawTarget, gfxContext* aContext, mozilla::layout::TextDrawTarget* aTextDrawer, - const FontDrawParams& aFontParams, + mozilla::gfx::ScaledFont* scaledFont, + mozilla::gfx::DrawOptions drawOptions, const mozilla::gfx::Point& aPoint, uint32_t aGlyphId); - void SetupColorPalette(FontDrawParams* aFontParams, - const TextRunDrawParams& aRunParams) const; - // Subclasses can override to return true if the platform is able to render // COLR-font glyphs directly, instead of us painting the layers explicitly. // (Currently used only for COLR.v0 fonts on macOS.) @@ -2303,8 +2301,6 @@ struct MOZ_STACK_CLASS TextRunDrawParams { gfxPattern* textStrokePattern = nullptr; const mozilla::gfx::StrokeOptions* strokeOpts = nullptr; const mozilla::gfx::DrawOptions* drawOpts = nullptr; - const mozilla::gfx::FontPaletteValueSet* paletteValueSet = nullptr; - nsAtom* fontPalette = nullptr; DrawMode drawMode = DrawMode::GLYPH_FILL; bool isVerticalRun = false; bool isRTL = false; @@ -2320,8 +2316,6 @@ struct MOZ_STACK_CLASS FontDrawParams { int32_t extraStrikes; mozilla::gfx::DrawOptions drawOptions; gfxFloat advanceDirection; - mozilla::gfx::sRGBColor currentColor; - mozilla::UniquePtr> palette; bool isVerticalFont; bool haveSVGGlyphs; bool haveColorGlyphs; diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 07a159bd416e..939d115b09c5 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -613,14 +613,12 @@ bool gfxMacFont::ShouldRoundXOffset(cairo_t* aCairo) const { } bool gfxMacFont::UseNativeColrFontSupport() const { - /* - if (nsCocoaFeatures::OnHighSierraOrLater()) { - auto* colr = GetFontEntry()->GetCOLR(); - if (colr && COLRFonts::GetColrTableVersion(colr) == 0) { - return true; - } + if (nsCocoaFeatures::OnHighSierraOrLater()) { + auto* colr = GetFontEntry()->GetCOLR(); + if (colr && COLRFonts::GetColrTableVersion(colr) == 0) { + return true; } - */ + } return false; } diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 67b738b06270..a29ce7c3a4bf 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1827,6 +1827,7 @@ bool gfxPlatform::IsFontFormatSupported( } StyleFontFaceSourceTechFlags unsupportedTechnologies = StyleFontFaceSourceTechFlags::INCREMENTAL | + StyleFontFaceSourceTechFlags::PALETTES | StyleFontFaceSourceTechFlags::COLOR_SBIX; if (!StaticPrefs::gfx_downloadable_fonts_keep_color_bitmaps()) { unsupportedTechnologies |= StyleFontFaceSourceTechFlags::COLOR_CBDT; @@ -1834,9 +1835,6 @@ bool gfxPlatform::IsFontFormatSupported( if (!StaticPrefs::gfx_font_rendering_colr_v1_enabled()) { unsupportedTechnologies |= StyleFontFaceSourceTechFlags::COLOR_COLRV1; } - if (!StaticPrefs::layout_css_font_palette_enabled()) { - unsupportedTechnologies |= StyleFontFaceSourceTechFlags::PALETTES; - } if (!StaticPrefs::layout_css_font_variations_enabled()) { unsupportedTechnologies |= StyleFontFaceSourceTechFlags::VARIATIONS; } diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 5a01ee22ecf4..6e90a6e728d9 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -632,8 +632,6 @@ void gfxTextRun::Draw(const Range aRange, const gfx::Point aPt, params.direction = direction; params.strokeOpts = aParams.strokeOpts; params.textStrokeColor = aParams.textStrokeColor; - params.fontPalette = aParams.fontPalette; - params.paletteValueSet = aParams.paletteValueSet; params.textStrokePattern = aParams.textStrokePattern; params.drawOpts = aParams.drawOpts; params.drawMode = aParams.drawMode; diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index aafc422e58bb..5bccb017c8ed 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -252,8 +252,6 @@ class gfxTextRun : public gfxShapedText { gfxContext* context; DrawMode drawMode = DrawMode::GLYPH_FILL; nscolor textStrokeColor = 0; - nsAtom* fontPalette = nullptr; - mozilla::gfx::FontPaletteValueSet* paletteValueSet = nullptr; gfxPattern* textStrokePattern = nullptr; const mozilla::gfx::StrokeOptions* strokeOpts = nullptr; const mozilla::gfx::DrawOptions* drawOpts = nullptr; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index a3c2ed7c5240..27d4c12a2a0d 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -4350,8 +4350,6 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) { mPresContext->FlushFontFeatureValues(); - mPresContext->FlushFontPaletteValues(); - // Flush any requested SMIL samples. if (mDocument->HasAnimationController()) { mDocument->GetAnimationController()->FlushResampleRequests(); @@ -9410,8 +9408,6 @@ void PresShell::WillDoReflow() { mPresContext->FlushFontFeatureValues(); - mPresContext->FlushFontPaletteValues(); - mLastReflowStart = GetPerformanceNowUnclamped(); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index f5563800b931..54cd2a8df70b 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -277,7 +277,6 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType) mIsGlyph(false), mCounterStylesDirty(true), mFontFeatureValuesDirty(true), - mFontPaletteValuesDirty(true), mIsVisual(false), mHasWarnedAboutTooLargeDashedOrDottedRadius(false), mQuirkSheetAdded(false), @@ -1836,7 +1835,6 @@ void nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint, mDocument->MarkUserFontSetDirty(); MarkCounterStylesDirty(); MarkFontFeatureValuesDirty(); - MarkFontPaletteValuesDirty(); PostRebuildAllStyleDataEvent(aExtraHint, aRestyleHint); } @@ -2782,31 +2780,11 @@ void nsPresContext::FlushFontFeatureValues() { return; // we've been torn down } - if (!mFontFeatureValuesDirty) { - return; + if (mFontFeatureValuesDirty) { + ServoStyleSet* styleSet = mPresShell->StyleSet(); + mFontFeatureValuesLookup = styleSet->BuildFontFeatureValueSet(); + mFontFeatureValuesDirty = false; } - - ServoStyleSet* styleSet = mPresShell->StyleSet(); - mFontFeatureValuesLookup = styleSet->BuildFontFeatureValueSet(); - mFontFeatureValuesDirty = false; -} - -void nsPresContext::FlushFontPaletteValues() { - if (!mPresShell) { - return; // we've been torn down - } - - if (!mFontPaletteValuesDirty) { - return; - } - - ServoStyleSet* styleSet = mPresShell->StyleSet(); - mFontPaletteValueSet = styleSet->BuildFontPaletteValueSet(); - mFontPaletteValuesDirty = false; - - // Even if we're not reflowing anything, a change to the palette means we - // need to repaint in order to show the new colors. - InvalidatePaintedLayers(); } void nsPresContext::SetVisibleArea(const nsRect& r) { diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 9fe2e3c38666..831b004953c7 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -92,9 +92,6 @@ class Document; class Element; enum class PrefersColorSchemeOverride : uint8_t; } // namespace dom -namespace gfx { -class FontPaletteValueSet; -} // namespace gfx } // namespace mozilla // supported values for cached integer pref types @@ -926,9 +923,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { void FlushFontFeatureValues(); void MarkFontFeatureValuesDirty() { mFontFeatureValuesDirty = true; } - void FlushFontPaletteValues(); - void MarkFontPaletteValuesDirty() { mFontPaletteValuesDirty = true; } - // Ensure that it is safe to hand out CSS rules outside the layout // engine by ensuring that all CSS style sheets have unique inners // and, if necessary, synchronously rebuilding all style data. @@ -1090,10 +1084,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { return mFontFeatureValuesLookup; } - mozilla::gfx::FontPaletteValueSet* GetFontPaletteValueSet() const { - return mFontPaletteValueSet; - } - protected: friend class nsRunnableMethod; void ThemeChangedInternal(); @@ -1195,7 +1185,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { RefPtr mCounterStyleManager; const nsStaticAtom* mMedium; RefPtr mFontFeatureValuesLookup; - RefPtr mFontPaletteValueSet; // TODO(emilio): Maybe lazily create and put under a UniquePtr if this grows a // lot? @@ -1351,9 +1340,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { // Is the current mFontFeatureValuesLookup valid? unsigned mFontFeatureValuesDirty : 1; - // Is the current mFontFeatureValueSet valid? - unsigned mFontPaletteValuesDirty : 1; - unsigned mIsVisual : 1; unsigned mHasWarnedAboutTooLargeDashedOrDottedRadius : 1; diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 01f1174e36f3..6100b3936ba2 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -214,8 +214,6 @@ struct nsTextFrame::DrawTextRunParams { DrawPathCallbacks* callbacks = nullptr; nscolor textColor = NS_RGBA(0, 0, 0, 0); nscolor textStrokeColor = NS_RGBA(0, 0, 0, 0); - nsAtom* fontPalette = nullptr; - gfx::FontPaletteValueSet* paletteValueSet = nullptr; float textStrokeWidth = 0.0f; bool drawSoftHyphen = false; explicit DrawTextRunParams(gfxContext* aContext) : context(aContext) {} @@ -6353,9 +6351,6 @@ void nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams, // Multi-color shadow is not allowed, so we use the same color of the text // color. params.decorationOverrideColor = ¶ms.textColor; - params.fontPalette = StyleFont()->GetFontPaletteAtom(); - params.paletteValueSet = PresContext()->GetFontPaletteValueSet(); - DrawText(aParams.range, aParams.textBaselinePt + shadowGfxOffset, params); contextBoxBlur.DoPaint(); @@ -6483,8 +6478,6 @@ bool nsTextFrame::PaintTextWithSelectionColors( params.advanceWidth = &advance; params.callbacks = aParams.callbacks; params.glyphRange = aParams.glyphRange; - params.fontPalette = StyleFont()->GetFontPaletteAtom(); - params.paletteValueSet = PresContext()->GetFontPaletteValueSet(); PaintShadowParams shadowParams(aParams); shadowParams.provider = aParams.provider; @@ -7055,9 +7048,6 @@ void nsTextFrame::PaintText(const PaintTextParams& aParams, params.contextPaint = aParams.contextPaint; params.callbacks = aParams.callbacks; params.glyphRange = range; - params.fontPalette = StyleFont()->GetFontPaletteAtom(); - params.paletteValueSet = PresContext()->GetFontPaletteValueSet(); - DrawText(range, textBaselinePt, params); } @@ -7070,8 +7060,6 @@ static void DrawTextRun(const gfxTextRun* aTextRun, params.provider = aParams.provider; params.advanceWidth = aParams.advanceWidth; params.contextPaint = aParams.contextPaint; - params.fontPalette = aParams.fontPalette; - params.paletteValueSet = aParams.paletteValueSet; params.callbacks = aParams.callbacks; if (aParams.callbacks) { aParams.callbacks->NotifyBeforeText(aParams.textColor); diff --git a/layout/inspector/ServoStyleRuleMap.cpp b/layout/inspector/ServoStyleRuleMap.cpp index f459bcb9a76f..99fa0104485b 100644 --- a/layout/inspector/ServoStyleRuleMap.cpp +++ b/layout/inspector/ServoStyleRuleMap.cpp @@ -103,7 +103,6 @@ void ServoStyleRuleMap::RuleRemoved(StyleSheet& aStyleSheet, case StyleCssRuleType::Namespace: case StyleCssRuleType::CounterStyle: case StyleCssRuleType::FontFeatureValues: - case StyleCssRuleType::FontPaletteValues: case StyleCssRuleType::Viewport: break; } @@ -148,7 +147,6 @@ void ServoStyleRuleMap::FillTableFromRule(css::Rule& aRule) { case StyleCssRuleType::Namespace: case StyleCssRuleType::CounterStyle: case StyleCssRuleType::FontFeatureValues: - case StyleCssRuleType::FontPaletteValues: case StyleCssRuleType::Viewport: break; } diff --git a/layout/style/CSSFontPaletteValuesRule.cpp b/layout/style/CSSFontPaletteValuesRule.cpp deleted file mode 100644 index c63a19ebed3f..000000000000 --- a/layout/style/CSSFontPaletteValuesRule.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/dom/CSSFontPaletteValuesRule.h" -#include "mozilla/dom/CSSFontPaletteValuesRuleBinding.h" -#include "mozilla/ServoBindings.h" - -namespace mozilla::dom { - -size_t CSSFontPaletteValuesRule::SizeOfIncludingThis( - MallocSizeOf aMallocSizeOf) const { - // TODO Implement this! - return aMallocSizeOf(this); -} - -StyleCssRuleType CSSFontPaletteValuesRule::Type() const { - return StyleCssRuleType::FontPaletteValues; -} - -#ifdef DEBUG -void CSSFontPaletteValuesRule::List(FILE* out, int32_t aIndent) const { - nsAutoCString str; - for (int32_t i = 0; i < aIndent; i++) { - str.AppendLiteral(" "); - } - Servo_FontPaletteValuesRule_Debug(mRawRule, &str); - fprintf_stderr(out, "%s\n", str.get()); -} -#endif - -void CSSFontPaletteValuesRule::SetRawAfterClone( - RefPtr aRaw) { - mRawRule = std::move(aRaw); -} - -/* CSSRule implementation */ - -void CSSFontPaletteValuesRule::GetCssText(nsACString& aCssText) const { - Servo_FontPaletteValuesRule_GetCssText(mRawRule, &aCssText); -} - -/* CSSFontPaletteValuesRule implementation */ - -void CSSFontPaletteValuesRule::GetName(nsACString& aNameStr) const { - Servo_FontPaletteValuesRule_GetName(mRawRule, &aNameStr); -} - -void CSSFontPaletteValuesRule::GetFontFamily(nsACString& aFamilyListStr) const { - Servo_FontPaletteValuesRule_GetFontFamily(mRawRule, &aFamilyListStr); -} - -void CSSFontPaletteValuesRule::GetBasePalette(nsACString& aPaletteStr) const { - Servo_FontPaletteValuesRule_GetBasePalette(mRawRule, &aPaletteStr); -} - -void CSSFontPaletteValuesRule::GetOverrideColors(nsACString& aColorsStr) const { - Servo_FontPaletteValuesRule_GetOverrideColors(mRawRule, &aColorsStr); -} - -// If this ever gets its own cycle-collection bits, reevaluate our IsCCLeaf -// implementation. - -bool CSSFontPaletteValuesRule::IsCCLeaf() const { return Rule::IsCCLeaf(); } - -/* virtual */ -JSObject* CSSFontPaletteValuesRule::WrapObject( - JSContext* aCx, JS::Handle aGivenProto) { - return CSSFontPaletteValuesRule_Binding::Wrap(aCx, this, aGivenProto); -} - -} // namespace mozilla::dom diff --git a/layout/style/CSSFontPaletteValuesRule.h b/layout/style/CSSFontPaletteValuesRule.h deleted file mode 100644 index 43ae33e6e5a4..000000000000 --- a/layout/style/CSSFontPaletteValuesRule.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_CSSFontPaletteValuesRule_h -#define mozilla_dom_CSSFontPaletteValuesRule_h - -#include "mozilla/css/Rule.h" -#include "mozilla/ServoBindingTypes.h" - -#include "nsICSSDeclaration.h" - -namespace mozilla::dom { - -class CSSFontPaletteValuesRule final : public css::Rule { - public: - CSSFontPaletteValuesRule(RefPtr aRawRule, - StyleSheet* aSheet, css::Rule* aParentRule, - uint32_t aLine, uint32_t aColumn) - : css::Rule(aSheet, aParentRule, aLine, aColumn), - mRawRule(std::move(aRawRule)) {} - - bool IsCCLeaf() const final; - - RawServoFontPaletteValuesRule* Raw() const { return mRawRule; } - void SetRawAfterClone(RefPtr aRaw); - - // WebIDL interfaces - StyleCssRuleType Type() const final; - - void GetCssText(nsACString& aCssText) const final; - - void GetFontFamily(nsACString& aFamily) const; - - void GetName(nsACString& aName) const; - - void GetBasePalette(nsACString& aPalette) const; - - void GetOverrideColors(nsACString& aColors) const; - - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final; - -#ifdef DEBUG - void List(FILE* out = stdout, int32_t aIndent = 0) const final; -#endif - - JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) final; - - private: - ~CSSFontPaletteValuesRule() = default; - - RefPtr mRawRule; -}; - -} // namespace mozilla::dom - -#endif // mozilla_dom_CSSFontPaletteValuesRule_h diff --git a/layout/style/GeckoBindings.cpp b/layout/style/GeckoBindings.cpp index f3dcd67b63ad..b9e2ede814e1 100644 --- a/layout/style/GeckoBindings.cpp +++ b/layout/style/GeckoBindings.cpp @@ -1005,32 +1005,6 @@ nsTArray* Gecko_AppendFeatureValueHashEntry( aName, aAlternate); } -gfx::FontPaletteValueSet* Gecko_ConstructFontPaletteValueSet() { - return new gfx::FontPaletteValueSet(); -} - -gfx::FontPaletteValueSet::PaletteValues* Gecko_AppendPaletteValueHashEntry( - gfx::FontPaletteValueSet* aPaletteValueSet, nsAtom* aFamily, - nsAtom* aName) { - MOZ_ASSERT(NS_IsMainThread()); - return aPaletteValueSet->Insert(aName, nsAtomCString(aFamily)); -} - -void Gecko_SetFontPaletteBase(gfx::FontPaletteValueSet::PaletteValues* aValues, - int32_t aBasePaletteIndex) { - aValues->mBasePalette = aBasePaletteIndex; -} - -void Gecko_SetFontPaletteOverride( - gfx::FontPaletteValueSet::PaletteValues* aValues, int32_t aIndex, - StyleRGBA aColor) { - if (aIndex < 0) { - return; - } - aValues->mOverrides.AppendElement(gfx::FontPaletteValueSet::OverrideColor{ - uint32_t(aIndex), gfx::sRGBColor::FromABGR(aColor.ToColor())}); -} - void Gecko_CounterStyle_ToPtr(const StyleCounterStyle* aStyle, CounterStylePtr* aPtr) { *aPtr = CounterStylePtr::FromStyle(*aStyle); diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h index 9516b3f85225..bd4e1bc79796 100644 --- a/layout/style/GeckoBindings.h +++ b/layout/style/GeckoBindings.h @@ -19,7 +19,6 @@ #include "mozilla/EffectCompositor.h" #include "mozilla/PreferenceSheet.h" #include "nsStyleStruct.h" -#include "COLRFonts.h" class nsAtom; class nsIURI; @@ -288,22 +287,6 @@ void Gecko_AppendAlternateValues(nsFont* font, uint32_t alternate_name, void Gecko_CopyAlternateValuesFrom(nsFont* dest, const nsFont* src); -// The FontPaletteValueSet returned from this function has zero reference. -mozilla::gfx::FontPaletteValueSet* Gecko_ConstructFontPaletteValueSet(); - -mozilla::gfx::FontPaletteValueSet::PaletteValues* -Gecko_AppendPaletteValueHashEntry( - mozilla::gfx::FontPaletteValueSet* aPaletteValueSet, nsAtom* aFamily, - nsAtom* aName); - -void Gecko_SetFontPaletteBase( - mozilla::gfx::FontPaletteValueSet::PaletteValues* aValues, - int32_t aBasePaletteIndex); - -void Gecko_SetFontPaletteOverride( - mozilla::gfx::FontPaletteValueSet::PaletteValues* aValues, int32_t aIndex, - mozilla::StyleRGBA aColor); - // Visibility style void Gecko_SetImageOrientation(nsStyleVisibility* aVisibility, uint8_t aOrientation, bool aFlip); diff --git a/layout/style/ServoArcTypeList.h b/layout/style/ServoArcTypeList.h index 5d5ff9057ead..9b0e2b17889f 100644 --- a/layout/style/ServoArcTypeList.h +++ b/layout/style/ServoArcTypeList.h @@ -40,7 +40,6 @@ SERVO_ARC_TYPE(SupportsRule, RawServoSupportsRule) SERVO_ARC_TYPE(DocumentRule, RawServoMozDocumentRule) SERVO_ARC_TYPE(ContainerRule, RawServoContainerRule) SERVO_ARC_TYPE(FontFeatureValuesRule, RawServoFontFeatureValuesRule) -SERVO_ARC_TYPE(FontPaletteValuesRule, RawServoFontPaletteValuesRule) SERVO_ARC_TYPE(FontFaceRule, RawServoFontFaceRule) SERVO_ARC_TYPE(CounterStyleRule, RawServoCounterStyleRule) SERVO_ARC_TYPE(CssUrlData, RawServoCssUrlData) diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 6fff04f7ba18..6b44fece4684 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -64,7 +64,6 @@ GROUP_RULE_FUNCS(Supports) GROUP_RULE_FUNCS(LayerBlock) BASIC_RULE_FUNCS(LayerStatement) BASIC_RULE_FUNCS(FontFeatureValues) -BASIC_RULE_FUNCS(FontPaletteValues) BASIC_RULE_FUNCS(FontFace) BASIC_RULE_FUNCS(CounterStyle) GROUP_RULE_FUNCS(Container) diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index b2836ccde9f4..c71f35e96330 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -4,7 +4,6 @@ headers = [ "mozilla/StyleAnimationValue.h", "gfxFontConstants.h", "gfxFontFeatures.h", - "COLRFonts.h", "nsStyleConsts.h", "mozilla/css/Loader.h", "mozilla/css/SheetLoadData.h", @@ -235,8 +234,6 @@ allowlist-types = [ "mozilla::LookAndFeel", "mozilla::gfx::Float", "mozilla::gfx::FontVariation", - "mozilla::gfx::FontPaletteValueSet", - "mozilla::gfx::FontPaletteValueSet::PaletteValeus", "mozilla::StyleImageLayerAttachment", "gfxFontFeature", "gfxFontVariation", @@ -612,7 +609,6 @@ cbindgen-types = [ { gecko = "StyleFontStyle", servo = "crate::values::computed::font::FontStyle" }, { gecko = "StyleFontWeight", servo = "crate::values::computed::font::FontWeight" }, { gecko = "StyleFontStretch", servo = "crate::values::computed::font::FontStretch" }, - { gecko = "StyleFontPalette", servo = "crate::values::computed::font::FontPalette" }, { gecko = "StyleBoolInteger", servo = "crate::values::computed::BoolInteger" }, ] diff --git a/layout/style/ServoCSSRuleList.cpp b/layout/style/ServoCSSRuleList.cpp index 3d8618ac5866..923685200bbd 100644 --- a/layout/style/ServoCSSRuleList.cpp +++ b/layout/style/ServoCSSRuleList.cpp @@ -11,7 +11,6 @@ #include "mozilla/dom/CSSCounterStyleRule.h" #include "mozilla/dom/CSSFontFaceRule.h" #include "mozilla/dom/CSSFontFeatureValuesRule.h" -#include "mozilla/dom/CSSFontPaletteValuesRule.h" #include "mozilla/dom/CSSImportRule.h" #include "mozilla/dom/CSSLayerBlockRule.h" #include "mozilla/dom/CSSLayerStatementRule.h" @@ -87,7 +86,6 @@ css::Rule* ServoCSSRuleList::GetRule(uint32_t aIndex) { CASE_RULE(Document, MozDocument) CASE_RULE(Import, Import) CASE_RULE(FontFeatureValues, FontFeatureValues) - CASE_RULE(FontPaletteValues, FontPaletteValues) CASE_RULE(FontFace, FontFace) CASE_RULE(CounterStyle, CounterStyle) CASE_RULE(LayerBlock, LayerBlock) @@ -256,7 +254,6 @@ void ServoCSSRuleList::SetRawContents(RefPtr aNewRules, CASE_FOR(Document, MozDocument) CASE_FOR(Import, Import) CASE_FOR(FontFeatureValues, FontFeatureValues) - CASE_FOR(FontPaletteValues, FontPaletteValues) CASE_FOR(FontFace, FontFace) CASE_FOR(CounterStyle, CounterStyle) CASE_FOR(LayerBlock, LayerBlock) diff --git a/layout/style/ServoStyleConstsInlines.h b/layout/style/ServoStyleConstsInlines.h index be8bef606910..636caa2d55a6 100644 --- a/layout/style/ServoStyleConstsInlines.h +++ b/layout/style/ServoStyleConstsInlines.h @@ -54,7 +54,6 @@ template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; -template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 7565b0dc6f71..27eaa7d096f2 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -29,7 +29,6 @@ #include "mozilla/dom/CSSRuleBinding.h" #include "mozilla/dom/CSSFontFaceRule.h" #include "mozilla/dom/CSSFontFeatureValuesRule.h" -#include "mozilla/dom/CSSFontPaletteValuesRule.h" #include "mozilla/dom/CSSImportRule.h" #include "mozilla/dom/CSSContainerRule.h" #include "mozilla/dom/CSSLayerBlockRule.h" @@ -948,7 +947,6 @@ void ServoStyleSet::RuleChangedInternal(StyleSheet& aSheet, css::Rule& aRule, CASE_FOR(Media, Media) CASE_FOR(Keyframes, Keyframes) CASE_FOR(FontFeatureValues, FontFeatureValues) - CASE_FOR(FontPaletteValues, FontPaletteValues) CASE_FOR(FontFace, FontFace) CASE_FOR(Page, Page) CASE_FOR(Document, MozDocument) @@ -1225,14 +1223,6 @@ ServoStyleSet::BuildFontFeatureValueSet() { return set.forget(); } -already_AddRefed -ServoStyleSet::BuildFontPaletteValueSet() { - MOZ_ASSERT(!StylistNeedsUpdate()); - RefPtr set = - Servo_StyleSet_BuildFontPaletteValueSet(mRawSet.get()); - return set.forget(); -} - already_AddRefed ServoStyleSet::ResolveForDeclarations( const ComputedStyle* aParentOrNull, const RawServoDeclarationBlock* aDeclarations) { diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index cd5caf6b9ee6..98fbea9e1d7e 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -45,9 +45,6 @@ class CSSImportRule; class Element; class ShadowRoot; } // namespace dom -namespace gfx { -class FontPaletteValueSet; -} // namespace gfx class StyleSheet; struct Keyframe; class ServoElementSnapshotTable; @@ -369,9 +366,6 @@ class ServoStyleSet { // Get all the currently-active font feature values set. already_AddRefed BuildFontFeatureValueSet(); - // Get the set of all currently-active font-palette-values. - already_AddRefed BuildFontPaletteValueSet(); - already_AddRefed GetBaseContextForElement( dom::Element* aElement, const ComputedStyle* aStyle); diff --git a/layout/style/moz.build b/layout/style/moz.build index ec27dd98fb9f..74aebe27bf1e 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -124,7 +124,6 @@ EXPORTS.mozilla.dom += [ "CSSCounterStyleRule.h", "CSSFontFaceRule.h", "CSSFontFeatureValuesRule.h", - "CSSFontPaletteValuesRule.h", "CSSImportRule.h", "CSSKeyframeRule.h", "CSSKeyframesRule.h", @@ -174,7 +173,6 @@ UNIFIED_SOURCES += [ "CSSCounterStyleRule.cpp", "CSSFontFaceRule.cpp", "CSSFontFeatureValuesRule.cpp", - "CSSFontPaletteValuesRule.cpp", "CSSImportRule.cpp", "CSSKeyframeRule.cpp", "CSSKeyframesRule.cpp", diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 3f640d5d3b5e..2eed6aa41ba6 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -208,7 +208,6 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc) mFontSizeFactor(aSrc.mFontSizeFactor), mFontSizeOffset(aSrc.mFontSizeOffset), mFontSizeKeyword(aSrc.mFontSizeKeyword), - mFontPalette(aSrc.mFontPalette), mMathDepth(aSrc.mMathDepth), mMathVariant(aSrc.mMathVariant), mMathStyle(aSrc.mMathStyle), @@ -229,7 +228,6 @@ nsStyleFont::nsStyleFont(const Document& aDocument) mFontSizeFactor(1.0), mFontSizeOffset{0}, mFontSizeKeyword(StyleFontSizeKeyword::Medium), - mFontPalette(StyleFontPalette::Normal()), mMathDepth(0), mMathVariant(StyleMathVariant::None), mMathStyle(NS_STYLE_MATH_STYLE_NORMAL), @@ -276,10 +274,6 @@ nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aNewData) const { break; } - if (mFontPalette != aNewData.mFontPalette) { - return NS_STYLE_HINT_VISUAL; - } - // XXX Should any of these cause a non-nsChangeHint_NeutralChange change? if (mMathDepth != aNewData.mMathDepth || mScriptUnconstrainedSize != aNewData.mScriptUnconstrainedSize || diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 9324c027f21b..95d95942bcd0 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -118,8 +118,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont { static mozilla::Length ZoomText(const mozilla::dom::Document&, mozilla::Length); - nsAtom* GetFontPaletteAtom() const { return mFontPalette._0.AsAtom(); } - nsFont mFont; // Our "computed size". Can be different from mFont.size which is our "actual @@ -133,7 +131,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont { float mFontSizeFactor; mozilla::Length mFontSizeOffset; mozilla::StyleFontSizeKeyword mFontSizeKeyword; - mozilla::StyleFontPalette mFontPalette; // math-depth support (used for MathML scriptlevel) int8_t mMathDepth; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index ef2209124afa..3cab53d84f8e 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -5690,18 +5690,6 @@ var gCSSProperties = { other_values: ["'ENG'", "'TRK'", '"TRK"', "'N\\'Ko'"], invalid_values: ["TRK", "ja"], }, - "font-palette": { - domProp: "fontPalette", - inherited: true, - type: CSS_TYPE_LONGHAND, - applies_to_first_letter: true, - applies_to_first_line: true, - applies_to_marker: true, - applies_to_placeholder: true, - initial_values: ["normal"], - other_values: ["light", "dark", "--custom"], - invalid_values: ["custom"], - }, "font-size": { domProp: "fontSize", inherited: true, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index c3ff3dd71420..a926acedec51 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -8038,13 +8038,6 @@ mirror: always rust: true -# Is support for the @font-palette-values rule and font-palette property enabled? -- name: layout.css.font-palette.enabled - type: RelaxedAtomicBool - value: @IS_NIGHTLY_BUILD@ - mirror: always - rust: true - # Is support for variation fonts enabled? - name: layout.css.font-variations.enabled type: RelaxedAtomicBool diff --git a/servo/components/style/error_reporting.rs b/servo/components/style/error_reporting.rs index 042838f33946..752f68b5bdc6 100644 --- a/servo/components/style/error_reporting.rs +++ b/servo/components/style/error_reporting.rs @@ -26,8 +26,6 @@ pub enum ContextualParseError<'a> { UnsupportedFontFaceDescriptor(&'a str, ParseError<'a>), /// A font feature values descriptor was not recognized. UnsupportedFontFeatureValuesDescriptor(&'a str, ParseError<'a>), - /// A font palette values descriptor was not recognized. - UnsupportedFontPaletteValuesDescriptor(&'a str, ParseError<'a>), /// A keyframe rule was not valid. InvalidKeyframeRule(&'a str, ParseError<'a>), /// A font feature values rule was not valid. @@ -151,14 +149,6 @@ impl<'a> fmt::Display for ContextualParseError<'a> { )?; parse_error_to_str(err, f) }, - ContextualParseError::UnsupportedFontPaletteValuesDescriptor(decl, ref err) => { - write!( - f, - "Unsupported @font-palette-values descriptor declaration: '{}', ", - decl - )?; - parse_error_to_str(err, f) - }, ContextualParseError::InvalidKeyframeRule(rule, ref err) => { write!(f, "Invalid keyframe rule: '{}', ", rule)?; parse_error_to_str(err, f) diff --git a/servo/components/style/gecko/arc_types.rs b/servo/components/style/gecko/arc_types.rs index fc7124225361..bb1d88d8a559 100644 --- a/servo/components/style/gecko/arc_types.rs +++ b/servo/components/style/gecko/arc_types.rs @@ -12,10 +12,10 @@ use crate::gecko::url::CssUrlData; use crate::gecko_bindings::structs::{ RawServoAnimationValue, RawServoContainerRule, RawServoCounterStyleRule, RawServoCssUrlData, RawServoDeclarationBlock, RawServoFontFaceRule, RawServoFontFeatureValuesRule, - RawServoFontPaletteValuesRule, RawServoImportRule, RawServoKeyframe, RawServoKeyframesRule, - RawServoLayerBlockRule, RawServoLayerStatementRule, RawServoMediaList, RawServoMediaRule, - RawServoMozDocumentRule, RawServoNamespaceRule, RawServoPageRule, RawServoStyleRule, - RawServoStyleSheetContents, RawServoSupportsRule, ServoCssRules, + RawServoImportRule, RawServoKeyframe, RawServoKeyframesRule, RawServoLayerBlockRule, + RawServoLayerStatementRule, RawServoMediaList, RawServoMediaRule, RawServoMozDocumentRule, + RawServoNamespaceRule, RawServoPageRule, RawServoStyleRule, RawServoStyleSheetContents, + RawServoSupportsRule, ServoCssRules, }; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong}; use crate::media_queries::MediaList; @@ -25,8 +25,8 @@ use crate::shared_lock::Locked; use crate::stylesheets::keyframes_rule::Keyframe; use crate::stylesheets::{ ContainerRule, CounterStyleRule, CssRules, DocumentRule, FontFaceRule, FontFeatureValuesRule, - FontPaletteValuesRule, ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule, - MediaRule, NamespaceRule, PageRule, StyleRule, StylesheetContents, SupportsRule, + ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule, MediaRule, NamespaceRule, + PageRule, StyleRule, StylesheetContents, SupportsRule, }; use servo_arc::{Arc, ArcBorrow}; use std::{mem, ptr}; @@ -104,9 +104,6 @@ impl_arc_ffi!(Locked => RawServoMozDocumentRule impl_arc_ffi!(Locked => RawServoFontFeatureValuesRule [Servo_FontFeatureValuesRule_AddRef, Servo_FontFeatureValuesRule_Release]); -impl_arc_ffi!(Locked => RawServoFontPaletteValuesRule - [Servo_FontPaletteValuesRule_AddRef, Servo_FontPaletteValuesRule_Release]); - impl_arc_ffi!(Locked => RawServoFontFaceRule [Servo_FontFaceRule_AddRef, Servo_FontFaceRule_Release]); diff --git a/servo/components/style/invalidation/stylesheets.rs b/servo/components/style/invalidation/stylesheets.rs index f18fe7942c5e..b367e18daa92 100644 --- a/servo/components/style/invalidation/stylesheets.rs +++ b/servo/components/style/invalidation/stylesheets.rs @@ -552,7 +552,6 @@ impl StylesheetInvalidationSet { Page(..) | Viewport(..) | FontFeatureValues(..) | - FontPaletteValues(..) | LayerStatement(..) | FontFace(..) | Keyframes(..) | @@ -633,8 +632,7 @@ impl StylesheetInvalidationSet { // existing elements. } }, - CounterStyle(..) | Page(..) | Viewport(..) | FontFeatureValues(..) | - FontPaletteValues(..) => { + CounterStyle(..) | Page(..) | Viewport(..) | FontFeatureValues(..) => { debug!( " > Found unsupported rule, marking the whole subtree \ invalid." diff --git a/servo/components/style/properties/longhands/font.mako.rs b/servo/components/style/properties/longhands/font.mako.rs index e4d073a005d5..6be921159714 100644 --- a/servo/components/style/properties/longhands/font.mako.rs +++ b/servo/components/style/properties/longhands/font.mako.rs @@ -206,18 +206,6 @@ ${helpers.single_keyword_system( spec="https://www.w3.org/TR/css-fonts-4/#font-optical-sizing-def", )} -${helpers.predefined_type( - "font-palette", - "FontPalette", - engines="gecko", - initial_value="computed::FontPalette::normal()", - initial_specified_value="specified::FontPalette::normal()", - animation_value_type="discrete", - gecko_pref="layout.css.font-palette.enabled", - has_effect_on_gecko_scrollbars=False, - spec="https://drafts.csswg.org/css-fonts/#font-palette-prop", -)} - ${helpers.predefined_type( "-x-lang", "XLang", diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index b03a0ef81687..02fa4f4c6830 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -2604,7 +2604,7 @@ pub struct SourcePropertyDeclaration { // This is huge, but we allocate it on the stack and then never move it, // we only pass `&mut SourcePropertyDeclaration` references around. -size_of_test!(SourcePropertyDeclaration, 632); +size_of_test!(SourcePropertyDeclaration, 600); impl SourcePropertyDeclaration { /// Create one. It’s big, try not to move it around. diff --git a/servo/components/style/properties/shorthands/font.mako.rs b/servo/components/style/properties/shorthands/font.mako.rs index a0c9ad2c2241..59d698a3ffba 100644 --- a/servo/components/style/properties/shorthands/font.mako.rs +++ b/servo/components/style/properties/shorthands/font.mako.rs @@ -27,7 +27,6 @@ ${'font-language-override' if engine == 'gecko' else ''} ${'font-feature-settings' if engine == 'gecko' else ''} ${'font-variation-settings' if engine == 'gecko' else ''} - ${'font-palette' if engine == 'gecko' else ''} " derive_value_info="False" spec="https://drafts.csswg.org/css-fonts-3/#propdef-font" @@ -38,7 +37,7 @@ use crate::properties::longhands::font_variant_caps; use crate::values::specified::text::LineHeight; use crate::values::specified::FontSize; - use crate::values::specified::font::{FontPalette, FontStretch, FontStretchKeyword}; + use crate::values::specified::font::{FontStretch, FontStretchKeyword}; #[cfg(feature = "gecko")] use crate::values::specified::font::SystemFont; @@ -47,8 +46,7 @@ variant_alternates variant_east_asian \ variant_ligatures variant_numeric \ variant_position feature_settings \ - variation_settings optical_sizing \ - palette".split() + variation_settings optical_sizing".split() %> % if engine == "gecko": % for prop in gecko_sub_properties: @@ -77,9 +75,8 @@ ${name}: ${name}::SpecifiedValue::system_font(sys), % endif % endfor - // line-height and palette are just reset to initial + // line-height is just reset to initial line_height: LineHeight::normal(), - font_palette: FontPalette::normal(), }) } % endif @@ -189,14 +186,9 @@ return Ok(()); } } - if let Some(v) = self.font_palette { - if v != &font_palette::get_initial_specified_value() { - return Ok(()); - } - } % for name in gecko_sub_properties: - % if name != "optical_sizing" and name != "variation_settings" and name != "palette": + % if name != "optical_sizing" and name != "variation_settings": if self.font_${name} != &font_${name}::get_initial_specified_value() { return Ok(()); } @@ -259,7 +251,7 @@ let mut all = true; % for prop in SYSTEM_FONT_LONGHANDS: - % if prop == "font_optical_sizing" or prop == "font_variation_settings" or prop == "font_palette": + % if prop == "font_optical_sizing" or prop == "font_variation_settings": if let Some(value) = self.${prop} { % else: { diff --git a/servo/components/style/stylesheets/font_feature_values_rule.rs b/servo/components/style/stylesheets/font_feature_values_rule.rs index 784628f0dde5..dc128e77fb00 100644 --- a/servo/components/style/stylesheets/font_feature_values_rule.rs +++ b/servo/components/style/stylesheets/font_feature_values_rule.rs @@ -275,6 +275,23 @@ macro_rules! font_feature_values_blocks { rule } + /// Prints font family names. + pub fn font_family_to_css( + &self, + dest: &mut CssWriter, + ) -> fmt::Result + where + W: Write, + { + let mut iter = self.family_names.iter(); + iter.next().unwrap().to_css(dest)?; + for val in iter { + dest.write_str(", ")?; + val.to_css(dest)?; + } + Ok(()) + } + /// Prints inside of `@font-feature-values` block. pub fn value_to_css(&self, dest: &mut CssWriter) -> fmt::Result where @@ -332,7 +349,7 @@ macro_rules! font_feature_values_blocks { impl ToCssWithGuard for FontFeatureValuesRule { fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result { dest.write_str("@font-feature-values ")?; - self.family_names.to_css(&mut CssWriter::new(dest))?; + self.font_family_to_css(&mut CssWriter::new(dest))?; dest.write_str(" {\n")?; self.value_to_css(&mut CssWriter::new(dest))?; dest.write_str("}") diff --git a/servo/components/style/stylesheets/font_palette_values_rule.rs b/servo/components/style/stylesheets/font_palette_values_rule.rs deleted file mode 100644 index a5422ce72500..000000000000 --- a/servo/components/style/stylesheets/font_palette_values_rule.rs +++ /dev/null @@ -1,252 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -//! The [`@font-palette-values`][font-palette-values] at-rule. -//! -//! [font-palette-values]: https://drafts.csswg.org/css-fonts/#font-palette-values - -use crate::error_reporting::ContextualParseError; -use crate::parser::{Parse, ParserContext}; -use crate::gecko_bindings::bindings::Gecko_AppendPaletteValueHashEntry; -use crate::gecko_bindings::bindings::{Gecko_SetFontPaletteBase, Gecko_SetFontPaletteOverride}; -use crate::gecko_bindings::structs::gfx::FontPaletteValueSet; -use crate::gecko_bindings::structs::gfx::FontPaletteValueSet_PaletteValues_kLight; -use crate::gecko_bindings::structs::gfx::FontPaletteValueSet_PaletteValues_kDark; -use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard}; -use crate::str::CssStringWriter; -use crate::values::computed::font::FamilyName; -use crate::values::specified::Color as SpecifiedColor; -use crate::values::specified::NonNegativeInteger; -use crate::values::DashedIdent; -use cssparser::{AtRuleParser, CowRcStr}; -use cssparser::{DeclarationParser, DeclarationListParser, Parser}; -use cssparser::{QualifiedRuleParser, SourceLocation}; -use std::fmt::{self, Write}; -use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -use style_traits::{Comma, OneOrMoreSeparated}; -use selectors::parser::SelectorParseErrorKind; -use crate::stylesheets::font_feature_values_rule::parse_family_name_list; - -#[allow(missing_docs)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] -pub struct FontPaletteOverrideColor { - index: NonNegativeInteger, - color: SpecifiedColor, -} - -impl Parse for FontPaletteOverrideColor { - fn parse<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let index = NonNegativeInteger::parse(context, input)?; - let location = input.current_source_location(); - let color = SpecifiedColor::parse(context, input)?; - // Only absolute colors are accepted here. - if let SpecifiedColor::Numeric { parsed: _, authored: _ } = color { - Ok(FontPaletteOverrideColor{ index, color }) - } else { - Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)) - } - } -} - -impl ToCss for FontPaletteOverrideColor { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: fmt::Write, - { - self.index.to_css(dest)?; - dest.write_str(" ")?; - self.color.to_css(dest) - } -} - -impl OneOrMoreSeparated for FontPaletteOverrideColor { - type S = Comma; -} - -impl OneOrMoreSeparated for FamilyName { - type S = Comma; -} - -#[allow(missing_docs)] -#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] -pub enum FontPaletteBase { - Light, - Dark, - Index(NonNegativeInteger), -} - -/// The [`@font-palette-values`][font-palette-values] at-rule. -/// -/// [font-palette-values]: https://drafts.csswg.org/css-fonts/#font-palette-values -#[derive(Clone, Debug, PartialEq, ToShmem)] -pub struct FontPaletteValuesRule { - /// Palette name. - pub name: DashedIdent, - /// Font family list for @font-palette-values rule. - /// Family names cannot contain generic families. FamilyName - /// also accepts only non-generic names. - pub family_names: Vec, - /// The base palette. - pub base_palette: Option, - /// The list of override colors. - pub override_colors: Vec, - /// The line and column of the rule's source code. - pub source_location: SourceLocation, -} - -impl FontPaletteValuesRule { - /// Creates an empty FontPaletteValuesRule with given location and name. - fn new(name: DashedIdent, location: SourceLocation) -> Self { - FontPaletteValuesRule { - name, - family_names: vec![], - base_palette: None, - override_colors: vec![], - source_location: location, - } - } - - /// Parses a `FontPaletteValuesRule`. - pub fn parse( - context: &ParserContext, - input: &mut Parser, - name: DashedIdent, - location: SourceLocation, - ) -> Self { - let mut rule = FontPaletteValuesRule::new(name, location); - { - let parser = FontPaletteValuesDeclarationParser { - context: context, - rule: &mut rule, - }; - let mut iter = DeclarationListParser::new(input, parser); - while let Some(declaration) = iter.next() { - if let Err((error, slice)) = declaration { - let location = error.location; - let error = ContextualParseError::UnsupportedFontPaletteValuesDescriptor(slice, error); - context.log_css_error(location, error); - } - } - } - rule - } - - /// Prints inside of `@font-palette-values` block. - fn value_to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - if !self.family_names.is_empty() { - dest.write_str("font-family: ")?; - self.family_names.to_css(dest)?; - dest.write_str("; ")?; - } - if let Some(base) = &self.base_palette { - dest.write_str("base-palette: ")?; - base.to_css(dest)?; - dest.write_str("; ")?; - } - if !self.override_colors.is_empty() { - dest.write_str("override-colors: ")?; - self.override_colors.to_css(dest)?; - dest.write_str("; ")?; - } - Ok(()) - } - - /// Convert to Gecko FontPaletteValueSet. - pub fn to_gecko_palette_value_set(&self, dest: *mut FontPaletteValueSet) { - for ref family in self.family_names.iter() { - let family = family.name.to_ascii_lowercase(); - let palette_values = unsafe { - Gecko_AppendPaletteValueHashEntry( - dest, - family.as_ptr(), - self.name.0.as_ptr() - ) - }; - if let Some(base_palette) = &self.base_palette { - unsafe { - Gecko_SetFontPaletteBase(palette_values, match &base_palette { - FontPaletteBase::Light => FontPaletteValueSet_PaletteValues_kLight, - FontPaletteBase::Dark => FontPaletteValueSet_PaletteValues_kDark, - FontPaletteBase::Index(i) => i.0.value() as i32, - }); - } - } - for c in &self.override_colors { - if let SpecifiedColor::Numeric { parsed, authored: _ } = &c.color { - unsafe { - Gecko_SetFontPaletteOverride(palette_values, - c.index.0.value(), - *parsed); - } - } - } - } - } -} - -impl ToCssWithGuard for FontPaletteValuesRule { - fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result { - dest.write_str("@font-palette-values ")?; - self.name.to_css(&mut CssWriter::new(dest))?; - dest.write_str(" { ")?; - self.value_to_css(&mut CssWriter::new(dest))?; - dest.write_str("}") - } -} - -/// Parser for declarations in `FontPaletteValuesRule`. -struct FontPaletteValuesDeclarationParser<'a> { - context: &'a ParserContext<'a>, - rule: &'a mut FontPaletteValuesRule, -} - -impl<'a, 'i> AtRuleParser<'i> for FontPaletteValuesDeclarationParser<'a> { - type Prelude = (); - type AtRule = (); - type Error = StyleParseErrorKind<'i>; -} - -impl<'a, 'i> QualifiedRuleParser<'i> for FontPaletteValuesDeclarationParser<'a> { - type Prelude = (); - type QualifiedRule = (); - type Error = StyleParseErrorKind<'i>; -} - -fn parse_override_colors<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, -) -> Result, ParseError<'i>> { - input.parse_comma_separated(|i| FontPaletteOverrideColor::parse(context, i)) -} - -impl<'a, 'b, 'i> DeclarationParser<'i> for FontPaletteValuesDeclarationParser<'a> { - type Declaration = (); - type Error = StyleParseErrorKind<'i>; - - fn parse_value<'t>( - &mut self, - name: CowRcStr<'i>, - input: &mut Parser<'i, 't>, - ) -> Result<(), ParseError<'i>> { - match_ignore_ascii_case! { &*name, - "font-family" => { - self.rule.family_names = parse_family_name_list(self.context, input)? - }, - "base-palette" => { - self.rule.base_palette = Some(input.parse_entirely(|i| FontPaletteBase::parse(self.context, i))?) - }, - "override-colors" => { - self.rule.override_colors = parse_override_colors(self.context, input)? - }, - _ => return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone()))), - } - Ok(()) - } -} diff --git a/servo/components/style/stylesheets/mod.rs b/servo/components/style/stylesheets/mod.rs index 01b0c07d7a9a..9625ad62cb35 100644 --- a/servo/components/style/stylesheets/mod.rs +++ b/servo/components/style/stylesheets/mod.rs @@ -10,7 +10,6 @@ mod counter_style_rule; mod document_rule; mod font_face_rule; pub mod font_feature_values_rule; -pub mod font_palette_values_rule; pub mod import_rule; pub mod keyframes_rule; pub mod layer_rule; @@ -51,7 +50,6 @@ pub use self::counter_style_rule::CounterStyleRule; pub use self::document_rule::DocumentRule; pub use self::font_face_rule::FontFaceRule; pub use self::font_feature_values_rule::FontFeatureValuesRule; -pub use self::font_palette_values_rule::FontPaletteValuesRule; pub use self::import_rule::ImportRule; pub use self::keyframes_rule::KeyframesRule; pub use self::layer_rule::{LayerBlockRule, LayerStatementRule}; @@ -258,7 +256,6 @@ pub enum CssRule { Container(Arc>), FontFace(Arc>), FontFeatureValues(Arc>), - FontPaletteValues(Arc>), CounterStyle(Arc>), Viewport(Arc>), Keyframes(Arc>), @@ -296,7 +293,6 @@ impl CssRule { CssRule::FontFace(_) => 0, CssRule::FontFeatureValues(_) => 0, - CssRule::FontPaletteValues(_) => 0, CssRule::CounterStyle(_) => 0, CssRule::Viewport(_) => 0, CssRule::Keyframes(_) => 0, @@ -352,7 +348,6 @@ pub enum CssRuleType { LayerBlock = 16, LayerStatement = 17, Container = 18, - FontPaletteValues = 19, } #[allow(missing_docs)] @@ -372,7 +367,6 @@ impl CssRule { CssRule::Media(_) => CssRuleType::Media, CssRule::FontFace(_) => CssRuleType::FontFace, CssRule::FontFeatureValues(_) => CssRuleType::FontFeatureValues, - CssRule::FontPaletteValues(_) => CssRuleType::FontPaletteValues, CssRule::CounterStyle(_) => CssRuleType::CounterStyle, CssRule::Keyframes(_) => CssRuleType::Keyframes, CssRule::Namespace(_) => CssRuleType::Namespace, @@ -480,10 +474,6 @@ impl DeepCloneWithLock for CssRule { let rule = arc.read_with(guard); CssRule::FontFeatureValues(Arc::new(lock.wrap(rule.clone()))) }, - CssRule::FontPaletteValues(ref arc) => { - let rule = arc.read_with(guard); - CssRule::FontPaletteValues(Arc::new(lock.wrap(rule.clone()))) - }, CssRule::CounterStyle(ref arc) => { let rule = arc.read_with(guard); CssRule::CounterStyle(Arc::new(lock.wrap(rule.clone()))) @@ -541,7 +531,6 @@ impl ToCssWithGuard for CssRule { CssRule::Style(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::FontFace(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::FontFeatureValues(ref lock) => lock.read_with(guard).to_css(guard, dest), - CssRule::FontPaletteValues(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::CounterStyle(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Viewport(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Keyframes(ref lock) => lock.read_with(guard).to_css(guard, dest), diff --git a/servo/components/style/stylesheets/rule_parser.rs b/servo/components/style/stylesheets/rule_parser.rs index b86e31aead9c..93929a26aab3 100644 --- a/servo/components/style/stylesheets/rule_parser.rs +++ b/servo/components/style/stylesheets/rule_parser.rs @@ -23,12 +23,11 @@ use crate::stylesheets::stylesheet::Namespaces; use crate::stylesheets::supports_rule::SupportsCondition; use crate::stylesheets::{ viewport_rule, AllowImportRules, CorsMode, CssRule, CssRuleType, CssRules, DocumentRule, - FontFeatureValuesRule, FontPaletteValuesRule, KeyframesRule, MediaRule, NamespaceRule, - PageRule, PageSelectors, RulesMutateError, StyleRule, StylesheetLoader, SupportsRule, - ViewportRule, + FontFeatureValuesRule, KeyframesRule, MediaRule, NamespaceRule, PageRule, PageSelectors, + RulesMutateError, StyleRule, StylesheetLoader, SupportsRule, ViewportRule, }; use crate::values::computed::font::FamilyName; -use crate::values::{CssUrl, CustomIdent, DashedIdent, KeyframesName}; +use crate::values::{CssUrl, CustomIdent, KeyframesName}; use crate::{Namespace, Prefix}; use cssparser::{ AtRuleParser, BasicParseError, BasicParseErrorKind, CowRcStr, Parser, ParserState, @@ -185,8 +184,6 @@ pub enum AtRulePrelude { FontFace, /// A @font-feature-values rule prelude, with its FamilyName list. FontFeatureValues(Vec), - /// A @font-palette-values rule prelude, with its identifier. - FontPaletteValues(DashedIdent), /// A @counter-style rule prelude, with its counter style name. CounterStyle(CustomIdent), /// A @media rule prelude, with its media queries. @@ -488,10 +485,6 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { let family_names = parse_family_name_list(self.context, input)?; AtRulePrelude::FontFeatureValues(family_names) }, - "font-palette-values" if static_prefs::pref!("layout.css.font-palette.enabled") => { - let name = DashedIdent::parse(self.context, input)?; - AtRulePrelude::FontPaletteValues(name) - }, "counter-style" if cfg!(feature = "gecko") => { let name = parse_counter_style_name_definition(input)?; AtRulePrelude::CounterStyle(name) @@ -564,22 +557,6 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ), )))) }, - AtRulePrelude::FontPaletteValues(name) => { - let context = ParserContext::new_with_rule_type( - self.context, - CssRuleType::FontPaletteValues, - self.namespaces, - ); - - Ok(CssRule::FontPaletteValues(Arc::new(self.shared_lock.wrap( - FontPaletteValuesRule::parse( - &context, - input, - name, - start.source_location(), - ), - )))) - }, AtRulePrelude::CounterStyle(name) => { let context = ParserContext::new_with_rule_type( self.context, diff --git a/servo/components/style/stylesheets/rules_iterator.rs b/servo/components/style/stylesheets/rules_iterator.rs index 00c095bb8b85..5c90e506714c 100644 --- a/servo/components/style/stylesheets/rules_iterator.rs +++ b/servo/components/style/stylesheets/rules_iterator.rs @@ -70,8 +70,7 @@ where CssRule::Keyframes(_) | CssRule::Page(_) | CssRule::LayerStatement(_) | - CssRule::FontFeatureValues(_) | - CssRule::FontPaletteValues(_) => None, + CssRule::FontFeatureValues(_) => None, CssRule::Import(ref import_rule) => { let import_rule = import_rule.read_with(guard); if !C::process_import(guard, device, quirks_mode, import_rule) { diff --git a/servo/components/style/stylesheets/stylesheet.rs b/servo/components/style/stylesheets/stylesheet.rs index fb6596497402..67797470e6fa 100644 --- a/servo/components/style/stylesheets/stylesheet.rs +++ b/servo/components/style/stylesheets/stylesheet.rs @@ -370,7 +370,6 @@ impl SanitizationKind { CssRule::Keyframes(..) | CssRule::Page(..) | CssRule::FontFeatureValues(..) | - CssRule::FontPaletteValues(..) | CssRule::Viewport(..) | CssRule::CounterStyle(..) => !is_standard, } diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs index cbd92bd930be..ef6ab7acb581 100644 --- a/servo/components/style/stylist.rs +++ b/servo/components/style/stylist.rs @@ -32,9 +32,7 @@ use crate::stylesheets::keyframes_rule::KeyframesAnimation; use crate::stylesheets::layer_rule::{LayerName, LayerOrder}; use crate::stylesheets::viewport_rule::{self, MaybeNew, ViewportRule}; #[cfg(feature = "gecko")] -use crate::stylesheets::{ - CounterStyleRule, FontFaceRule, FontFeatureValuesRule, FontPaletteValuesRule, PageRule, -}; +use crate::stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule}; use crate::stylesheets::{ CssRule, EffectiveRulesIterator, Origin, OriginSet, PerOrigin, PerOriginIter, }; @@ -1676,10 +1674,6 @@ pub struct ExtraStyleData { #[cfg(feature = "gecko")] pub font_feature_values: LayerOrderedVec>>, - /// A list of effective font-palette-values rules. - #[cfg(feature = "gecko")] - pub font_palette_values: LayerOrderedVec>>, - /// A map of effective counter-style rules. #[cfg(feature = "gecko")] pub counter_styles: LayerOrderedMap>>, @@ -1705,15 +1699,6 @@ impl ExtraStyleData { self.font_feature_values.push(rule.clone(), layer); } - /// Add the given @font-palette-values rule. - fn add_font_palette_values( - &mut self, - rule: &Arc>, - layer: LayerId, - ) { - self.font_palette_values.push(rule.clone(), layer); - } - /// Add the given @counter-style rule. fn add_counter_style( &mut self, @@ -1755,7 +1740,6 @@ impl ExtraStyleData { fn sort_by_layer(&mut self, layers: &[CascadeLayer]) { self.font_faces.sort(layers); self.font_feature_values.sort(layers); - self.font_palette_values.sort(layers); self.counter_styles.sort(layers); self.pages.global.sort(layers); } @@ -1765,7 +1749,6 @@ impl ExtraStyleData { { self.font_faces.clear(); self.font_feature_values.clear(); - self.font_palette_values.clear(); self.counter_styles.clear(); self.pages.clear(); } @@ -1802,7 +1785,6 @@ impl MallocSizeOf for ExtraStyleData { let mut n = 0; n += self.font_faces.shallow_size_of(ops); n += self.font_feature_values.shallow_size_of(ops); - n += self.font_palette_values.shallow_size_of(ops); n += self.counter_styles.shallow_size_of(ops); n += self.pages.shallow_size_of(ops); n @@ -2648,11 +2630,6 @@ impl CascadeData { .add_font_feature_values(rule, containing_rule_state.layer_id); }, #[cfg(feature = "gecko")] - CssRule::FontPaletteValues(ref rule) => { - self.extra_data - .add_font_palette_values(rule, containing_rule_state.layer_id); - }, - #[cfg(feature = "gecko")] CssRule::CounterStyle(ref rule) => { self.extra_data.add_counter_style( guard, @@ -2903,7 +2880,6 @@ impl CascadeData { CssRule::Document(..) | CssRule::LayerBlock(..) | CssRule::LayerStatement(..) | - CssRule::FontPaletteValues(..) | CssRule::FontFeatureValues(..) => { // Not affected by device changes. continue; diff --git a/servo/components/style/values/computed/font.rs b/servo/components/style/values/computed/font.rs index cbac1d391633..9a0c8dcb2237 100644 --- a/servo/components/style/values/computed/font.rs +++ b/servo/components/style/values/computed/font.rs @@ -24,7 +24,6 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, ToCss}; pub use crate::values::computed::Length as MozScriptMinSize; -pub use crate::values::specified::font::FontPalette; pub use crate::values::specified::font::{FontSynthesis, MozScriptSizeMultiplier}; pub use crate::values::specified::font::{XLang, XTextZoom}; pub use crate::values::specified::Integer as SpecifiedInteger; diff --git a/servo/components/style/values/computed/mod.rs b/servo/components/style/values/computed/mod.rs index 7a5d2a358386..729f535b79fd 100644 --- a/servo/components/style/values/computed/mod.rs +++ b/servo/components/style/values/computed/mod.rs @@ -63,7 +63,7 @@ pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset, C pub use self::easing::TimingFunction; pub use self::effects::{BoxShadow, Filter, SimpleShadow}; pub use self::flex::FlexBasis; -pub use self::font::{FontFamily, FontLanguageOverride, FontStyle, FontPalette}; +pub use self::font::{FontFamily, FontLanguageOverride, FontStyle}; pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis}; pub use self::font::{FontVariantAlternates, FontWeight}; diff --git a/servo/components/style/values/mod.rs b/servo/components/style/values/mod.rs index 3dd31a75876f..3a9892058471 100644 --- a/servo/components/style/values/mod.rs +++ b/servo/components/style/values/mod.rs @@ -482,44 +482,6 @@ impl ToCss for CustomIdent { } } -/// -/// This is simply an Atom, but will only parse if the identifier starts with "--". -#[repr(transparent)] -#[derive( - Clone, - Debug, - Eq, - Hash, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToResolvedValue, - ToShmem, -)] -pub struct DashedIdent(pub Atom); - -impl Parse for DashedIdent { - fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { - let location = input.current_source_location(); - let ident = input.expect_ident()?; - if ident.starts_with("--") { - Ok(Self(Atom::from(ident.as_ref()))) - } else { - Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))) - } - } -} - -impl ToCss for DashedIdent { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - serialize_atom_identifier(&self.0, dest) - } -} - /// The or . /// The definition of these two names are the same, so we use the same type for them. /// diff --git a/servo/components/style/values/specified/font.rs b/servo/components/style/values/specified/font.rs index 07c70808cd25..6ad2b0f6234f 100644 --- a/servo/components/style/values/specified/font.rs +++ b/servo/components/style/values/specified/font.rs @@ -19,7 +19,7 @@ use crate::values::generics::NonNegative; use crate::values::specified::length::{FontBaseSize, PX_PER_PT}; use crate::values::specified::{AllowQuirks, Angle, Integer, LengthPercentage}; use crate::values::specified::{NoCalcLength, NonNegativeNumber, NonNegativePercentage, Number}; -use crate::values::{CustomIdent, SelectorParseErrorKind, serialize_atom_identifier}; +use crate::values::CustomIdent; use crate::Atom; use cssparser::{Parser, Token}; #[cfg(feature = "gecko")] @@ -715,7 +715,7 @@ impl Parse for FontSizeAdjust { "ic-height" if basis_enabled => GenericFontSizeAdjust::IcHeight, // Unknown (or disabled) keyword. _ => return Err(location.new_custom_error( - SelectorParseErrorKind::UnexpectedIdent(ident) + ::selectors::parser::SelectorParseErrorKind::UnexpectedIdent(ident) )), }; let value = NonNegativeNumber::parse(context, input)?; @@ -1955,6 +1955,7 @@ impl Parse for FontSynthesis { _: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { + use crate::values::SelectorParseErrorKind; let mut result = Self::none(); while let Ok(ident) = input.try_parse(|i| i.expect_ident_cloned()) { match_ignore_ascii_case! { &ident, @@ -2126,59 +2127,6 @@ impl Parse for FontLanguageOverride { } } -#[derive( - Clone, - Debug, - Eq, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToResolvedValue, - ToShmem, -)] -#[repr(C)] -/// Allows authors to choose a palette from those supported by a color font -/// (and potentially @font-palette-values overrides). -pub struct FontPalette(Atom); - -#[allow(missing_docs)] -impl FontPalette { - pub fn normal() -> Self { Self(atom!("normal")) } - pub fn light() -> Self { Self(atom!("light")) } - pub fn dark() -> Self { Self(atom!("dark")) } -} - -impl Parse for FontPalette { - /// normal | light | dark | dashed-ident - fn parse<'i, 't>( - _context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - let location = input.current_source_location(); - let ident = input.expect_ident()?; - match_ignore_ascii_case! { &ident, - "normal" => Ok(Self::normal()), - "light" => Ok(Self::light()), - "dark" => Ok(Self::dark()), - _ => if ident.starts_with("--") { - Ok(Self(Atom::from(ident.as_ref()))) - } else { - Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))) - }, - } - } -} - -impl ToCss for FontPalette { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - serialize_atom_identifier(&self.0, dest) - } -} - /// This property provides low-level control over OpenType or TrueType font /// variations. pub type SpecifiedFontVariationSettings = FontSettings>; diff --git a/servo/components/style/values/specified/mod.rs b/servo/components/style/values/specified/mod.rs index 7fa2c57549a1..b31bc17300e5 100644 --- a/servo/components/style/values/specified/mod.rs +++ b/servo/components/style/values/specified/mod.rs @@ -51,7 +51,7 @@ pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset, C pub use self::easing::TimingFunction; pub use self::effects::{BoxShadow, Filter, SimpleShadow}; pub use self::flex::FlexBasis; -pub use self::font::{FontFamily, FontLanguageOverride, FontStyle, FontPalette}; +pub use self::font::{FontFamily, FontLanguageOverride, FontStyle}; pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric}; pub use self::font::{FontSize, FontSizeAdjust, FontSizeKeyword, FontStretch, FontSynthesis}; pub use self::font::{FontVariantAlternates, FontWeight}; @@ -411,18 +411,6 @@ impl NonNegativeNumber { } } -/// An Integer which is >= 0. -pub type NonNegativeInteger = NonNegative; - -impl Parse for NonNegativeInteger { - fn parse<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - Ok(NonNegative(Integer::parse_non_negative(context, input)?)) - } -} - /// A Number which is >= 1.0. pub type GreaterThanOrEqualToOneNumber = GreaterThanOrEqualToOne; diff --git a/servo/ports/geckolib/cbindgen.toml b/servo/ports/geckolib/cbindgen.toml index 315a4b73a94b..194bca2c0759 100644 --- a/servo/ports/geckolib/cbindgen.toml +++ b/servo/ports/geckolib/cbindgen.toml @@ -83,7 +83,6 @@ include = [ "OutlineStyle", "CaptionSide", "FontSizeAdjust", - "FontPalette", "ComputedFontStretchRange", "ComputedFontStyleDescriptor", "ComputedFontWeightRange", @@ -309,8 +308,6 @@ renaming_overrides_prefixing = true "ServoTraversalFlags" = "ServoTraversalFlags" "ServoStyleSetSizes" = "ServoStyleSetSizes" "BeforeFlag" = "StyleEasingBeforeFlag" -"FontPaletteValueSet" = "gfx::FontPaletteValueSet" -"PaletteValues" = "gfx::FontPaletteValueSet::PaletteValues" [export.body] "CSSPixelLength" = """ @@ -950,9 +947,3 @@ renaming_overrides_prefixing = true return StyleFontFaceSourceTechFlags{0}; } """ - -"FontPalette" = """ - inline static StyleFontPalette Normal() { - return StyleFontPalette{StyleAtom(nsGkAtoms::normal->ToAddRefed())}; - } -""" diff --git a/servo/ports/geckolib/error_reporter.rs b/servo/ports/geckolib/error_reporter.rs index 63cc27bf96ce..7d77a0f91c08 100644 --- a/servo/ports/geckolib/error_reporter.rs +++ b/servo/ports/geckolib/error_reporter.rs @@ -193,7 +193,6 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { ContextualParseError::UnsupportedPropertyDeclaration(s, err, _) | ContextualParseError::UnsupportedFontFaceDescriptor(s, err) | ContextualParseError::UnsupportedFontFeatureValuesDescriptor(s, err) | - ContextualParseError::UnsupportedFontPaletteValuesDescriptor(s, err) | ContextualParseError::InvalidKeyframeRule(s, err) | ContextualParseError::InvalidFontFeatureValuesRule(s, err) | ContextualParseError::UnsupportedKeyframePropertyDeclaration(s, err) | @@ -402,7 +401,6 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { ContextualParseError::InvalidCounterStyleExtendsWithSymbols | ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols | ContextualParseError::UnsupportedFontFeatureValuesDescriptor(..) | - ContextualParseError::UnsupportedFontPaletteValuesDescriptor(..) | ContextualParseError::InvalidFontFeatureValuesRule(..) => { (cstr!("PEUnknownAtRule"), Action::Skip) }, diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index a7c00842ca7e..e88103c43979 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -41,14 +41,12 @@ use style::gecko_bindings::bindings::nsAString; use style::gecko_bindings::bindings::Gecko_AddPropertyToSet; use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair; use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet; -use style::gecko_bindings::bindings::Gecko_ConstructFontPaletteValueSet; use style::gecko_bindings::bindings::Gecko_GetOrCreateFinalKeyframe; use style::gecko_bindings::bindings::Gecko_GetOrCreateInitialKeyframe; use style::gecko_bindings::bindings::Gecko_GetOrCreateKeyframeAtStart; use style::gecko_bindings::bindings::Gecko_HaveSeenPtr; use style::gecko_bindings::structs; use style::gecko_bindings::structs::gfxFontFeatureValueSet; -use style::gecko_bindings::structs::gfx::FontPaletteValueSet; use style::gecko_bindings::structs::ipc::ByteBuf; use style::gecko_bindings::structs::nsAtom; use style::gecko_bindings::structs::nsCSSCounterDesc; @@ -86,7 +84,6 @@ use style::gecko_bindings::structs::{nsINode as RawGeckoNode, Element as RawGeck use style::gecko_bindings::structs::{ RawServoAnimationValue, RawServoAuthorStyles, RawServoContainerRule, RawServoCounterStyleRule, RawServoDeclarationBlock, RawServoFontFaceRule, RawServoFontFeatureValuesRule, - RawServoFontPaletteValuesRule, RawServoImportRule, RawServoKeyframe, RawServoKeyframesRule, RawServoLayerBlockRule, RawServoLayerStatementRule, RawServoMediaList, RawServoMediaRule, RawServoMozDocumentRule, RawServoNamespaceRule, RawServoPageRule, RawServoSharedMemoryBuilder, RawServoStyleSet, @@ -122,9 +119,9 @@ use style::stylesheets::layer_rule::LayerOrder; use style::stylesheets::supports_rule::parse_condition_or_declaration; use style::stylesheets::{ AllowImportRules, ContainerRule, CounterStyleRule, CssRule, CssRuleType, CssRules, - CssRulesHelpers, DocumentRule, FontFaceRule, FontFeatureValuesRule, FontPaletteValuesRule, - ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule, MediaRule, NamespaceRule, - Origin, OriginSet, PageRule, SanitizationData, SanitizationKind, StyleRule, StylesheetContents, + CssRulesHelpers, DocumentRule, FontFaceRule, FontFeatureValuesRule, ImportRule, KeyframesRule, + LayerBlockRule, LayerStatementRule, MediaRule, NamespaceRule, Origin, OriginSet, PageRule, + SanitizationData, SanitizationKind, StyleRule, StylesheetContents, StylesheetLoader as StyleStylesheetLoader, SupportsRule, UrlExtraData, }; use style::stylist::{add_size_of_ua_cache, AuthorStylesEnabled, RuleInclusion, Stylist}; @@ -2369,13 +2366,6 @@ impl_basic_rule_funcs! { (FontFeatureValues, FontFeatureValuesRule, RawServoFont changed: Servo_StyleSet_FontFeatureValuesRuleChanged, } -impl_basic_rule_funcs! { (FontPaletteValues, FontPaletteValuesRule, RawServoFontPaletteValuesRule), - getter: Servo_CssRules_GetFontPaletteValuesRuleAt, - debug: Servo_FontPaletteValuesRule_Debug, - to_css: Servo_FontPaletteValuesRule_GetCssText, - changed: Servo_StyleSet_FontPaletteValuesRuleChanged, -} - impl_basic_rule_funcs! { (FontFace, FontFaceRule, RawServoFontFaceRule), getter: Servo_CssRules_GetFontFaceRuleAt, debug: Servo_FontFaceRule_Debug, @@ -2969,7 +2959,7 @@ pub extern "C" fn Servo_FontFeatureValuesRule_GetFontFamily( result: &mut nsACString, ) { read_locked_arc(rule, |rule: &FontFeatureValuesRule| { - rule.family_names.to_css(&mut CssWriter::new(result)) + rule.font_family_to_css(&mut CssWriter::new(result)) .unwrap() }) } @@ -2984,54 +2974,6 @@ pub extern "C" fn Servo_FontFeatureValuesRule_GetValueText( }) } -#[no_mangle] -pub extern "C" fn Servo_FontPaletteValuesRule_GetName( - rule: &RawServoFontPaletteValuesRule, - result: &mut nsACString, -) { - read_locked_arc(rule, |rule: &FontPaletteValuesRule| { - rule.name.to_css(&mut CssWriter::new(result)) - .unwrap() - }) -} - -#[no_mangle] -pub extern "C" fn Servo_FontPaletteValuesRule_GetFontFamily( - rule: &RawServoFontPaletteValuesRule, - result: &mut nsACString, -) { - read_locked_arc(rule, |rule: &FontPaletteValuesRule| { - if !rule.family_names.is_empty() { - rule.family_names.to_css(&mut CssWriter::new(result)) - .unwrap() - } - }) -} - -#[no_mangle] -pub extern "C" fn Servo_FontPaletteValuesRule_GetBasePalette( - rule: &RawServoFontPaletteValuesRule, - result: &mut nsACString, -) { - read_locked_arc(rule, |rule: &FontPaletteValuesRule| { - rule.base_palette.to_css(&mut CssWriter::new(result)) - .unwrap() - }) -} - -#[no_mangle] -pub extern "C" fn Servo_FontPaletteValuesRule_GetOverrideColors( - rule: &RawServoFontPaletteValuesRule, - result: &mut nsACString, -) { - read_locked_arc(rule, |rule: &FontPaletteValuesRule| { - if !rule.override_colors.is_empty() { - rule.override_colors.to_css(&mut CssWriter::new(result)) - .unwrap() - } - }) -} - #[no_mangle] pub extern "C" fn Servo_FontFaceRule_CreateEmpty() -> Strong { let global_style_data = &*GLOBAL_STYLE_DATA; @@ -6559,37 +6501,6 @@ pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet( set } -#[no_mangle] -pub extern "C" fn Servo_StyleSet_BuildFontPaletteValueSet( - raw_data: &RawServoStyleSet, -) -> *mut FontPaletteValueSet { - let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); - - let global_style_data = &*GLOBAL_STYLE_DATA; - let guard = global_style_data.shared_lock.read(); - - let has_rule = data - .stylist - .iter_extra_data_origins() - .any(|(d, _)| !d.font_palette_values.is_empty()); - - if !has_rule { - return ptr::null_mut(); - } - - let font_palette_values_iter = data - .stylist - .iter_extra_data_origins_rev() - .flat_map(|(d, _)| d.font_palette_values.iter()); - - let set = unsafe { Gecko_ConstructFontPaletteValueSet() }; - for &(ref src, _) in font_palette_values_iter { - let rule = src.read_with(&guard); - rule.to_gecko_palette_value_set(set); - } - set -} - #[no_mangle] pub extern "C" fn Servo_StyleSet_ResolveForDeclarations( raw_data: &RawServoStyleSet, diff --git a/testing/web-platform/meta/css/css-fonts/__dir__.ini b/testing/web-platform/meta/css/css-fonts/__dir__.ini index 4b476f257ecf..6e82d4a766c7 100644 --- a/testing/web-platform/meta/css/css-fonts/__dir__.ini +++ b/testing/web-platform/meta/css/css-fonts/__dir__.ini @@ -1,2 +1,2 @@ -prefs: [layout.css.font-variations.enabled:true, layout.css.system-ui.enabled:true, layout.css.font-palette.enabled:true] +prefs: [layout.css.font-variations.enabled:true, layout.css.system-ui.enabled:true] leak-threshold: [default:51200] diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-13.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-13.html.ini new file mode 100644 index 000000000000..793d755de677 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-13.html.ini @@ -0,0 +1,2 @@ +[font-palette-13.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-16.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-16.html.ini new file mode 100644 index 000000000000..df269b4893da --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-16.html.ini @@ -0,0 +1,2 @@ +[font-palette-16.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-17.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-17.html.ini new file mode 100644 index 000000000000..af7b997a612f --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-17.html.ini @@ -0,0 +1,2 @@ +[font-palette-17.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-18.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-18.html.ini new file mode 100644 index 000000000000..34ec70aada83 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-18.html.ini @@ -0,0 +1,2 @@ +[font-palette-18.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-19.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-19.html.ini new file mode 100644 index 000000000000..5510ac93644e --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-19.html.ini @@ -0,0 +1,2 @@ +[font-palette-19.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-22.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-22.html.ini new file mode 100644 index 000000000000..a9fdbaca98be --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-22.html.ini @@ -0,0 +1,2 @@ +[font-palette-22.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-3.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-3.html.ini new file mode 100644 index 000000000000..33af83932f57 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-3.html.ini @@ -0,0 +1,2 @@ +[font-palette-3.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-4.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-4.html.ini new file mode 100644 index 000000000000..4e9b37eb007e --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-4.html.ini @@ -0,0 +1,2 @@ +[font-palette-4.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-5.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-5.html.ini new file mode 100644 index 000000000000..34012d612549 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-5.html.ini @@ -0,0 +1,2 @@ +[font-palette-5.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-6.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-6.html.ini new file mode 100644 index 000000000000..3f3745ffb85a --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-6.html.ini @@ -0,0 +1,2 @@ +[font-palette-6.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-7.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-7.html.ini new file mode 100644 index 000000000000..0e5f0c7f14b0 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-7.html.ini @@ -0,0 +1,2 @@ +[font-palette-7.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-8.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-8.html.ini new file mode 100644 index 000000000000..e42a573a05f1 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-8.html.ini @@ -0,0 +1,2 @@ +[font-palette-8.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-9.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-9.html.ini new file mode 100644 index 000000000000..a3707b26d571 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-9.html.ini @@ -0,0 +1,2 @@ +[font-palette-9.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-add.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-add.html.ini new file mode 100644 index 000000000000..765859d49963 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-add.html.ini @@ -0,0 +1,2 @@ +[font-palette-add.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-modify.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-modify.html.ini new file mode 100644 index 000000000000..bae0422832b3 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-modify.html.ini @@ -0,0 +1,2 @@ +[font-palette-modify.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/font-palette-remove.html.ini b/testing/web-platform/meta/css/css-fonts/font-palette-remove.html.ini new file mode 100644 index 000000000000..b2f3dffb0826 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/font-palette-remove.html.ini @@ -0,0 +1,2 @@ +[font-palette-remove.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/idlharness.html.ini b/testing/web-platform/meta/css/css-fonts/idlharness.html.ini index d8aae2e8dd90..ed37f0d256ae 100644 --- a/testing/web-platform/meta/css/css-fonts/idlharness.html.ini +++ b/testing/web-platform/meta/css/css-fonts/idlharness.html.ini @@ -37,8 +37,38 @@ [CSSFontFeatureValuesMap interface: existence and properties of interface prototype object's @@unscopables property] expected: FAIL + [CSSFontPaletteValuesRule interface: existence and properties of interface object] + expected: FAIL + + [CSSFontPaletteValuesRule interface object length] + expected: FAIL + + [CSSFontPaletteValuesRule interface object name] + expected: FAIL + + [CSSFontPaletteValuesRule interface: existence and properties of interface prototype object] + expected: FAIL + + [CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [CSSFontPaletteValuesRule interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [CSSFontPaletteValuesRule interface: attribute fontFamily] + expected: FAIL + + [CSSFontPaletteValuesRule interface: attribute basePalette] + expected: FAIL + [CSSFontFeatureValuesMap interface: operation set(CSSOMString, (unsigned long or sequence))] expected: FAIL + [CSSFontPaletteValuesRule interface: attribute name] + expected: FAIL + + [CSSFontPaletteValuesRule interface: attribute overrideColors] + expected: FAIL + [CSSFontFeatureValuesMap interface: maplike] expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/palette-values-rule-add-2.html.ini b/testing/web-platform/meta/css/css-fonts/palette-values-rule-add-2.html.ini new file mode 100644 index 000000000000..379c5ee284ee --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/palette-values-rule-add-2.html.ini @@ -0,0 +1,2 @@ +[palette-values-rule-add-2.html] + expected: TIMEOUT diff --git a/testing/web-platform/meta/css/css-fonts/palette-values-rule-add.html.ini b/testing/web-platform/meta/css/css-fonts/palette-values-rule-add.html.ini new file mode 100644 index 000000000000..b0f80f46f923 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/palette-values-rule-add.html.ini @@ -0,0 +1,2 @@ +[palette-values-rule-add.html] + expected: TIMEOUT diff --git a/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete-2.html.ini b/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete-2.html.ini new file mode 100644 index 000000000000..d602082b3ebe --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete-2.html.ini @@ -0,0 +1,2 @@ +[palette-values-rule-delete-2.html] + expected: TIMEOUT diff --git a/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete.html.ini b/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete.html.ini new file mode 100644 index 000000000000..3623636bd88e --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/palette-values-rule-delete.html.ini @@ -0,0 +1,2 @@ +[palette-values-rule-delete.html] + expected: TIMEOUT diff --git a/testing/web-platform/meta/css/css-fonts/parsing/__dir__.ini b/testing/web-platform/meta/css/css-fonts/parsing/__dir__.ini deleted file mode 100644 index f97b62410d2f..000000000000 --- a/testing/web-platform/meta/css/css-fonts/parsing/__dir__.ini +++ /dev/null @@ -1 +0,0 @@ -prefs: [layout.css.font-palette.enabled:true] diff --git a/testing/web-platform/meta/css/css-fonts/parsing/font-palette-computed.html.ini b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-computed.html.ini new file mode 100644 index 000000000000..2822242dffb6 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-computed.html.ini @@ -0,0 +1,12 @@ +[font-palette-computed.html] + [Property font-palette value 'normal'] + expected: FAIL + + [Property font-palette value 'light'] + expected: FAIL + + [Property font-palette value 'dark'] + expected: FAIL + + [Property font-palette value '--pitchfork'] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/parsing/font-palette-valid.html.ini b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-valid.html.ini new file mode 100644 index 000000000000..7d0404e7aeab --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-valid.html.ini @@ -0,0 +1,15 @@ +[font-palette-valid.html] + [e.style['font-palette'\] = "normal" should set the property value] + expected: FAIL + + [e.style['font-palette'\] = "light" should set the property value] + expected: FAIL + + [e.style['font-palette'\] = "dark" should set the property value] + expected: FAIL + + [e.style['font-palette'\] = "--pitchfork" should set the property value] + expected: FAIL + + [e.style['font-palette'\] = "--" should set the property value] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-invalid.html.ini b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-invalid.html.ini new file mode 100644 index 000000000000..730102357726 --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-invalid.html.ini @@ -0,0 +1,60 @@ +[font-palette-values-invalid.html] + [CSS Fonts Module Level 4: parsing @font-palette-values] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 1] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 2] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 3] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 4] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 5] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 6] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 7] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 8] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 9] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 10] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 11] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 12] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 13] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 14] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 15] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 16] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 17] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 19] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 20] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-valid.html.ini b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-valid.html.ini new file mode 100644 index 000000000000..2a9475f2f93b --- /dev/null +++ b/testing/web-platform/meta/css/css-fonts/parsing/font-palette-values-valid.html.ini @@ -0,0 +1,96 @@ +[font-palette-values-valid.html] + [CSS Fonts Module Level 4: parsing @font-palette-values] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 1] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 2] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 3] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 4] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 5] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 6] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 7] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 8] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 9] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 10] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 11] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 12] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 13] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 14] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 15] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 16] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 17] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 18] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 19] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 20] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 21] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 22] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 23] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 24] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 25] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 26] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 27] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 28] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 29] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 30] + expected: FAIL + + [CSS Fonts Module Level 4: parsing @font-palette-values 31] + expected: FAIL diff --git a/testing/web-platform/tests/css/css-fonts/font-palette-vs-shorthand.html b/testing/web-platform/tests/css/css-fonts/font-palette-vs-shorthand.html deleted file mode 100644 index 6c5cc97da941..000000000000 --- a/testing/web-platform/tests/css/css-fonts/font-palette-vs-shorthand.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - -CSS Fonts Module Level 4: interaction of font-palette and font shorthand - - - - - - - -

The first and third examples should use the 'dark' palette; the second and fourth, 'normal'.

-
A
-
A
-
A
-
A
- - - diff --git a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html index 2056055f3412..d439f6440fc6 100644 --- a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html +++ b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-invalid.html @@ -19,7 +19,7 @@ /* 0 */ @font-palette-values --A { - font-family: a, serif; /* multiple families are allowed, but not generics */ + font-family: a, b; } /* 1 */ diff --git a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html index 3c0c0626f587..e6e3dda9eb1c 100644 --- a/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html +++ b/testing/web-platform/tests/css/css-fonts/parsing/font-palette-values-valid.html @@ -98,11 +98,6 @@ /* 15 */ @font-palette-values -- { } - -/* 16 */ -@font-palette-values --P { - font-family: foo, bar, baz; -} @@ -209,7 +204,7 @@ test(function() { test(function() { let rule = rules[5]; assert_equals(rule.name, "--F"); - assert_in_array(rule.fontFamily, ["foo", "\"foo\""]); + assert_equals(rule.fontFamily, "foo"); assert_equals(rule.basePalette, ""); assert_equals(rule.overrideColors, ""); }); @@ -377,14 +372,6 @@ test(function() { assert_equals(rule.basePalette, ""); assert_equals(rule.overrideColors, ""); }); - -test(function() { - let rule = rules[16]; - assert_equals(rule.name, "--P"); - assert_equals(rule.fontFamily, "foo, bar, baz"); - assert_equals(rule.basePalette, ""); - assert_equals(rule.overrideColors, ""); -}); diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index cde6eec984c1..8f285ca272b5 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -2206,9 +2206,6 @@ STATIC_ATOMS = [ Atom("monospace", "monospace"), Atom("mozfixed", "-moz-fixed"), Atom("moz_fixed_pos_containing_block", "-moz-fixed-pos-containing-block"), - # Standard font-palette identifiers - Atom("light", "light"), - Atom("dark", "dark"), # IPC stuff # Atom("Remote", "remote"), # "remote" is present above Atom("RemoteId", "_remote_id"),