@@ -64,6 +64,7 @@ class KeyboardEvent;
64
64
class UIEvent ;
65
65
class XULButtonElement ;
66
66
class XULMenuBarElement ;
67
+ class XULPopupElement ;
67
68
} // namespace dom
68
69
} // namespace mozilla
69
70
@@ -189,10 +190,13 @@ extern const nsNavigationDirection DirectionFromKeyCodeTable[2][6];
189
190
190
191
// Used to hold information about a popup that is about to be opened.
191
192
struct PendingPopup {
192
- PendingPopup (nsIContent* aPopup, mozilla::dom::Event* aEvent);
193
+ using Element = mozilla::dom::Element;
194
+ using Event = mozilla::dom::Event;
193
195
194
- const RefPtr<nsIContent> mPopup ;
195
- const RefPtr<mozilla::dom::Event> mEvent ;
196
+ PendingPopup (Element* aPopup, Event* aEvent);
197
+
198
+ const RefPtr<Element> mPopup ;
199
+ const RefPtr<Event> mEvent ;
196
200
197
201
// Device pixels relative to the showing popup's presshell's
198
202
// root prescontext's root frame.
@@ -252,7 +256,7 @@ class nsMenuChainItem {
252
256
253
257
MOZ_COUNTED_DTOR (nsMenuChainItem)
254
258
255
- nsIContent* Content ();
259
+ mozilla::dom::XULPopupElement* Element ();
256
260
nsMenuPopupFrame* Frame () { return mFrame ; }
257
261
PopupType GetPopupType () { return mPopupType ; }
258
262
bool IsNoAutoHide () { return mNoAutoHide ; }
@@ -279,10 +283,11 @@ class nsMenuChainItem {
279
283
// this class is used for dispatching popuphiding events asynchronously.
280
284
class nsXULPopupHidingEvent : public mozilla ::Runnable {
281
285
using PopupType = mozilla::widget::PopupType;
286
+ using Element = mozilla::dom::Element;
282
287
283
288
public:
284
- nsXULPopupHidingEvent (nsIContent * aPopup, nsIContent * aNextPopup,
285
- nsIContent * aLastPopup, PopupType aPopupType,
289
+ nsXULPopupHidingEvent (Element * aPopup, Element * aNextPopup,
290
+ Element * aLastPopup, PopupType aPopupType,
286
291
HidePopupOptions aOptions)
287
292
: mozilla::Runnable(" nsXULPopupHidingEvent" ),
288
293
mPopup (aPopup),
@@ -298,17 +303,19 @@ class nsXULPopupHidingEvent : public mozilla::Runnable {
298
303
NS_IMETHOD Run () override ;
299
304
300
305
private:
301
- nsCOMPtr<nsIContent > mPopup ;
302
- nsCOMPtr<nsIContent > mNextPopup ;
303
- nsCOMPtr<nsIContent > mLastPopup ;
306
+ nsCOMPtr<Element > mPopup ;
307
+ nsCOMPtr<Element > mNextPopup ;
308
+ nsCOMPtr<Element > mLastPopup ;
304
309
PopupType mPopupType ;
305
310
HidePopupOptions mOptions ;
306
311
};
307
312
308
313
// this class is used for dispatching popuppositioned events asynchronously.
309
314
class nsXULPopupPositionedEvent : public mozilla ::Runnable {
315
+ using Element = mozilla::dom::Element;
316
+
310
317
public:
311
- explicit nsXULPopupPositionedEvent (nsIContent * aPopup)
318
+ explicit nsXULPopupPositionedEvent (Element * aPopup)
312
319
: mozilla::Runnable(" nsXULPopupPositionedEvent" ), mPopup(aPopup) {
313
320
MOZ_ASSERT (aPopup);
314
321
}
@@ -317,16 +324,18 @@ class nsXULPopupPositionedEvent : public mozilla::Runnable {
317
324
318
325
// Asynchronously dispatch a popuppositioned event at aPopup if this is a
319
326
// panel that should receieve such events. Return true if the event was sent.
320
- static bool DispatchIfNeeded (nsIContent * aPopup);
327
+ static bool DispatchIfNeeded (Element * aPopup);
321
328
322
329
private:
323
- const nsCOMPtr<nsIContent > mPopup ;
330
+ const nsCOMPtr<Element > mPopup ;
324
331
};
325
332
326
333
// this class is used for dispatching menu command events asynchronously.
327
334
class nsXULMenuCommandEvent : public mozilla ::Runnable {
335
+ using Element = mozilla::dom::Element;
336
+
328
337
public:
329
- nsXULMenuCommandEvent (mozilla::dom:: Element* aMenu, bool aIsTrusted,
338
+ nsXULMenuCommandEvent (Element* aMenu, bool aIsTrusted,
330
339
mozilla::Modifiers aModifiers, bool aUserInput,
331
340
bool aFlipChecked, int16_t aButton)
332
341
: mozilla::Runnable(" nsXULMenuCommandEvent" ),
@@ -348,7 +357,7 @@ class nsXULMenuCommandEvent : public mozilla::Runnable {
348
357
}
349
358
350
359
private:
351
- RefPtr<mozilla::dom:: Element> mMenu ;
360
+ RefPtr<Element> mMenu ;
352
361
353
362
mozilla::Modifiers mModifiers ;
354
363
int16_t mButton ;
@@ -369,6 +378,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
369
378
friend class TransitionEnder ;
370
379
371
380
using PopupType = mozilla::widget::PopupType;
381
+ using Element = mozilla::dom::Element;
372
382
373
383
NS_DECL_ISUPPORTS
374
384
NS_DECL_NSIOBSERVER
@@ -457,7 +467,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
457
467
*
458
468
* This fires the popupshowing event synchronously.
459
469
*/
460
- void ShowPopup (nsIContent * aPopup, nsIContent* aAnchorContent,
470
+ void ShowPopup (Element * aPopup, nsIContent* aAnchorContent,
461
471
const nsAString& aPosition, int32_t aXPos, int32_t aYPos,
462
472
bool aIsContextMenu, bool aAttributesOverride,
463
473
bool aSelectFirstItem, mozilla::dom::Event* aTriggerEvent);
@@ -472,14 +482,14 @@ class nsXULPopupManager final : public nsIDOMEventListener,
472
482
* offset from aXPos/aYPos to ensure that it is not under the mouse
473
483
* cursor.
474
484
*/
475
- void ShowPopupAtScreen (nsIContent * aPopup, int32_t aXPos, int32_t aYPos,
485
+ void ShowPopupAtScreen (Element * aPopup, int32_t aXPos, int32_t aYPos,
476
486
bool aIsContextMenu,
477
487
mozilla::dom::Event* aTriggerEvent);
478
488
479
489
/* Open a popup anchored at a screen rectangle specified by aRect.
480
490
* The remaining arguments are similar to ShowPopup.
481
491
*/
482
- void ShowPopupAtScreenRect (nsIContent * aPopup, const nsAString& aPosition,
492
+ void ShowPopupAtScreenRect (Element * aPopup, const nsAString& aPosition,
483
493
const nsIntRect& aRect, bool aIsContextMenu,
484
494
bool aAttributesOverride,
485
495
mozilla::dom::Event* aTriggerEvent);
@@ -494,14 +504,14 @@ class nsXULPopupManager final : public nsIDOMEventListener,
494
504
* TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
495
505
*/
496
506
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool ShowPopupAsNativeMenu (
497
- nsIContent * aPopup, int32_t aXPos, int32_t aYPos, bool aIsContextMenu,
507
+ Element * aPopup, int32_t aXPos, int32_t aYPos, bool aIsContextMenu,
498
508
mozilla::dom::Event* aTriggerEvent);
499
509
500
510
/* *
501
511
* Open a tooltip at a specific screen position specified by aXPos and aYPos,
502
512
* measured in device pixels. This fires the popupshowing event synchronously.
503
513
*/
504
- void ShowTooltipAtScreen (nsIContent * aPopup, nsIContent* aTriggerContent,
514
+ void ShowTooltipAtScreen (Element * aPopup, nsIContent* aTriggerContent,
505
515
const mozilla::LayoutDeviceIntPoint&);
506
516
507
517
/*
@@ -510,8 +520,8 @@ class nsXULPopupManager final : public nsIDOMEventListener,
510
520
* aLastPopup - optional popup to close last when hiding a chain of menus.
511
521
* If null, then all popups will be closed.
512
522
*/
513
- void HidePopup (nsIContent * aPopup, HidePopupOptions,
514
- nsIContent * aLastPopup = nullptr );
523
+ void HidePopup (Element * aPopup, HidePopupOptions,
524
+ Element * aLastPopup = nullptr );
515
525
516
526
/*
517
527
* Hide the popup of a <menu>.
@@ -566,7 +576,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
566
576
/* *
567
577
* Return true if the popup for the supplied content node is open.
568
578
*/
569
- bool IsPopupOpen (nsIContent * aPopup);
579
+ bool IsPopupOpen (Element * aPopup);
570
580
571
581
/* *
572
582
* Return the frame for the topmost open popup of a given type, or null if
@@ -642,7 +652,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
642
652
* changes attributes on the children of aPopup, and deals only with the
643
653
* content of the popup, not the frames.
644
654
*/
645
- void UpdateMenuItems (nsIContent * aPopup);
655
+ void UpdateMenuItems (Element * aPopup);
646
656
647
657
/* *
648
658
* Stop the timer which hides a popup after a delay, started by a previous
@@ -737,13 +747,13 @@ class nsXULPopupManager final : public nsIDOMEventListener,
737
747
MOZ_CAN_RUN_SCRIPT void HideOpenMenusBeforeExecutingMenu (CloseMenuMode aMode);
738
748
739
749
// callbacks for ShowPopup and HidePopup as events may be done asynchronously
740
- MOZ_CAN_RUN_SCRIPT void ShowPopupCallback (nsIContent * aPopup,
750
+ MOZ_CAN_RUN_SCRIPT void ShowPopupCallback (Element * aPopup,
741
751
nsMenuPopupFrame* aPopupFrame,
742
752
bool aIsContextMenu,
743
753
bool aSelectFirstItem);
744
754
MOZ_CAN_RUN_SCRIPT void HidePopupCallback (
745
- nsIContent * aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent * aNextPopup,
746
- nsIContent * aLastPopup, PopupType aPopupType, HidePopupOptions);
755
+ Element * aPopup, nsMenuPopupFrame* aPopupFrame, Element * aNextPopup,
756
+ Element * aLastPopup, PopupType aPopupType, HidePopupOptions);
747
757
748
758
/* *
749
759
* Trigger frame construction and reflow in the popup, fire a popupshowing
@@ -779,8 +789,8 @@ class nsXULPopupManager final : public nsIDOMEventListener,
779
789
* at.
780
790
*/
781
791
MOZ_CAN_RUN_SCRIPT_BOUNDARY
782
- void FirePopupHidingEvent (nsIContent * aPopup, nsIContent * aNextPopup,
783
- nsIContent * aLastPopup, nsPresContext* aPresContext,
792
+ void FirePopupHidingEvent (Element * aPopup, Element * aNextPopup,
793
+ Element * aLastPopup, nsPresContext* aPresContext,
784
794
PopupType aPopupType, HidePopupOptions aOptions);
785
795
786
796
/* *
@@ -843,7 +853,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
843
853
nsIDocShellTreeItem* aExpected);
844
854
845
855
// Finds a chain item in mPopups.
846
- nsMenuChainItem* FindPopup (nsIContent * aPopup) const ;
856
+ nsMenuChainItem* FindPopup (Element * aPopup) const ;
847
857
848
858
// the document the key event listener is attached to
849
859
nsCOMPtr<mozilla::dom::EventTarget> mKeyListener ;
0 commit comments