mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1698495
- Add webidl support for size-adjust. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D110023
This commit is contained in:
parent
5357cb0d41
commit
34a857b6a8
@ -24,6 +24,7 @@ dictionary FontFaceDescriptors {
|
||||
UTF8String ascentOverride = "normal";
|
||||
UTF8String descentOverride = "normal";
|
||||
UTF8String lineGapOverride = "normal";
|
||||
UTF8String sizeAdjust = "100%";
|
||||
};
|
||||
|
||||
enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
|
||||
@ -50,6 +51,7 @@ interface FontFace {
|
||||
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String ascentOverride;
|
||||
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String descentOverride;
|
||||
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String lineGapOverride;
|
||||
[SetterThrows, Pref="layout.css.size-adjust.enabled"] attribute UTF8String sizeAdjust;
|
||||
|
||||
readonly attribute FontFaceLoadStatus status;
|
||||
|
||||
|
@ -333,6 +333,16 @@ void FontFace::SetLineGapOverride(const nsACString& aValue, ErrorResult& aRv) {
|
||||
}
|
||||
}
|
||||
|
||||
void FontFace::GetSizeAdjust(nsACString& aResult) {
|
||||
GetDesc(eCSSFontDesc_SizeAdjust, aResult);
|
||||
}
|
||||
|
||||
void FontFace::SetSizeAdjust(const nsACString& aValue, ErrorResult& aRv) {
|
||||
if (SetDescriptor(eCSSFontDesc_SizeAdjust, aValue, aRv)) {
|
||||
DescriptorUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
void FontFace::DescriptorUpdated() {
|
||||
// If we haven't yet initialized mUserFontEntry, no need to do anything here;
|
||||
// we'll respect the updated descriptor when the time comes to create it.
|
||||
@ -566,7 +576,9 @@ bool FontFace::SetDescriptors(const nsACString& aFamily,
|
||||
(!setDesc(eCSSFontDesc_AscentOverride, aDescriptors.mAscentOverride) ||
|
||||
!setDesc(eCSSFontDesc_DescentOverride, aDescriptors.mDescentOverride) ||
|
||||
!setDesc(eCSSFontDesc_LineGapOverride,
|
||||
aDescriptors.mLineGapOverride)))) {
|
||||
aDescriptors.mLineGapOverride))) ||
|
||||
(StaticPrefs::layout_css_size_adjust_enabled() &&
|
||||
!setDesc(eCSSFontDesc_SizeAdjust, aDescriptors.mSizeAdjust))) {
|
||||
// XXX Handle font-variant once we support it (bug 1055385).
|
||||
|
||||
// If any of the descriptors failed to parse, none of them should be set
|
||||
|
@ -183,6 +183,8 @@ class FontFace final : public nsISupports, public nsWrapperCache {
|
||||
void SetDescentOverride(const nsACString& aValue, ErrorResult& aRv);
|
||||
void GetLineGapOverride(nsACString& aResult);
|
||||
void SetLineGapOverride(const nsACString& aValue, ErrorResult& aRv);
|
||||
void GetSizeAdjust(nsACString& aResult);
|
||||
void SetSizeAdjust(const nsACString& aValue, ErrorResult& aRv);
|
||||
|
||||
FontFaceLoadStatus Status();
|
||||
Promise* Load(ErrorResult& aRv);
|
||||
|
Loading…
Reference in New Issue
Block a user