зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1778910 - Implement setting/getting the fontVariantCaps attribute on Canvas2D context (note: no rendering support yet). r=gfx-reviewers,webidl,lsalzman,saschanaz
Surprisingly, this is sufficient to pass the existing WPT tests for fontVariantCaps. (They only test setting and reading the attribute, but don't verify that it actually has any effect on rendering!) Rendering tests will be added in the next patch, along with hooking up the behavior. Differential Revision: https://phabricator.services.mozilla.com/D182566
This commit is contained in:
Родитель
1f7b14ac8e
Коммит
ff18a2e8b3
|
@ -991,6 +991,7 @@ CanvasRenderingContext2D::ContextState::ContextState(const ContextState& aOther)
|
|||
textBaseline(aOther.textBaseline),
|
||||
textDirection(aOther.textDirection),
|
||||
fontKerning(aOther.fontKerning),
|
||||
fontVariantCaps(aOther.fontVariantCaps),
|
||||
textRendering(aOther.textRendering),
|
||||
letterSpacing(aOther.letterSpacing),
|
||||
wordSpacing(aOther.wordSpacing),
|
||||
|
|
|
@ -315,6 +315,16 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
|
|||
}
|
||||
}
|
||||
|
||||
CanvasFontVariantCaps FontVariantCaps() {
|
||||
return CurrentState().fontVariantCaps;
|
||||
}
|
||||
void SetFontVariantCaps(const CanvasFontVariantCaps& aFontVariantCaps) {
|
||||
if (CurrentState().fontVariantCaps != aFontVariantCaps) {
|
||||
CurrentState().fontVariantCaps = aFontVariantCaps;
|
||||
CurrentState().fontGroup = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CanvasTextRendering TextRendering() { return CurrentState().textRendering; }
|
||||
void SetTextRendering(const CanvasTextRendering& aTextRendering) {
|
||||
CurrentState().textRendering = aTextRendering;
|
||||
|
@ -961,6 +971,7 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
|
|||
CanvasTextBaseline textBaseline = CanvasTextBaseline::Alphabetic;
|
||||
CanvasDirection textDirection = CanvasDirection::Inherit;
|
||||
CanvasFontKerning fontKerning = CanvasFontKerning::Auto;
|
||||
CanvasFontVariantCaps fontVariantCaps = CanvasFontVariantCaps::Normal;
|
||||
CanvasTextRendering textRendering = CanvasTextRendering::Auto;
|
||||
|
||||
gfx::Float letterSpacing = 0.0f;
|
||||
|
|
|
@ -20,7 +20,7 @@ enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic
|
|||
enum CanvasDirection { "ltr", "rtl", "inherit" };
|
||||
enum CanvasFontKerning { "auto", "normal", "none" };
|
||||
// enum CanvasFontStretch { "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" };
|
||||
// enum CanvasFontVariantCaps { "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps" };
|
||||
enum CanvasFontVariantCaps { "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps" };
|
||||
enum CanvasTextRendering { "auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision" };
|
||||
|
||||
[GenerateInit]
|
||||
|
@ -299,7 +299,7 @@ interface mixin CanvasTextDrawingStyles {
|
|||
attribute UTF8String letterSpacing; // default: "0px"
|
||||
attribute CanvasFontKerning fontKerning; // (default: "auto")
|
||||
// NOT IMPLEMENTED attribute CanvasFontStretch fontStretch; // (default: "normal")
|
||||
// NOT IMPLEMENTED attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal")
|
||||
attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal")
|
||||
attribute CanvasTextRendering textRendering; // (default: "auto")
|
||||
attribute UTF8String wordSpacing; // default: "0px"
|
||||
};
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[2d.text.drawing.style.fontVariant.settings.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[Testing basic functionalities of fontVariant for canvas]
|
||||
expected: FAIL
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.drawing.style.fontVariant.settings.html]
|
||||
[Testing basic functionalities of fontVariant for canvas]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.drawing.style.fontVariant.settings.worker.html]
|
||||
[Testing basic functionalities of fontVariant for canvas]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче