зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1791777 - patch 2 - Expose @font-palette-values rules in the OM as CSSFontPaletteValuesRule. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157954
This commit is contained in:
Родитель
782b403c72
Коммит
cbd233a4d4
|
@ -283,6 +283,8 @@ 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 },
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/* -*- 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,6 +481,7 @@ WEBIDL_FILES = [
|
|||
"CSSCounterStyleRule.webidl",
|
||||
"CSSFontFaceRule.webidl",
|
||||
"CSSFontFeatureValuesRule.webidl",
|
||||
"CSSFontPaletteValuesRule.webidl",
|
||||
"CSSGroupingRule.webidl",
|
||||
"CSSImportRule.webidl",
|
||||
"CSSKeyframeRule.webidl",
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/* -*- 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
|
|
@ -0,0 +1,59 @@
|
|||
/* -*- 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
|
|
@ -11,6 +11,7 @@
|
|||
#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"
|
||||
|
@ -86,6 +87,7 @@ 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)
|
||||
|
@ -254,6 +256,7 @@ 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)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#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"
|
||||
|
@ -947,6 +948,7 @@ 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)
|
||||
|
|
|
@ -124,6 +124,7 @@ EXPORTS.mozilla.dom += [
|
|||
"CSSCounterStyleRule.h",
|
||||
"CSSFontFaceRule.h",
|
||||
"CSSFontFeatureValuesRule.h",
|
||||
"CSSFontPaletteValuesRule.h",
|
||||
"CSSImportRule.h",
|
||||
"CSSKeyframeRule.h",
|
||||
"CSSKeyframesRule.h",
|
||||
|
@ -173,6 +174,7 @@ UNIFIED_SOURCES += [
|
|||
"CSSCounterStyleRule.cpp",
|
||||
"CSSFontFaceRule.cpp",
|
||||
"CSSFontFeatureValuesRule.cpp",
|
||||
"CSSFontPaletteValuesRule.cpp",
|
||||
"CSSImportRule.cpp",
|
||||
"CSSKeyframeRule.cpp",
|
||||
"CSSKeyframesRule.cpp",
|
||||
|
|
Загрузка…
Ссылка в новой задаче