1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
//
// DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIFocusManager.idl
//


/// `interface nsIFocusManager : nsISupports`
///

/// ```text
/// /**
///  * The focus manager deals with all focus related behaviour. Only one element
///  * in the entire application may have the focus at a time; this element
///  * receives any keyboard events. While there is only one application-wide
///  * focused element, each nsIDOMWindow maintains a reference to the element
///  * that would be focused if the window was active.
///  *
///  * If the window's reference is to a frame element (iframe, browser,
    ///  * editor), then the child window contains the element that is currently
///  * focused. If the window's reference is to a root element, then the root is
///  * focused. If a window's reference is null, then no element is focused, yet
///  * the window is still focused.
///  *
///  * The blur event is fired on an element when it loses the application focus.
///  * After this blur event, if the focus is moving away from a document, two
///  * additional blur events are fired on the old document and window containing
///  * the focus respectively.
///  *
///  * When a new document is focused, two focus events are fired on the new
///  * document and window respectively. Then the focus event is fired on an
///  * element when it gains the application focus.
///  *
///  * A special case is that the root element may be focused, yet does not
///  * receive the element focus and blur events. Instead a focus outline may be
///  * drawn around the document.
///  *
///  * Blur and focus events do not bubble as per the W3C DOM Events spec.
///  */
/// ```
///

// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIFocusManager {
    vtable: *const nsIFocusManagerVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIFocusManager.
unsafe impl XpCom for nsIFocusManager {
    const IID: nsIID = nsID(0x86e1f1e1, 0x365d, 0x493b,
        [0xb5, 0x2a, 0xa6, 0x49, 0xf3, 0xf3, 0x11, 0xdc]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIFocusManager {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIFocusManager.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIFocusManagerCoerce {
    /// Cheaply cast a value of this type from a `nsIFocusManager`.
    fn coerce_from(v: &nsIFocusManager) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIFocusManagerCoerce for nsIFocusManager {
    #[inline]
    fn coerce_from(v: &nsIFocusManager) -> &Self {
        v
    }
}

impl nsIFocusManager {
    /// Cast this `nsIFocusManager` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIFocusManagerCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIFocusManager {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIFocusManagerCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIFocusManager) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIFocusManager
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIFocusManagerVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* attribute mozIDOMWindowProxy activeWindow; */
    pub GetActiveWindow: unsafe extern "system" fn (this: *const nsIFocusManager, aActiveWindow: *mut *const mozIDOMWindowProxy) -> nsresult,

    /* attribute mozIDOMWindowProxy activeWindow; */
    pub SetActiveWindow: unsafe extern "system" fn (this: *const nsIFocusManager, aActiveWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* attribute mozIDOMWindowProxy focusedWindow; */
    pub GetFocusedWindow: unsafe extern "system" fn (this: *const nsIFocusManager, aFocusedWindow: *mut *const mozIDOMWindowProxy) -> nsresult,

    /* attribute mozIDOMWindowProxy focusedWindow; */
    pub SetFocusedWindow: unsafe extern "system" fn (this: *const nsIFocusManager, aFocusedWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* readonly attribute nsIDOMElement focusedElement; */
    pub GetFocusedElement: unsafe extern "system" fn (this: *const nsIFocusManager, aFocusedElement: *mut *const nsIDOMElement) -> nsresult,

    /* uint32_t getLastFocusMethod (in mozIDOMWindowProxy window); */
    pub GetLastFocusMethod: unsafe extern "system" fn (this: *const nsIFocusManager, window: *const mozIDOMWindowProxy, _retval: *mut uint32_t) -> nsresult,

    /* void setFocus (in nsIDOMElement aElement, in unsigned long aFlags); */
    pub SetFocus: unsafe extern "system" fn (this: *const nsIFocusManager, aElement: *const nsIDOMElement, aFlags: libc::uint32_t) -> nsresult,

    /* nsIDOMElement moveFocus (in mozIDOMWindowProxy aWindow, in nsIDOMElement aStartElement, in unsigned long aType, in unsigned long aFlags); */
    pub MoveFocus: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy, aStartElement: *const nsIDOMElement, aType: libc::uint32_t, aFlags: libc::uint32_t, _retval: *mut *const nsIDOMElement) -> nsresult,

    /* void clearFocus (in mozIDOMWindowProxy aWindow); */
    pub ClearFocus: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* nsIDOMElement getFocusedElementForWindow (in mozIDOMWindowProxy aWindow, in boolean aDeep, out mozIDOMWindowProxy aFocusedWindow); */
    pub GetFocusedElementForWindow: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy, aDeep: bool, aFocusedWindow: *mut *const mozIDOMWindowProxy, _retval: *mut *const nsIDOMElement) -> nsresult,

    /* void moveCaretToFocus (in mozIDOMWindowProxy aWindow); */
    pub MoveCaretToFocus: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* boolean elementIsFocusable (in nsIDOMElement aElement, in unsigned long aFlags); */
    pub ElementIsFocusable: unsafe extern "system" fn (this: *const nsIFocusManager, aElement: *const nsIDOMElement, aFlags: libc::uint32_t, _retval: *mut bool) -> nsresult,

    /* [noscript] void windowRaised (in mozIDOMWindowProxy aWindow); */
    pub WindowRaised: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* [noscript] void windowLowered (in mozIDOMWindowProxy aWindow); */
    pub WindowLowered: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* [noscript] void windowShown (in mozIDOMWindowProxy aWindow, in boolean aNeedsFocus); */
    pub WindowShown: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy, aNeedsFocus: bool) -> nsresult,

    /* [noscript] void windowHidden (in mozIDOMWindowProxy aWindow); */
    pub WindowHidden: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy) -> nsresult,

    /* [noscript] void fireDelayedEvents (in nsIDocument aDocument); */
    pub FireDelayedEvents: unsafe extern "system" fn (this: *const nsIFocusManager, aDocument: *const nsIDocument) -> nsresult,

    /* [noscript] void focusPlugin (in nsIContent aPlugin); */
    pub FocusPlugin: unsafe extern "system" fn (this: *const nsIFocusManager, aPlugin: *const nsIContent) -> nsresult,

    /* [noscript] void parentActivated (in mozIDOMWindowProxy aWindow, in bool active); */
    pub ParentActivated: unsafe extern "system" fn (this: *const nsIFocusManager, aWindow: *const mozIDOMWindowProxy, active: bool) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIFocusManager {

    pub const FLAG_RAISE: i64 = 1;

    /// ```text
    /// /**
    ///    * Do not scroll the element to focus into view
    ///    */
    /// ```
    ///

    pub const FLAG_NOSCROLL: i64 = 2;

    /// ```text
    /// /**
    ///    * If attempting to change focus in a window that is not focused, do not
    ///    * switch focus to that window. Instead, just update the focus within that
    ///    * window and leave the application focus as is. This flag will have no
    ///    * effect if a child window is focused and an attempt is made to adjust the
    ///    * focus in an ancestor, as the frame must be switched in this case.
    ///    */
    /// ```
    ///

    pub const FLAG_NOSWITCHFRAME: i64 = 4;

    /// ```text
    /// /**
    ///    * This flag is only used when passed to moveFocus. If set, focus is never
    ///    * moved to the parent frame of the starting element's document, instead
    ///    * iterating around to the beginning of that document again. Child frames
    ///    * are navigated as normal.
    ///    */
    /// ```
    ///

    pub const FLAG_NOPARENTFRAME: i64 = 8;

    /// ```text
    /// /**
    ///    * Focus is changing due to a mouse operation, for instance the mouse was
    ///    * clicked on an element.
    ///    */
    /// ```
    ///

    pub const FLAG_BYMOUSE: i64 = 4096;

    /// ```text
    /// /**
    ///    * Focus is changing due to a key operation, for instance pressing the tab
    ///    * key. This flag would normally be passed when MOVEFOCUS_FORWARD or
    ///    * MOVEFOCUS_BACKWARD is used.
    ///    */
    /// ```
    ///

    pub const FLAG_BYKEY: i64 = 8192;

    /// ```text
    /// /**
    ///    * Focus is changing due to a call to MoveFocus. This flag will be implied
    ///    * when MoveFocus is called except when one of the other mechanisms (mouse
        ///    * or key) is specified, or when the type is MOVEFOCUS_ROOT or
    ///    * MOVEFOCUS_CARET.
    ///    */
    /// ```
    ///

    pub const FLAG_BYMOVEFOCUS: i64 = 16384;

    /// ```text
    /// /**
    ///    * Always show the focus ring or other indicator of focus, regardless of
    ///    * other state.
    ///    */
    /// ```
    ///

    pub const FLAG_SHOWRING: i64 = 1048576;

    /// ```text
    /// /**
    ///    * Focus is changing due to a touch operation that generated a mouse event.
    ///    * Normally used in conjunction with FLAG_BYMOUSE.
    ///    */
    /// ```
    ///

    pub const FLAG_BYTOUCH: i64 = 2097152;

    /// ```text
    /// /** move focus forward one element, used when pressing TAB */
    /// ```
    ///

    pub const MOVEFOCUS_FORWARD: i64 = 1;

    /// ```text
    /// /** move focus backward one element, used when pressing Shift+TAB */
    /// ```
    ///

    pub const MOVEFOCUS_BACKWARD: i64 = 2;

    /// ```text
    /// /** move focus forward to the next frame document, used when pressing F6 */
    /// ```
    ///

    pub const MOVEFOCUS_FORWARDDOC: i64 = 3;

    /// ```text
    /// /** move focus forward to the previous frame document, used when pressing Shift+F6 */
    /// ```
    ///

    pub const MOVEFOCUS_BACKWARDDOC: i64 = 4;

    /// ```text
    /// /** move focus to the first focusable element */
    /// ```
    ///

    pub const MOVEFOCUS_FIRST: i64 = 5;

    /// ```text
    /// /** move focus to the last focusable element */
    /// ```
    ///

    pub const MOVEFOCUS_LAST: i64 = 6;

    /// ```text
    /// /** move focus to the root element in the document */
    /// ```
    ///

    pub const MOVEFOCUS_ROOT: i64 = 7;

    /// ```text
    /// /** move focus to a link at the position of the caret. This is a special value used to
    ///    *  focus links as the caret moves over them in caret browsing mode.
    ///    */
    /// ```
    ///

    pub const MOVEFOCUS_CARET: i64 = 8;

    /// ```text
    /// /** move focus to the first focusable document */
    /// ```
    ///

    pub const MOVEFOCUS_FIRSTDOC: i64 = 9;

    /// ```text
    /// /** move focus to the last focusable document */
    /// ```
    ///

    pub const MOVEFOCUS_LASTDOC: i64 = 10;

    /// ```text
    /// /**
    ///    * The most active (frontmost) window, or null if no window that is part of
    ///    * the application is active. Setting the activeWindow raises it, and
    ///    * focuses the current child window's current element, if any. Setting this
    ///    * to null or to a non-top-level window throws an NS_ERROR_INVALID_ARG
    ///    * exception.
    ///    */
    /// ```
    ///

    /// `attribute mozIDOMWindowProxy activeWindow;`
    #[inline]
    pub unsafe fn GetActiveWindow(&self, aActiveWindow: *mut *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).GetActiveWindow)(self, aActiveWindow)
    }


    /// ```text
    /// /**
    ///    * The most active (frontmost) window, or null if no window that is part of
    ///    * the application is active. Setting the activeWindow raises it, and
    ///    * focuses the current child window's current element, if any. Setting this
    ///    * to null or to a non-top-level window throws an NS_ERROR_INVALID_ARG
    ///    * exception.
    ///    */
    /// ```
    ///

    /// `attribute mozIDOMWindowProxy activeWindow;`
    #[inline]
    pub unsafe fn SetActiveWindow(&self, aActiveWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).SetActiveWindow)(self, aActiveWindow)
    }


    /// ```text
    /// /**
    ///    * The child window within the activeWindow that is focused. This will
    ///    * always be activeWindow, a child window of activeWindow or null if no
    ///    * child window is focused. Setting the focusedWindow changes the focused
    ///    * window and raises the toplevel window it is in. If the current focus
    ///    * within the new focusedWindow is a frame element, then the focusedWindow
    ///    * will actually be set to the child window and the current element within
    ///    * that set as the focused element. This process repeats downwards until a
    ///    * non-frame element is found.
    ///    */
    /// ```
    ///

    /// `attribute mozIDOMWindowProxy focusedWindow;`
    #[inline]
    pub unsafe fn GetFocusedWindow(&self, aFocusedWindow: *mut *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).GetFocusedWindow)(self, aFocusedWindow)
    }


    /// ```text
    /// /**
    ///    * The child window within the activeWindow that is focused. This will
    ///    * always be activeWindow, a child window of activeWindow or null if no
    ///    * child window is focused. Setting the focusedWindow changes the focused
    ///    * window and raises the toplevel window it is in. If the current focus
    ///    * within the new focusedWindow is a frame element, then the focusedWindow
    ///    * will actually be set to the child window and the current element within
    ///    * that set as the focused element. This process repeats downwards until a
    ///    * non-frame element is found.
    ///    */
    /// ```
    ///

    /// `attribute mozIDOMWindowProxy focusedWindow;`
    #[inline]
    pub unsafe fn SetFocusedWindow(&self, aFocusedWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).SetFocusedWindow)(self, aFocusedWindow)
    }


    /// ```text
    /// /**
    ///    * The element that is currently focused. This will always be an element
    ///    * within the document loaded in focusedWindow or null if no element in that
    ///    * document is focused.
    ///    */
    /// ```
    ///

    /// `readonly attribute nsIDOMElement focusedElement;`
    #[inline]
    pub unsafe fn GetFocusedElement(&self, aFocusedElement: *mut *const nsIDOMElement) -> nsresult {
        ((*self.vtable).GetFocusedElement)(self, aFocusedElement)
    }


    /// ```text
    /// /**
    ///    * Returns the method that was used to focus the element in window. This
    ///    * will either be 0, FLAG_BYMOUSE or FLAG_BYKEY. If window is null, then
    ///    * the current focusedWindow will be used by default. This has the result
    ///    * of retrieving the method that was used to focus the currently focused
    ///    * element.
    ///    */
    /// ```
    ///

    /// `uint32_t getLastFocusMethod (in mozIDOMWindowProxy window);`
    #[inline]
    pub unsafe fn GetLastFocusMethod(&self, window: *const mozIDOMWindowProxy, _retval: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetLastFocusMethod)(self, window, _retval)
    }


    /// ```text
    /// /**
    ///    * Changes the focused element reference within the window containing
    ///    * aElement to aElement.
    ///    */
    /// ```
    ///

    /// `void setFocus (in nsIDOMElement aElement, in unsigned long aFlags);`
    #[inline]
    pub unsafe fn SetFocus(&self, aElement: *const nsIDOMElement, aFlags: libc::uint32_t) -> nsresult {
        ((*self.vtable).SetFocus)(self, aElement, aFlags)
    }


    /// ```text
    /// /**
    ///    * Move the focus to another element. If aStartElement is specified, then
    ///    * movement is done relative to aStartElement. If aStartElement is null,
    ///    * then movement is done relative to the currently focused element. If no
    ///    * element is focused, focus the first focusable element within the
    ///    * document (or the last focusable element if aType is MOVEFOCUS_END). This
    ///    * method is equivalent to setting the focusedElement to the new element.
    ///    *
    ///    * Specifying aStartElement and using MOVEFOCUS_LAST is not currently
    ///    * implemented.
    ///    *
    ///    * If no element is found, and aType is either MOVEFOCUS_ROOT or
    ///    * MOVEFOCUS_CARET, then the focus is cleared. If aType is any other value,
    ///    * the focus is not changed.
    ///    *
    ///    * Returns the element that was focused. The return value may be null if focus
    ///    * was moved into a child process.
    ///    */
    /// ```
    ///

    /// `nsIDOMElement moveFocus (in mozIDOMWindowProxy aWindow, in nsIDOMElement aStartElement, in unsigned long aType, in unsigned long aFlags);`
    #[inline]
    pub unsafe fn MoveFocus(&self, aWindow: *const mozIDOMWindowProxy, aStartElement: *const nsIDOMElement, aType: libc::uint32_t, aFlags: libc::uint32_t, _retval: *mut *const nsIDOMElement) -> nsresult {
        ((*self.vtable).MoveFocus)(self, aWindow, aStartElement, aType, aFlags, _retval)
    }


    /// ```text
    /// /**
    ///    * Clears the focused element within aWindow. If the current focusedWindow
    ///    * is a descendant of aWindow, sets the current focusedWindow to aWindow.
    ///    *
    ///    * @throws NS_ERROR_INVALID_ARG if aWindow is null
    ///    */
    /// ```
    ///

    /// `void clearFocus (in mozIDOMWindowProxy aWindow);`
    #[inline]
    pub unsafe fn ClearFocus(&self, aWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).ClearFocus)(self, aWindow)
    }


    /// ```text
    /// /**
    ///    * Returns the currently focused element within aWindow. If aWindow is equal
    ///    * to the current value of focusedWindow, then the returned element will be
    ///    * the application-wide focused element (the value of focusedElement). The
    ///    * return value will be null if no element is focused.
    ///    *
    ///    * If aDeep is true, then child frames are traversed and the return value
    ///    * may be the element within a child descendant window that is focused. If
    ///    * aDeep if false, then the return value will be the frame element if the
    ///    * focus is in a child frame.
    ///    *
    ///    * aFocusedWindow will be set to the currently focused descendant window of
    ///    * aWindow, or to aWindow if aDeep is false. This will be set even if no
    ///    * element is focused.
    ///    *
    ///    * @throws NS_ERROR_INVALID_ARG if aWindow is null
    ///    */
    /// ```
    ///

    /// `nsIDOMElement getFocusedElementForWindow (in mozIDOMWindowProxy aWindow, in boolean aDeep, out mozIDOMWindowProxy aFocusedWindow);`
    #[inline]
    pub unsafe fn GetFocusedElementForWindow(&self, aWindow: *const mozIDOMWindowProxy, aDeep: bool, aFocusedWindow: *mut *const mozIDOMWindowProxy, _retval: *mut *const nsIDOMElement) -> nsresult {
        ((*self.vtable).GetFocusedElementForWindow)(self, aWindow, aDeep, aFocusedWindow, _retval)
    }


    /// ```text
    /// /**
    ///    * Moves the selection caret within aWindow to the current focus.
    ///    */
    /// ```
    ///

    /// `void moveCaretToFocus (in mozIDOMWindowProxy aWindow);`
    #[inline]
    pub unsafe fn MoveCaretToFocus(&self, aWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).MoveCaretToFocus)(self, aWindow)
    }


    /// ```text
    /// /***
    ///    * Check if given element is focusable.
    ///    */
    /// ```
    ///

    /// `boolean elementIsFocusable (in nsIDOMElement aElement, in unsigned long aFlags);`
    #[inline]
    pub unsafe fn ElementIsFocusable(&self, aElement: *const nsIDOMElement, aFlags: libc::uint32_t, _retval: *mut bool) -> nsresult {
        ((*self.vtable).ElementIsFocusable)(self, aElement, aFlags, _retval)
    }


    /// ```text
    /// /**
    ///    * Called when a window has been raised.
    ///    */
    /// ```
    ///

    /// `[noscript] void windowRaised (in mozIDOMWindowProxy aWindow);`
    #[inline]
    pub unsafe fn WindowRaised(&self, aWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).WindowRaised)(self, aWindow)
    }


    /// ```text
    /// /**
    ///    * Called when a window has been lowered.
    ///    */
    /// ```
    ///

    /// `[noscript] void windowLowered (in mozIDOMWindowProxy aWindow);`
    #[inline]
    pub unsafe fn WindowLowered(&self, aWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).WindowLowered)(self, aWindow)
    }


    /// ```text
    /// /**
    ///    * Called when a new document in a window is shown.
    ///    *
    ///    * If aNeedsFocus is true, then focus events are expected to be fired on the
    ///    * window if this window is in the focused window chain.
    ///    */
    /// ```
    ///

    /// `[noscript] void windowShown (in mozIDOMWindowProxy aWindow, in boolean aNeedsFocus);`
    #[inline]
    pub unsafe fn WindowShown(&self, aWindow: *const mozIDOMWindowProxy, aNeedsFocus: bool) -> nsresult {
        ((*self.vtable).WindowShown)(self, aWindow, aNeedsFocus)
    }


    /// ```text
    /// /**
    ///    * Called when a document in a window has been hidden or otherwise can no
    ///    * longer accept focus.
    ///    */
    /// ```
    ///

    /// `[noscript] void windowHidden (in mozIDOMWindowProxy aWindow);`
    #[inline]
    pub unsafe fn WindowHidden(&self, aWindow: *const mozIDOMWindowProxy) -> nsresult {
        ((*self.vtable).WindowHidden)(self, aWindow)
    }


    /// ```text
    /// /**
    ///    * Fire any events that have been delayed due to synchronized actions.
    ///    */
    /// ```
    ///

    /// `[noscript] void fireDelayedEvents (in nsIDocument aDocument);`
    #[inline]
    pub unsafe fn FireDelayedEvents(&self, aDocument: *const nsIDocument) -> nsresult {
        ((*self.vtable).FireDelayedEvents)(self, aDocument)
    }


    /// ```text
    /// /**
    ///    * Indicate that a plugin wishes to take the focus. This is similar to a
    ///    * normal focus except that the widget focus is not changed. Updating the
    ///    * widget focus state is the responsibility of the caller.
    ///    */
    /// ```
    ///

    /// `[noscript] void focusPlugin (in nsIContent aPlugin);`
    #[inline]
    pub unsafe fn FocusPlugin(&self, aPlugin: *const nsIContent) -> nsresult {
        ((*self.vtable).FocusPlugin)(self, aPlugin)
    }


    /// ```text
    /// /**
    ///    * Used in a child process to indicate that the parent window is now
    ///    * active or deactive.
    ///    */
    /// ```
    ///

    /// `[noscript] void parentActivated (in mozIDOMWindowProxy aWindow, in bool active);`
    #[inline]
    pub unsafe fn ParentActivated(&self, aWindow: *const mozIDOMWindowProxy, active: bool) -> nsresult {
        ((*self.vtable).ParentActivated)(self, aWindow, active)
    }


}