mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
Bug 1869796 - Inline CalculateChromeFlagsHelper. r=smaug
The only caller already is calculating a lot of other flags. Differential Revision: https://phabricator.services.mozilla.com/D197871
This commit is contained in:
parent
e432414202
commit
b2168e5b30
@ -1783,47 +1783,6 @@ nsresult nsWindowWatcher::URIfromURL(const nsACString& aURL,
|
||||
return NS_NewURI(aURI, aURL, nullptr, baseURI);
|
||||
}
|
||||
|
||||
// static
|
||||
uint32_t nsWindowWatcher::CalculateChromeFlagsHelper(
|
||||
uint32_t aInitialFlags, const WindowFeatures& aFeatures,
|
||||
bool* presenceFlag) {
|
||||
uint32_t chromeFlags = aInitialFlags;
|
||||
|
||||
if (aFeatures.GetBoolWithDefault("titlebar", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("close", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("toolbar", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TOOLBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("location", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_LOCATIONBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("personalbar", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("status", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_STATUSBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("menubar", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_MENUBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("resizable", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_RESIZE;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("minimizable", false, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_MINIMIZE;
|
||||
}
|
||||
|
||||
if (aFeatures.GetBoolWithDefault("scrollbars", true, presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS;
|
||||
}
|
||||
|
||||
return chromeFlags;
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures) {
|
||||
if (aFeatures.IsEmpty()) {
|
||||
@ -1925,8 +1884,36 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
||||
}
|
||||
|
||||
/* Next, allow explicitly named options to override the initial settings */
|
||||
chromeFlags =
|
||||
CalculateChromeFlagsHelper(chromeFlags, aFeatures, &presenceFlag);
|
||||
if (aFeatures.GetBoolWithDefault("titlebar", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("close", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("toolbar", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TOOLBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("location", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_LOCATIONBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("personalbar", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("status", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_STATUSBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("menubar", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_MENUBAR;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("resizable", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_RESIZE;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("minimizable", false, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_MINIMIZE;
|
||||
}
|
||||
if (aFeatures.GetBoolWithDefault("scrollbars", true, &presenceFlag)) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS;
|
||||
}
|
||||
|
||||
// Determine whether the window is a private browsing window
|
||||
if (aFeatures.GetBoolWithDefault("private", false, &presenceFlag)) {
|
||||
@ -2030,10 +2017,6 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
||||
}
|
||||
}
|
||||
|
||||
/* missing
|
||||
chromeFlags->copy_history
|
||||
*/
|
||||
|
||||
return chromeFlags;
|
||||
}
|
||||
|
||||
|
@ -96,10 +96,6 @@ class nsWindowWatcher : public nsIWindowWatcher,
|
||||
nsIWebBrowserChrome* aParentChrome, uint32_t aChromeFlags,
|
||||
nsIOpenWindowInfo* aOpenWindowInfo, nsIWebBrowserChrome** aResult);
|
||||
|
||||
static uint32_t CalculateChromeFlagsHelper(
|
||||
uint32_t aInitialFlags, const mozilla::dom::WindowFeatures& aFeatures,
|
||||
bool* presenceFlag = nullptr);
|
||||
|
||||
protected:
|
||||
nsTArray<nsWatcherWindowEnumerator*> mEnumeratorList;
|
||||
nsWatcherWindowEntry* mOldestWindow;
|
||||
|
Loading…
x
Reference in New Issue
Block a user