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

@ -2662,7 +2662,7 @@ class CGConstructorEnabled(CGAbstractMethod):
pref = iface.getExtendedAttribute("Pref")
if pref:
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")
if func:

View file

@ -148,12 +148,12 @@ interface mixin CanvasUserInterface {
[Exposed=(PaintWorklet, Window, Worker)]
interface mixin CanvasText {
// 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,
optional unrestricted double maxWidth);
//void strokeText(DOMString text, unrestricted double x, unrestricted double y,
// optional unrestricted double maxWidth);
[Pref="dom.canvas-text.enabled"]
[Pref="dom.canvas_text.enabled"]
TextMetrics measureText(DOMString text);
};

View file

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

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#customelementregistry
[Exposed=Window, Pref="dom.customelements.enabled"]
[Exposed=Window, Pref="dom.custom_elements.enabled"]
interface CustomElementRegistry {
[Throws, CEReactions]
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/. */
// 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 {
// x-direction
readonly attribute double width; // advance width