dom: Use pref macro for IDL conditional guards.

This commit is contained in:
Josh Matthews 2020-07-09 20:01:01 -04:00
parent 714acb942c
commit aa80f91399
38 changed files with 8 additions and 109 deletions

View file

@ -134,7 +134,6 @@ mod gen {
} }
}, },
canvas_text: { canvas_text: {
#[serde(rename = "dom.canvas-text.enabled")]
enabled: bool, enabled: bool,
}, },
composition_event: { composition_event: {

View file

@ -2662,7 +2662,7 @@ class CGConstructorEnabled(CGAbstractMethod):
pref = iface.getExtendedAttribute("Pref") pref = iface.getExtendedAttribute("Pref")
if pref: if pref:
assert isinstance(pref, list) and len(pref) == 1 assert isinstance(pref, list) and len(pref) == 1
conditions.append('prefs::pref_map().get("%s").as_bool().unwrap_or(false)' % pref[0]) conditions.append('pref!(%s)' % pref[0])
func = iface.getExtendedAttribute("Func") func = iface.getExtendedAttribute("Func")
if func: if func:

View file

@ -148,12 +148,12 @@ interface mixin CanvasUserInterface {
[Exposed=(PaintWorklet, Window, Worker)] [Exposed=(PaintWorklet, Window, Worker)]
interface mixin CanvasText { interface mixin CanvasText {
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces) // text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
[Pref="dom.canvas-text.enabled"] [Pref="dom.canvas_text.enabled"]
void fillText(DOMString text, unrestricted double x, unrestricted double y, void fillText(DOMString text, unrestricted double x, unrestricted double y,
optional unrestricted double maxWidth); optional unrestricted double maxWidth);
//void strokeText(DOMString text, unrestricted double x, unrestricted double y, //void strokeText(DOMString text, unrestricted double x, unrestricted double y,
// optional unrestricted double maxWidth); // optional unrestricted double maxWidth);
[Pref="dom.canvas-text.enabled"] [Pref="dom.canvas_text.enabled"]
TextMetrics measureText(DOMString text); TextMetrics measureText(DOMString text);
}; };

View file

@ -8,7 +8,7 @@
*/ */
// https://w3c.github.io/uievents/#idl-compositionevent // https://w3c.github.io/uievents/#idl-compositionevent
[Exposed=Window, Pref="dom.compositionevent.enabled"] [Exposed=Window, Pref="dom.composition_event.enabled"]
interface CompositionEvent : UIEvent { interface CompositionEvent : UIEvent {
[Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {}); [Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {});
readonly attribute DOMString data; readonly attribute DOMString data;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#customelementregistry // https://html.spec.whatwg.org/multipage/#customelementregistry
[Exposed=Window, Pref="dom.customelements.enabled"] [Exposed=Window, Pref="dom.custom_elements.enabled"]
interface CustomElementRegistry { interface CustomElementRegistry {
[Throws, CEReactions] [Throws, CEReactions]
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options = {}); void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options = {});

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#textmetrics // https://html.spec.whatwg.org/multipage/#textmetrics
[Exposed=(PaintWorklet, Window, Worker), Pref="dom.canvas-text.enabled"] [Exposed=(PaintWorklet, Window, Worker), Pref="dom.canvas_text.enabled"]
interface TextMetrics { interface TextMetrics {
// x-direction // x-direction
readonly attribute double width; // advance width readonly attribute double width; // advance width

View file

@ -1,7 +1,7 @@
{ {
"dom.bluetooth.enabled": false, "dom.bluetooth.enabled": false,
"dom.bluetooth.testing.enabled": false, "dom.bluetooth.testing.enabled": false,
"dom.canvas-text.enabled": true, "dom.canvas_text.enabled": true,
"dom.compositionevent.enabled": false, "dom.compositionevent.enabled": false,
"dom.customelements.enabled": true, "dom.customelements.enabled": true,
"dom.document.dblclick_dist": 1, "dom.document.dblclick_dist": 1,

View file

@ -1 +1 @@
prefs: ["dom.canvas-text.enabled:false","dom.offscreen_canvas.enabled:true"] prefs: ["dom.offscreen_canvas.enabled:true"]

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.NaN.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.fontface.html]
[fillText works on @font-face fonts]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.negative.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.small.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.zero.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.unaffected.html]
[fillText does not start a new path or subpath]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fontface.html]
[Canvas test: 2d.text.draw.fontface]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fontface.notinpage.html]
[@font-face fonts should work even if they are not used in the page]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fontface.repeat.html]
[Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)]
expected: FAIL

View file

@ -1,2 +0,0 @@
[canvas_text_font_001.htm]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.space.collapse.start.html]
[Space characters at the start of a line are collapsed (per CSS)]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.NaN.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.NaN.worker.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.negative.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.negative.worker.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.small.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.small.worker.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.zero.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.maxWidth.zero.worker.html]
[fillText handles maxWidth correctly]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.unaffected.html]
[fillText does not start a new path or subpath]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.text.draw.fill.unaffected.worker.html]
[fillText does not start a new path or subpath]
expected: FAIL

View file

@ -1,6 +1,4 @@
[oes-texture-float-with-canvas.html] [oes-texture-float-with-canvas.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255] [WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[oes-texture-half-float-with-canvas.html] [oes-texture-half-float-with-canvas.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255] [WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-luminance-luminance-unsigned_byte.html] [tex-2d-luminance-luminance-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #33: font missing] [WebGL test #33: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html] [tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #245: font missing] [WebGL test #245: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-rgb-rgb-unsigned_byte.html] [tex-2d-rgb-rgb-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #399: font missing] [WebGL test #399: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html] [tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #273: font missing] [WebGL test #273: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-rgba-rgba-unsigned_byte.html] [tex-2d-rgba-rgba-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #399: font missing] [WebGL test #399: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html] [tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #241: font missing] [WebGL test #241: font missing]
expected: FAIL expected: FAIL

View file

@ -1,6 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html] [tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
bug: https://github.com/servo/servo/issues/11681
prefs: [dom.canvas-text.enabled:true]
expected: ERROR expected: ERROR
[WebGL test #241: font missing] [WebGL test #241: font missing]
expected: FAIL expected: FAIL