Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit b44d1c0

Browse files
committed
Bug 1772432 - Clean up nsWidgetInitData. r=stransky
Use inline initializers, remove dead code, use consistent naming. No behavior change. Differential Revision: https://phabricator.services.mozilla.com/D148209
1 parent e937533 commit b44d1c0

8 files changed

Lines changed: 26 additions & 57 deletions

File tree

layout/xul/nsMenuPopupFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
322322
nsWidgetInitData widgetData;
323323
widgetData.mWindowType = eWindowType_popup;
324324
widgetData.mBorderStyle = eBorderStyle_default;
325-
widgetData.clipSiblings = true;
325+
widgetData.mClipSiblings = true;
326326
widgetData.mPopupHint = mPopupType;
327327
widgetData.mNoAutoHide = IsNoAutoHide();
328328

toolkit/components/browser/nsWebBrowser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ nsIWidget* nsWebBrowser::EnsureWidget() {
8585
}
8686

8787
nsWidgetInitData widgetInit;
88-
widgetInit.clipChildren = true;
88+
widgetInit.mClipChildren = true;
8989
widgetInit.mWindowType = eWindowType_child;
9090
LayoutDeviceIntRect bounds(0, 0, 0, 0);
9191

view/nsView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ static int32_t FindNonAutoZIndex(nsView* aView) {
517517
struct DefaultWidgetInitData : public nsWidgetInitData {
518518
DefaultWidgetInitData() : nsWidgetInitData() {
519519
mWindowType = eWindowType_child;
520-
clipChildren = true;
521-
clipSiblings = true;
520+
mClipChildren = true;
521+
mClipSiblings = true;
522522
}
523523
};
524524

widget/nsBaseWidget.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ nsBaseWidget::nsBaseWidget(nsBorderStyle aBorderStyle)
146146
mPopupLevel(ePopupLevelTop),
147147
mPopupType(ePopupTypeAny),
148148
mHasRemoteContent(false),
149-
mFissionWindow(false),
150149
mUpdateCursor(true),
151150
mUseAttachedEvents(false),
152151
mIMEHasFocus(false),
@@ -414,14 +413,12 @@ nsBaseWidget::~nsBaseWidget() {
414413
//
415414
//-------------------------------------------------------------------------
416415
void nsBaseWidget::BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData) {
417-
// keep a reference to the device context
418-
if (nullptr != aInitData) {
416+
if (aInitData) {
419417
mWindowType = aInitData->mWindowType;
420418
mBorderStyle = aInitData->mBorderStyle;
421419
mPopupLevel = aInitData->mPopupLevel;
422420
mPopupType = aInitData->mPopupHint;
423421
mHasRemoteContent = aInitData->mHasRemoteContent;
424-
mFissionWindow = aInitData->mFissionWindow;
425422
}
426423

427424
if (aParent) {

widget/nsBaseWidget.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,6 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
714714
nsPopupType mPopupType;
715715
SizeConstraints mSizeConstraints;
716716
bool mHasRemoteContent;
717-
bool mFissionWindow;
718717

719718
bool mUpdateCursor;
720719
bool mUseAttachedEvents;

widget/nsWidgetInitData.h

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -88,57 +88,33 @@ enum nsBorderStyle {
8888
*/
8989

9090
struct nsWidgetInitData {
91-
nsWidgetInitData()
92-
: mWindowType(eWindowType_child),
93-
mBorderStyle(eBorderStyle_default),
94-
mPopupHint(ePopupTypePanel),
95-
mPopupLevel(ePopupLevelTop),
96-
mScreenId(0),
97-
clipChildren(false),
98-
clipSiblings(false),
99-
mDropShadow(false),
100-
mRTL(false),
101-
mNoAutoHide(false),
102-
mIsDragPopup(false),
103-
mIsAnimationSuppressed(false),
104-
mSupportTranslucency(false),
105-
mMouseTransparent(false),
106-
mHasRemoteContent(false),
107-
mAlwaysOnTop(false),
108-
mPIPWindow(false),
109-
mFissionWindow(false),
110-
mResizable(false),
111-
mIsPrivate(false) {}
91+
nsWidgetInitData() = default;
11292

113-
nsWindowType mWindowType;
114-
nsBorderStyle mBorderStyle;
115-
nsPopupType mPopupHint;
116-
nsPopupLevel mPopupLevel;
117-
// B2G multi-screen support. Screen ID is for differentiating screens of
118-
// windows, and due to the hardware limitation, it is platform-specific for
119-
// now, which align with the value of display type defined in HWC.
120-
uint32_t mScreenId;
93+
nsWindowType mWindowType = eWindowType_child;
94+
nsBorderStyle mBorderStyle = eBorderStyle_default;
95+
nsPopupType mPopupHint = ePopupTypePanel;
96+
nsPopupLevel mPopupLevel = ePopupLevelTop;
12197
// when painting exclude area occupied by child windows and sibling windows
122-
bool clipChildren, clipSiblings, mDropShadow;
123-
bool mRTL;
124-
bool mNoAutoHide; // true for noautohide panels
125-
bool mIsDragPopup; // true for drag feedback panels
98+
bool mClipChildren = false;
99+
bool mClipSiblings = false;
100+
bool mDropShadow = false;
101+
bool mRTL = false;
102+
bool mNoAutoHide = false; // true for noautohide panels
103+
bool mIsDragPopup = false; // true for drag feedback panels
126104
// true if window creation animation is suppressed, e.g. for session restore
127-
bool mIsAnimationSuppressed;
105+
bool mIsAnimationSuppressed = false;
128106
// true if the window should support an alpha channel, if available.
129-
bool mSupportTranslucency;
107+
bool mSupportTranslucency = false;
130108
// true if the window should be transparent to mouse events. Currently this is
131109
// only valid for eWindowType_popup widgets
132-
bool mMouseTransparent;
133-
bool mHasRemoteContent;
134-
bool mAlwaysOnTop;
110+
bool mMouseTransparent = false;
111+
bool mHasRemoteContent = false;
112+
bool mAlwaysOnTop = false;
135113
// Is PictureInPicture window
136-
bool mPIPWindow;
137-
// True if fission is enabled for this window
138-
bool mFissionWindow;
114+
bool mPIPWindow = false;
139115
// True if the window is user-resizable.
140-
bool mResizable;
141-
bool mIsPrivate;
116+
bool mResizable = false;
117+
bool mIsPrivate = false;
142118
};
143119

144120
#endif // nsWidgetInitData_h__

widget/windows/nsWindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,12 +982,12 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
982982
style &= ~0x40000000; // WS_CHILDWINDOW
983983
} else {
984984
// See if the caller wants to explictly set clip children and clip siblings
985-
if (aInitData->clipChildren) {
985+
if (aInitData->mClipChildren) {
986986
style |= WS_CLIPCHILDREN;
987987
} else {
988988
style &= ~WS_CLIPCHILDREN;
989989
}
990-
if (aInitData->clipSiblings) {
990+
if (aInitData->mClipSiblings) {
991991
style |= WS_CLIPSIBLINGS;
992992
}
993993
}

xpfe/appshell/nsAppShellService.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,6 @@ nsresult nsAppShellService::JustCreateTopWindow(
604604
if (aChromeMask & nsIWebBrowserChrome::CHROME_ALWAYS_ON_TOP)
605605
widgetInitData.mAlwaysOnTop = true;
606606

607-
if (aChromeMask & nsIWebBrowserChrome::CHROME_FISSION_WINDOW)
608-
widgetInitData.mFissionWindow = true;
609-
610607
if (aChromeMask & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW)
611608
widgetInitData.mHasRemoteContent = true;
612609

0 commit comments

Comments
 (0)