Backed out 9 changesets (bug 1791780, bug 1791782, bug 1791778, bug 1791777) for causing multiple mochitest failures CLOSED TREE

Backed out changeset 6de1ade5a9b6 (bug 1791782)
Backed out changeset ce96452a38a1 (bug 1791782)
Backed out changeset 7cc8e027f5a7 (bug 1791780)
Backed out changeset 8e023280032c (bug 1791778)
Backed out changeset 26d65d76d02a (bug 1791778)
Backed out changeset a98dd552df64 (bug 1791777)
Backed out changeset 766386309ee5 (bug 1791777)
Backed out changeset 7de66a218ba4 (bug 1791777)
Backed out changeset 1d17c257444e (bug 1791777)
This commit is contained in:
Norisz Fay 2022-10-07 17:36:38 +03:00
Родитель a1cec5278f
Коммит 30ef428f43
88 изменённых файлов: 373 добавлений и 1247 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -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"

Просмотреть файл

@ -7184,7 +7184,6 @@ void Document::ApplicableStylesChanged() {
pc->MarkCounterStylesDirty();
pc->MarkFontFeatureValuesDirty();
pc->MarkFontPaletteValuesDirty();
pc->RestyleManager()->NextRestyleIsForCSSRuleChanges();
}

Просмотреть файл

@ -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 },

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -481,7 +481,6 @@ WEBIDL_FILES = [
"CSSCounterStyleRule.webidl",
"CSSFontFaceRule.webidl",
"CSSFontFeatureValuesRule.webidl",
"CSSFontPaletteValuesRule.webidl",
"CSSGroupingRule.webidl",
"CSSImportRule.webidl",
"CSSKeyframeRule.webidl",

Просмотреть файл

@ -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<nsTArray<sRGBColor>> 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());
}
}

Просмотреть файл

@ -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<sRGBColor>* aColors) {
ScaledFont* aScaledFont, DrawOptions aDrawOptions,
const sRGBColor& aCurrentColor, const Point& aPoint) {
const auto* glyphRecord = reinterpret_cast<const BaseGlyphRecord*>(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<hb_color_t, 64> 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<const COLRHeader*>(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<sRGBColor>* 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<hb_color_t, 64> 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<uint32_t, 32> 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<nsTArray<sRGBColor>> 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<hb_color_t> colors;
colors.SetLength(count);
hb_ot_color_palette_get_colors(aFace, paletteIndex, 0, &count,
colors.Elements());
auto palette = MakeUnique<nsTArray<sRGBColor>>();
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

Просмотреть файл

@ -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<OverrideColor> mOverrides;
};
const PaletteValues* Lookup(nsAtom* aName, const nsACString& aFamily) const;
PaletteValues* Insert(nsAtom* aName, const nsACString& aFamily);
private:
~FontPaletteValueSet() = default;
struct PaletteHashKey {
RefPtr<nsAtom> 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<HashEntry> 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<sRGBColor>* 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<sRGBColor>* 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<nsTArray<sRGBColor>> SetupColorPalette(
hb_face_t* aFace, const FontPaletteValueSet* aPaletteValueSet,
nsAtom* aFontPalette, const nsACString& aFamilyName);
};
} // namespace gfx

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<nsTArray<mozilla::gfx::sRGBColor>> palette;
bool isVerticalFont;
bool haveSVGGlyphs;
bool haveColorGlyphs;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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<nsPresContext>;
void ThemeChangedInternal();
@ -1195,7 +1185,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
RefPtr<mozilla::CounterStyleManager> mCounterStyleManager;
const nsStaticAtom* mMedium;
RefPtr<gfxFontFeatureValueSet> mFontFeatureValuesLookup;
RefPtr<mozilla::gfx::FontPaletteValueSet> 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;

Просмотреть файл

@ -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 = &params.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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<RawServoFontPaletteValuesRule> 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<JSObject*> aGivenProto) {
return CSSFontPaletteValuesRule_Binding::Wrap(aCx, this, aGivenProto);
}
} // namespace mozilla::dom

Просмотреть файл

@ -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<RawServoFontPaletteValuesRule> 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<RawServoFontPaletteValuesRule> 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<JSObject*> aGivenProto) final;
private:
~CSSFontPaletteValuesRule() = default;
RefPtr<RawServoFontPaletteValuesRule> mRawRule;
};
} // namespace mozilla::dom
#endif // mozilla_dom_CSSFontPaletteValuesRule_h

Просмотреть файл

@ -1005,32 +1005,6 @@ nsTArray<uint32_t>* 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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)

Просмотреть файл

@ -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" },
]

Просмотреть файл

@ -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<ServoCssRules> 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)

Просмотреть файл

@ -54,7 +54,6 @@ template struct StyleStrong<RawServoNamespaceRule>;
template struct StyleStrong<RawServoPageRule>;
template struct StyleStrong<RawServoSupportsRule>;
template struct StyleStrong<RawServoFontFeatureValuesRule>;
template struct StyleStrong<RawServoFontPaletteValuesRule>;
template struct StyleStrong<RawServoFontFaceRule>;
template struct StyleStrong<RawServoCounterStyleRule>;
template struct StyleStrong<RawServoContainerRule>;

Просмотреть файл

@ -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<gfx::FontPaletteValueSet>
ServoStyleSet::BuildFontPaletteValueSet() {
MOZ_ASSERT(!StylistNeedsUpdate());
RefPtr<gfx::FontPaletteValueSet> set =
Servo_StyleSet_BuildFontPaletteValueSet(mRawSet.get());
return set.forget();
}
already_AddRefed<ComputedStyle> ServoStyleSet::ResolveForDeclarations(
const ComputedStyle* aParentOrNull,
const RawServoDeclarationBlock* aDeclarations) {

Просмотреть файл

@ -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<gfxFontFeatureValueSet> BuildFontFeatureValueSet();
// Get the set of all currently-active font-palette-values.
already_AddRefed<gfx::FontPaletteValueSet> BuildFontPaletteValueSet();
already_AddRefed<ComputedStyle> GetBaseContextForElement(
dom::Element* aElement, const ComputedStyle* aStyle);

Просмотреть файл

@ -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",

Просмотреть файл

@ -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 ||

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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<DocumentRule> => RawServoMozDocumentRule
impl_arc_ffi!(Locked<FontFeatureValuesRule> => RawServoFontFeatureValuesRule
[Servo_FontFeatureValuesRule_AddRef, Servo_FontFeatureValuesRule_Release]);
impl_arc_ffi!(Locked<FontPaletteValuesRule> => RawServoFontPaletteValuesRule
[Servo_FontPaletteValuesRule_AddRef, Servo_FontPaletteValuesRule_Release]);
impl_arc_ffi!(Locked<FontFaceRule> => RawServoFontFaceRule
[Servo_FontFaceRule_AddRef, Servo_FontFaceRule_Release]);

Просмотреть файл

@ -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."

Просмотреть файл

@ -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",

Просмотреть файл

@ -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. Its big, try not to move it around.

Просмотреть файл

@ -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:
{

Просмотреть файл

@ -275,6 +275,23 @@ macro_rules! font_feature_values_blocks {
rule
}
/// Prints font family names.
pub fn font_family_to_css<W>(
&self,
dest: &mut CssWriter<W>,
) -> 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<W>(&self, dest: &mut CssWriter<W>) -> 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("}")

Просмотреть файл

@ -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<FontPaletteOverrideColor, ParseError<'i>> {
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<W>(&self, dest: &mut CssWriter<W>) -> 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<FamilyName>,
/// The base palette.
pub base_palette: Option<FontPaletteBase>,
/// The list of override colors.
pub override_colors: Vec<FontPaletteOverrideColor>,
/// 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<W>(&self, dest: &mut CssWriter<W>) -> 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<Vec<FontPaletteOverrideColor>, 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(())
}
}

Просмотреть файл

@ -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<Locked<ContainerRule>>),
FontFace(Arc<Locked<FontFaceRule>>),
FontFeatureValues(Arc<Locked<FontFeatureValuesRule>>),
FontPaletteValues(Arc<Locked<FontPaletteValuesRule>>),
CounterStyle(Arc<Locked<CounterStyleRule>>),
Viewport(Arc<Locked<ViewportRule>>),
Keyframes(Arc<Locked<KeyframesRule>>),
@ -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),

Просмотреть файл

@ -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<FamilyName>),
/// 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,

Просмотреть файл

@ -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) {

Просмотреть файл

@ -370,7 +370,6 @@ impl SanitizationKind {
CssRule::Keyframes(..) |
CssRule::Page(..) |
CssRule::FontFeatureValues(..) |
CssRule::FontPaletteValues(..) |
CssRule::Viewport(..) |
CssRule::CounterStyle(..) => !is_standard,
}

Просмотреть файл

@ -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<Arc<Locked<FontFeatureValuesRule>>>,
/// A list of effective font-palette-values rules.
#[cfg(feature = "gecko")]
pub font_palette_values: LayerOrderedVec<Arc<Locked<FontPaletteValuesRule>>>,
/// A map of effective counter-style rules.
#[cfg(feature = "gecko")]
pub counter_styles: LayerOrderedMap<Arc<Locked<CounterStyleRule>>>,
@ -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<Locked<FontPaletteValuesRule>>,
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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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};

Просмотреть файл

@ -482,44 +482,6 @@ impl ToCss for CustomIdent {
}
}
/// <https://www.w3.org/TR/css-values-4/#dashed-idents>
/// 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<Self, ParseError<'i>> {
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<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
serialize_atom_identifier(&self.0, dest)
}
}
/// The <timeline-name> or <keyframes-name>.
/// The definition of these two names are the same, so we use the same type for them.
///

Просмотреть файл

@ -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<FontSynthesis, ParseError<'i>> {
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<FontPalette, ParseError<'i>> {
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<W>(&self, dest: &mut CssWriter<W>) -> 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<VariationValue<Number>>;

Просмотреть файл

@ -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<Integer>;
impl Parse for NonNegativeInteger {
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Ok(NonNegative(Integer::parse_non_negative(context, input)?))
}
}
/// A Number which is >= 1.0.
pub type GreaterThanOrEqualToOneNumber = GreaterThanOrEqualToOne<Number>;

Просмотреть файл

@ -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())};
}
"""

Просмотреть файл

@ -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)
},

Просмотреть файл

@ -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<RawServoFontFaceRule> {
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,

Просмотреть файл

@ -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]

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-13.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-16.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-17.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-18.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-19.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-22.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-3.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-4.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-5.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-6.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-7.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-8.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-9.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-add.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-modify.html]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[font-palette-remove.html]
expected: FAIL

Просмотреть файл

@ -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<unsigned long>))]
expected: FAIL
[CSSFontPaletteValuesRule interface: attribute name]
expected: FAIL
[CSSFontPaletteValuesRule interface: attribute overrideColors]
expected: FAIL
[CSSFontFeatureValuesMap interface: maplike<CSSOMString, [object Object\]>]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[palette-values-rule-add-2.html]
expected: TIMEOUT

Просмотреть файл

@ -0,0 +1,2 @@
[palette-values-rule-add.html]
expected: TIMEOUT

Просмотреть файл

@ -0,0 +1,2 @@
[palette-values-rule-delete-2.html]
expected: TIMEOUT

Просмотреть файл

@ -0,0 +1,2 @@
[palette-values-rule-delete.html]
expected: TIMEOUT

Просмотреть файл

@ -1 +0,0 @@
prefs: [layout.css.font-palette.enabled:true]

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -1,83 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: interaction of font-palette and font shorthand</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-prop">
<meta name="assert" content="font-palette is reset to normal by font shorthand.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="style">
@font-face {
font-family: colr;
src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
}
div {
margin: 10px;
}
#a {
font: 50px colr;
font-palette: dark;
}
#b {
font-palette: dark;
font: 50px colr; /* should reset font-palette to normal */
}
#c {
font-palette: dark;
font-size: 50px;
font-family: colr;
}
#d {
font-palette: dark;
font-size: 50px;
font-family: colr;
font-palette: normal;
}
</style>
</head>
<body>
<p>The first and third examples should use the 'dark' palette; the second and fourth, 'normal'.</p>
<div id=a>A</div>
<div id=b>A</div>
<div id=c>A</div>
<div id=d>A</div>
<script>
test(function() {
let testElem = document.getElementById("a");
let computed = window.getComputedStyle(testElem);
assert_equals(computed.fontPalette, "dark");
assert_equals(computed.font, "");
assert_equals(computed.fontFamily, "colr");
assert_equals(computed.fontSize, "50px");
});
test(function() {
let testElem = document.getElementById("b");
let computed = window.getComputedStyle(testElem);
assert_equals(computed.fontPalette, "normal");
assert_not_equals(computed.font, "");
/* The exact form of the font shorthand varies, but should include these pieces: */
assert_not_equals(computed.font.indexOf("50px"), -1);
assert_not_equals(computed.font.indexOf("colr"), -1);
/* And there should be no trace of this: */
assert_equals(computed.font.indexOf("dark"), -1);
});
test(function() {
let testElem = document.getElementById("c");
let computed = window.getComputedStyle(testElem);
assert_equals(computed.fontPalette, "dark");
assert_equals(computed.font, "");
});
test(function() {
let testElem = document.getElementById("d");
let computed = window.getComputedStyle(testElem);
assert_equals(computed.fontPalette, "normal");
assert_not_equals(computed.font.indexOf("50px"), -1);
assert_not_equals(computed.font.indexOf("colr"), -1);
});
</script>
</body>
</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 */

Просмотреть файл

@ -98,11 +98,6 @@
/* 15 */
@font-palette-values -- {
}
/* 16 */
@font-palette-values --P {
font-family: foo, bar, baz;
}
</style>
</head>
<body>
@ -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, "");
});
</script>
</body>
</html>

Просмотреть файл

@ -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"),